Commit 6bb4e95c authored by Zhihao Cheng's avatar Zhihao Cheng
Browse files

ubi: fastmap: Add control in 'UBI_IOCATT' ioctl to reserve PEBs for filling pools

mainline inclusion
from mainline-v6.7-rc1
commit ac085cfe57df2cc1d7a5c4c5e64b8780c8ad452f
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I9195H
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ac085cfe57df2cc1d7a5c4c5e64b8780c8ad452f

-------------------------------------------------

This patch imports a new field 'need_resv_pool' in struct 'ubi_attach_req'
to control whether or not reserving free PEBs for filling pool/wl_pool.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=217787


Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent 11e111ae
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1042,7 +1042,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.disable_fm,
					 false);
					 !!req.need_resv_pool);
		mutex_unlock(&ubi_devices_mutex);
		if (err < 0)
			put_mtd_device(mtd);
+3 −1
Original line number Diff line number Diff line
@@ -248,6 +248,7 @@ enum {
 * @max_beb_per1024: maximum expected number of bad PEB per 1024 PEBs
 * @padding: reserved for future, not used, has to be zeroed
 * @disable_fm: whether disable fastmap
 * @need_resv_pool: whether reserve free pebs for filling pool/wl_pool
 *
 * This data structure is used to specify MTD device UBI has to attach and the
 * parameters it has to use. The number which should be assigned to the new UBI
@@ -293,7 +294,8 @@ struct ubi_attach_req {
	__s32 vid_hdr_offset;
	__s16 max_beb_per1024;
	__s8 disable_fm;
	__s8 padding[9];
	__s8 need_resv_pool;
	__s8 padding[8];
};

/*