Commit b7cef0d2 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull UBI and UBIFS updates from Richard Weinberger:
 "UBI:
   - Use bitmap API to allocate bitmaps
   - New attach mode, disable_fm, to attach without fastmap
   - Fixes for various typos in comments

  UBIFS:
   - Fix for a deadlock when setting xattrs for encrypted file
   - Fix for an assertion failures when truncating encrypted files
   - Fixes for various typos in comments"

* tag 'for-linus-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs:
  ubi: fastmap: Add fastmap control support for 'UBI_IOCATT' ioctl
  ubi: fastmap: Use the bitmap API to allocate bitmaps
  ubifs: Fix AA deadlock when setting xattr for encrypted file
  ubifs: Fix UBIFS ro fail due to truncate in the encrypted directory
  mtd: ubi: drop unexpected word 'a' in comments
  ubi: block: Fix typos in comments
  ubi: fastmap: Fix typo in comments
  ubi: Fix repeated words in comments
  ubi: ubi-media.h: Fix comment typo
  ubi: block: Remove in vain semicolon
  ubifs: Fix ubifs_check_dir_empty() kernel-doc comment
parents 91080ab3 669d2044
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -409,7 +409,7 @@ int ubiblock_create(struct ubi_volume_info *vi)
	ret = blk_mq_alloc_tag_set(&dev->tag_set);
	if (ret) {
		dev_err(disk_to_dev(dev->gd), "blk_mq_alloc_tag_set failed");
		goto out_free_dev;;
		goto out_free_dev;
	}


@@ -441,7 +441,7 @@ int ubiblock_create(struct ubi_volume_info *vi)

	/*
	 * Create one workqueue per volume (per registered block device).
	 * Rembember workqueues are cheap, they're not threads.
	 * Remember workqueues are cheap, they're not threads.
	 */
	dev->wq = alloc_workqueue("%s", 0, 0, gd->disk_name);
	if (!dev->wq) {
+10 −4
Original line number Diff line number Diff line
@@ -807,6 +807,7 @@ static int autoresize(struct ubi_device *ubi, int vol_id)
 * @ubi_num: number to assign to the new UBI device
 * @vid_hdr_offset: VID header offset
 * @max_beb_per1024: maximum expected number of bad PEB per 1024 PEBs
 * @disable_fm: whether disable fastmap
 *
 * This function attaches MTD device @mtd_dev to UBI and assign @ubi_num number
 * to the newly created UBI device, unless @ubi_num is %UBI_DEV_NUM_AUTO, in
@@ -814,11 +815,15 @@ static int autoresize(struct ubi_device *ubi, int vol_id)
 * automatically. Returns the new UBI device number in case of success and a
 * negative error code in case of failure.
 *
 * If @disable_fm is true, ubi doesn't create new fastmap even the module param
 * 'fm_autoconvert' is set, and existed old fastmap will be destroyed after
 * doing full scanning.
 *
 * Note, the invocations of this function has to be serialized by the
 * @ubi_devices_mutex.
 */
int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
		       int vid_hdr_offset, int max_beb_per1024)
		       int vid_hdr_offset, int max_beb_per1024, bool disable_fm)
{
	struct ubi_device *ubi;
	int i, err;
@@ -921,7 +926,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
		UBI_FM_MIN_POOL_SIZE);

	ubi->fm_wl_pool.max_size = ubi->fm_pool.max_size / 2;
	ubi->fm_disabled = !fm_autoconvert;
	ubi->fm_disabled = (!fm_autoconvert || disable_fm) ? 1 : 0;
	if (fm_debug)
		ubi_enable_dbg_chk_fastmap(ubi);

@@ -962,7 +967,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
	if (!ubi->fm_buf)
		goto out_free;
#endif
	err = ubi_attach(ubi, 0);
	err = ubi_attach(ubi, disable_fm ? 1 : 0);
	if (err) {
		ubi_err(ubi, "failed to attach mtd%d, error %d",
			mtd->index, err);
@@ -1242,7 +1247,8 @@ static int __init ubi_init(void)

		mutex_lock(&ubi_devices_mutex);
		err = ubi_attach_mtd_dev(mtd, p->ubi_num,
					 p->vid_hdr_offs, p->max_beb_per1024);
					 p->vid_hdr_offs, p->max_beb_per1024,
					 false);
		mutex_unlock(&ubi_devices_mutex);
		if (err < 0) {
			pr_err("UBI error: cannot attach mtd%d\n",
+2 −2
Original line number Diff line number Diff line
@@ -672,7 +672,7 @@ static int verify_rsvol_req(const struct ubi_device *ubi,
 * @req: volumes re-name request
 *
 * This is a helper function for the volume re-name IOCTL which validates the
 * the request, opens the volume and calls corresponding volumes management
 * request, opens the volume and calls corresponding volumes management
 * function. Returns zero in case of success and a negative error code in case
 * of failure.
 */
@@ -1041,7 +1041,7 @@ static long ctrl_cdev_ioctl(struct file *file, unsigned int cmd,
		 */
		mutex_lock(&ubi_devices_mutex);
		err = ubi_attach_mtd_dev(mtd, req.ubi_num, req.vid_hdr_offset,
					 req.max_beb_per1024);
					 req.max_beb_per1024, !!req.disable_fm);
		mutex_unlock(&ubi_devices_mutex);
		if (err < 0)
			put_mtd_device(mtd);
+1 −1
Original line number Diff line number Diff line
@@ -377,7 +377,7 @@ static int leb_write_lock(struct ubi_device *ubi, int vol_id, int lnum)
 *
 * This function locks a logical eraseblock for writing if there is no
 * contention and does nothing if there is contention. Returns %0 in case of
 * success, %1 in case of contention, and and a negative error code in case of
 * success, %1 in case of contention, and a negative error code in case of
 * failure.
 */
static int leb_write_trylock(struct ubi_device *ubi, int vol_id, int lnum)
+4 −6
Original line number Diff line number Diff line
@@ -20,8 +20,7 @@ static inline unsigned long *init_seen(struct ubi_device *ubi)
	if (!ubi_dbg_chk_fastmap(ubi))
		return NULL;

	ret = kcalloc(BITS_TO_LONGS(ubi->peb_count), sizeof(unsigned long),
		      GFP_KERNEL);
	ret = bitmap_zalloc(ubi->peb_count, GFP_KERNEL);
	if (!ret)
		return ERR_PTR(-ENOMEM);

@@ -34,7 +33,7 @@ static inline unsigned long *init_seen(struct ubi_device *ubi)
 */
static inline void free_seen(unsigned long *seen)
{
	kfree(seen);
	bitmap_free(seen);
}

/**
@@ -1108,8 +1107,7 @@ int ubi_fastmap_init_checkmap(struct ubi_volume *vol, int leb_count)
	if (!ubi->fast_attach)
		return 0;

	vol->checkmap = kcalloc(BITS_TO_LONGS(leb_count), sizeof(unsigned long),
				GFP_KERNEL);
	vol->checkmap = bitmap_zalloc(leb_count, GFP_KERNEL);
	if (!vol->checkmap)
		return -ENOMEM;

@@ -1118,7 +1116,7 @@ int ubi_fastmap_init_checkmap(struct ubi_volume *vol, int leb_count)

void ubi_fastmap_destroy_checkmap(struct ubi_volume *vol)
{
	kfree(vol->checkmap);
	bitmap_free(vol->checkmap);
}

/**
Loading