History

Merge tag 'ubifs-for-linus-7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs

Pull UBI and UBIFS updates from Richard Weinberger: "UBI: - Support for a per-device wear-leveling threshold - Various fixes and cleanups of error paths - Correctly preserve torture flag up wear-leveling UBIFS: - Various fixes and cleanups of error paths and kernel-doc" * tag 'ubifs-for-linus-7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs: UBI: support per-device wear-leveling threshold UBI: fix two issues in the ubi.mtd MODULE_PARM_DESC mtd: ubi: Release device reference on busy detach ubi: Fix rollback for explicit UBI device numbers ubifs: fix out-of-bounds read in signature length check UBI: fastmap: Pass to_be_tortured when reusing old fastmap PEBs UBI: Preserve torture flag when rescheduling failed erasures ubifs: ubifs.h: clean up kernel-doc comments ubifs: key.h: use correct function parameter name ubifs: debug.h: fix kernel-doc struct prototypes

Linus Torvalds committed 2 months ago

Commit ce727a02 parents 115bd36 a5e005513 files · +122 −74Browse files

Unified · Split

13 files
  1. drivers/mtd/ubi/attach.c +2 −2
  2. drivers/mtd/ubi/build.c +39 −9
  3. drivers/mtd/ubi/cdev.c +1 −1
  4. drivers/mtd/ubi/fastmap-wl.c +4 −4
  5. drivers/mtd/ubi/fastmap.c +4 −2
  6. drivers/mtd/ubi/io.c +7 −4
  7. drivers/mtd/ubi/ubi.h +22 −3
  8. drivers/mtd/ubi/wl.c +18 −36
  9. fs/ubifs/auth.c +1 −1
  10. fs/ubifs/debug.h +2 −2
  11. fs/ubifs/key.h +1 −1
  12. fs/ubifs/ubifs.h +12 −8
  13. include/uapi/mtd/ubi-user.h +9 −1
drivers/mtd/ubi/attach.c+2−2
@@ -771,7 +771,7 @@ void ubi_remove_av(struct ubi_attach_info *ai, struct ubi_ainf_volume *av) · 770 unmodified lines
771static int early_erase_peb(struct ubi_device *ubi,771static int early_erase_peb(struct ubi_device *ubi,
772 const struct ubi_attach_info *ai, int pnum, int ec)772 const struct ubi_attach_info *ai, int pnum, int ec)
773{773{
774 int err;774 int err, torture = 0;
775 struct ubi_ec_hdr *ec_hdr;775 struct ubi_ec_hdr *ec_hdr;
776 776
777 if ((long long)ec >= UBI_MAX_ERASECOUNTER) {777 if ((long long)ec >= UBI_MAX_ERASECOUNTER) {
@@ -790,7 +790,7 @@ static int early_erase_peb(struct ubi_device *ubi, · 12 unmodified lines
790 790
791 ec_hdr->ec = cpu_to_be64(ec);791 ec_hdr->ec = cpu_to_be64(ec);
792 792
793 err = ubi_io_sync_erase(ubi, pnum, 0);793 err = ubi_io_sync_erase(ubi, pnum, &torture);
794 if (err < 0)794 if (err < 0)
795 goto out_free;795 goto out_free;
796 796
drivers/mtd/ubi/build.c+39−9
@@ -36,7 +36,7 @@ · 35 unmodified lines
36#define MTD_PARAM_LEN_MAX 6436#define MTD_PARAM_LEN_MAX 64
37 37
38/* Maximum number of comma-separated items in the 'mtd=' parameter */38/* Maximum number of comma-separated items in the 'mtd=' parameter */
39#define MTD_PARAM_MAX_COUNT 639#define MTD_PARAM_MAX_COUNT 7
40 40
41/* Maximum value for the number of bad PEBs per 1024 PEBs */41/* Maximum value for the number of bad PEBs per 1024 PEBs */
42#define MAX_MTD_UBI_BEB_LIMIT 76842#define MAX_MTD_UBI_BEB_LIMIT 768
@@ -56,6 +56,7 @@ · 13 unmodified lines
56 * @max_beb_per1024: maximum expected number of bad PEBs per 1024 PEBs56 * @max_beb_per1024: maximum expected number of bad PEBs per 1024 PEBs
57 * @enable_fm: enable fastmap when value is non-zero57 * @enable_fm: enable fastmap when value is non-zero
58 * @need_resv_pool: reserve pool->max_size pebs when value is none-zero58 * @need_resv_pool: reserve pool->max_size pebs when value is none-zero
59 * @wl_threshold: wear-leveling threshold, 0 means use CONFIG_MTD_UBI_WL_THRESHOLD
59 */60 */
60struct mtd_dev_param {61struct mtd_dev_param {
61 char name[MTD_PARAM_LEN_MAX];62 char name[MTD_PARAM_LEN_MAX];
@@ -64,6 +65,7 @@ struct mtd_dev_param { · 2 unmodified lines
64 int max_beb_per1024;65 int max_beb_per1024;
65 int enable_fm;66 int enable_fm;
66 int need_resv_pool;67 int need_resv_pool;
68 int wl_threshold;
67};69};
68 70
69/* Numbers of elements set in the @mtd_dev_param array */71/* Numbers of elements set in the @mtd_dev_param array */
@@ -832,6 +834,8 @@ static int autoresize(struct ubi_device *ubi, int vol_id) · 762 unmodified lines
832 * @max_beb_per1024: maximum expected number of bad PEB per 1024 PEBs834 * @max_beb_per1024: maximum expected number of bad PEB per 1024 PEBs
833 * @disable_fm: whether disable fastmap835 * @disable_fm: whether disable fastmap
834 * @need_resv_pool: whether reserve pebs to fill fm_pool836 * @need_resv_pool: whether reserve pebs to fill fm_pool
837 * @wl_threshold: wear-leveling threshold for this UBI device; 0 means use
838 * %CONFIG_MTD_UBI_WL_THRESHOLD; accepted range is 2-65536
835 *839 *
836 * This function attaches MTD device @mtd_dev to UBI and assign @ubi_num number840 * This function attaches MTD device @mtd_dev to UBI and assign @ubi_num number
837 * to the newly created UBI device, unless @ubi_num is %UBI_DEV_NUM_AUTO, in841 * to the newly created UBI device, unless @ubi_num is %UBI_DEV_NUM_AUTO, in
@@ -848,7 +852,7 @@ static int autoresize(struct ubi_device *ubi, int vol_id) · 10 unmodified lines
848 */852 */
849int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,853int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
850 int vid_hdr_offset, int max_beb_per1024, bool disable_fm,854 int vid_hdr_offset, int max_beb_per1024, bool disable_fm,
851 bool need_resv_pool)855 bool need_resv_pool, int wl_threshold)
852{856{
853 struct ubi_device *ubi;857 struct ubi_device *ubi;
854 int i, err;858 int i, err;
@@ -859,6 +863,15 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, · 4 unmodified lines
859 if (!max_beb_per1024)863 if (!max_beb_per1024)
860 max_beb_per1024 = CONFIG_MTD_UBI_BEB_LIMIT;864 max_beb_per1024 = CONFIG_MTD_UBI_BEB_LIMIT;
861 865
866 if (!wl_threshold)
867 wl_threshold = CONFIG_MTD_UBI_WL_THRESHOLD;
868
869 if (wl_threshold < 2 || wl_threshold > 65536) {
870 pr_err("ubi: bad wear-leveling threshold %d\n",
871 wl_threshold);
872 return -EINVAL;
873 }
874
862 /*875 /*
863 * Check if we already have the same MTD device attached.876 * Check if we already have the same MTD device attached.
864 *877 *
@@ -944,6 +957,8 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, · 79 unmodified lines
944 ubi->ubi_num = ubi_num;957 ubi->ubi_num = ubi_num;
945 ubi->vid_hdr_offset = vid_hdr_offset;958 ubi->vid_hdr_offset = vid_hdr_offset;
946 ubi->autoresize_vol_id = -1;959 ubi->autoresize_vol_id = -1;
960 ubi->wl_threshold = wl_threshold;
961 ubi->wl_free_max_diff = wl_threshold * 2;
947 962
948#ifdef CONFIG_MTD_UBI_FASTMAP963#ifdef CONFIG_MTD_UBI_FASTMAP
949 ubi->fm_pool.used = ubi->fm_pool.size = 0;964 ubi->fm_pool.used = ubi->fm_pool.size = 0;
@@ -1044,7 +1059,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, · 94 unmodified lines
1044 ubi->vol_count - UBI_INT_VOL_COUNT, UBI_INT_VOL_COUNT,1059 ubi->vol_count - UBI_INT_VOL_COUNT, UBI_INT_VOL_COUNT,
1045 ubi->vtbl_slots);1060 ubi->vtbl_slots);
1046 ubi_msg(ubi, "max/mean erase counter: %d/%d, WL threshold: %d, image sequence number: %u",1061 ubi_msg(ubi, "max/mean erase counter: %d/%d, WL threshold: %d, image sequence number: %u",
1047 ubi->max_ec, ubi->mean_ec, CONFIG_MTD_UBI_WL_THRESHOLD,1062 ubi->max_ec, ubi->mean_ec, ubi->wl_threshold,
1048 ubi->image_seq);1063 ubi->image_seq);
1049 ubi_msg(ubi, "available PEBs: %d, total reserved PEBs: %d, PEBs reserved for bad PEB handling: %d",1064 ubi_msg(ubi, "available PEBs: %d, total reserved PEBs: %d, PEBs reserved for bad PEB handling: %d",
1050 ubi->avail_pebs, ubi->rsvd_pebs, ubi->beb_rsvd_pebs);1065 ubi->avail_pebs, ubi->rsvd_pebs, ubi->beb_rsvd_pebs);
@@ -1105,6 +1120,7 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway) · 54 unmodified lines
1105 ubi->ref_count -= 1;1120 ubi->ref_count -= 1;
1106 if (ubi->ref_count) {1121 if (ubi->ref_count) {
1107 if (!anyway) {1122 if (!anyway) {
1123 put_device(&ubi->dev);
1108 spin_unlock(&ubi_devices_lock);1124 spin_unlock(&ubi_devices_lock);
1109 return -EBUSY;1125 return -EBUSY;
1110 }1126 }
@@ -1247,7 +1263,7 @@ static void ubi_notify_add(struct mtd_info *mtd) · 136 unmodified lines
1247 1263
1248 /* called while holding mtd_table_mutex */1264 /* called while holding mtd_table_mutex */
1249 mutex_lock_nested(&ubi_devices_mutex, SINGLE_DEPTH_NESTING);1265 mutex_lock_nested(&ubi_devices_mutex, SINGLE_DEPTH_NESTING);
1250 err = ubi_attach_mtd_dev(mtd, UBI_DEV_NUM_AUTO, 0, 0, false, false);1266 err = ubi_attach_mtd_dev(mtd, UBI_DEV_NUM_AUTO, 0, 0, false, false, 0);
1251 mutex_unlock(&ubi_devices_mutex);1267 mutex_unlock(&ubi_devices_mutex);
1252 if (err < 0)1268 if (err < 0)
1253 __put_mtd_device(mtd);1269 __put_mtd_device(mtd);
@@ -1289,7 +1305,8 @@ static int __init ubi_init_attach(void) · 35 unmodified lines
1289 err = ubi_attach_mtd_dev(mtd, p->ubi_num,1305 err = ubi_attach_mtd_dev(mtd, p->ubi_num,
1290 p->vid_hdr_offs, p->max_beb_per1024,1306 p->vid_hdr_offs, p->max_beb_per1024,
1291 p->enable_fm == 0,1307 p->enable_fm == 0,
1292 p->need_resv_pool != 0);1308 p->need_resv_pool != 0,
1309 p->wl_threshold);
1293 mutex_unlock(&ubi_devices_mutex);1310 mutex_unlock(&ubi_devices_mutex);
1294 if (err < 0) {1311 if (err < 0) {
1295 pr_err("UBI error: cannot attach mtd%d\n",1312 pr_err("UBI error: cannot attach mtd%d\n",
@@ -1317,10 +1334,10 @@ static int __init ubi_init_attach(void) · 21 unmodified lines
1317 return 0;1334 return 0;
1318 1335
1319out_detach:1336out_detach:
1320 for (k = 0; k < i; k++)1337 for (k = 0; k < UBI_MAX_DEVICES; k++)
1321 if (ubi_devices[k]) {1338 if (ubi_devices[k]) {
1322 mutex_lock(&ubi_devices_mutex);1339 mutex_lock(&ubi_devices_mutex);
1323 ubi_detach_mtd_dev(ubi_devices[k]->ubi_num, 1);1340 ubi_detach_mtd_dev(k, 1);
1324 mutex_unlock(&ubi_devices_mutex);1341 mutex_unlock(&ubi_devices_mutex);
1325 }1342 }
1326 return err;1343 return err;
@@ -1569,12 +1586,24 @@ static int ubi_mtd_param_parse(const char *val, const struct kernel_param *kp) · 242 unmodified lines
1569 } else1586 } else
1570 p->need_resv_pool = 0;1587 p->need_resv_pool = 0;
1571 1588
1589 token = tokens[6];
1590 if (token) {
1591 int err = kstrtoint(token, 10, &p->wl_threshold);
1592
1593 if (err) {
1594 pr_err("UBI error: bad value for wl_threshold parameter: %s\n",
1595 token);
1596 return -EINVAL;
1597 }
1598 } else
1599 p->wl_threshold = 0;
1600
1572 mtd_devs += 1;1601 mtd_devs += 1;
1573 return 0;1602 return 0;
1574}1603}
1575 1604
1576module_param_call(mtd, ubi_mtd_param_parse, NULL, NULL, 0400);1605module_param_call(mtd, ubi_mtd_param_parse, NULL, NULL, 0400);
1577MODULE_PARM_DESC(mtd, "MTD devices to attach. Parameter format: mtd=<name|num|path>[,<vid_hdr_offs>[,max_beb_per1024[,ubi_num]]].\n"1606MODULE_PARM_DESC(mtd, "MTD devices to attach. Parameter format: mtd=<name|num|path>[,<vid_hdr_offs>[,max_beb_per1024[,ubi_num[,enable_fm[,need_resv_pool[,wl_threshold]]]]]].\n"
1578 "Multiple \"mtd\" parameters may be specified.\n"1607 "Multiple \"mtd\" parameters may be specified.\n"
1579 "MTD devices may be specified by their number, name, or path to the MTD character device node.\n"1608 "MTD devices may be specified by their number, name, or path to the MTD character device node.\n"
1580 "Optional \"vid_hdr_offs\" parameter specifies UBI VID header position to be used by UBI. (default value if 0)\n"1609 "Optional \"vid_hdr_offs\" parameter specifies UBI VID header position to be used by UBI. (default value if 0)\n"
@@ -1587,9 +1616,10 @@ MODULE_PARM_DESC(mtd, "MTD devices to attach. Parameter format: mtd=<name|num|pa · 6 unmodified lines
1587 "Example 1: mtd=/dev/mtd0 - attach MTD device /dev/mtd0.\n"1616 "Example 1: mtd=/dev/mtd0 - attach MTD device /dev/mtd0.\n"
1588 "Example 2: mtd=content,1984 mtd=4 - attach MTD device with name \"content\" using VID header offset 1984, and MTD device number 4 with default VID header offset.\n"1617 "Example 2: mtd=content,1984 mtd=4 - attach MTD device with name \"content\" using VID header offset 1984, and MTD device number 4 with default VID header offset.\n"
1589 "Example 3: mtd=/dev/mtd1,0,25 - attach MTD device /dev/mtd1 using default VID header offset and reserve 25*nand_size_in_blocks/1024 erase blocks for bad block handling.\n"1618 "Example 3: mtd=/dev/mtd1,0,25 - attach MTD device /dev/mtd1 using default VID header offset and reserve 25*nand_size_in_blocks/1024 erase blocks for bad block handling.\n"
1619 "\t(e.g. if the NAND *chipset* has 4096 PEB, 100 will be reserved for this UBI device).\n"
1590 "Example 4: mtd=/dev/mtd1,0,0,5 - attach MTD device /dev/mtd1 to UBI 5 and using default values for the other fields.\n"1620 "Example 4: mtd=/dev/mtd1,0,0,5 - attach MTD device /dev/mtd1 to UBI 5 and using default values for the other fields.\n"
1591 "example 5: mtd=1,0,0,5 mtd=2,0,0,6,1 - attach MTD device /dev/mtd1 to UBI 5 and disable fastmap; attach MTD device /dev/mtd2 to UBI 6 and enable fastmap.(only works when fastmap is enabled and fm_autoconvert=Y).\n"1621 "example 5: mtd=1,0,0,5 mtd=2,0,0,6,1 - attach MTD device /dev/mtd1 to UBI 5 and disable fastmap; attach MTD device /dev/mtd2 to UBI 6 and enable fastmap.(only works when fastmap is enabled and fm_autoconvert=Y).\n"
1592 "\t(e.g. if the NAND *chipset* has 4096 PEB, 100 will be reserved for this UBI device).");1622 "Example 6: mtd=/dev/mtd0,0,0,0,0,0,256 mtd=/dev/mtd1,0,0,0,0,0,4096 - attach MTD device /dev/mtd0 with wear-leveling threshold 256, and MTD device /dev/mtd1 with threshold 4096.\n");
1593#ifdef CONFIG_MTD_UBI_FASTMAP1623#ifdef CONFIG_MTD_UBI_FASTMAP
1594module_param(fm_autoconvert, bool, 0644);1624module_param(fm_autoconvert, bool, 0644);
1595MODULE_PARM_DESC(fm_autoconvert, "Set this parameter to enable fastmap automatically on images without a fastmap.");1625MODULE_PARM_DESC(fm_autoconvert, "Set this parameter to enable fastmap automatically on images without a fastmap.");
drivers/mtd/ubi/cdev.c+1−1
@@ -1112,7 +1112,7 @@ static long ctrl_cdev_ioctl(struct file *file, unsigned int cmd, · 1111 unmodified lines
1112 mutex_lock(&ubi_devices_mutex);1112 mutex_lock(&ubi_devices_mutex);
1113 err = ubi_attach_mtd_dev(mtd, req.ubi_num, req.vid_hdr_offset,1113 err = ubi_attach_mtd_dev(mtd, req.ubi_num, req.vid_hdr_offset,
1114 req.max_beb_per1024, !!req.disable_fm,1114 req.max_beb_per1024, !!req.disable_fm,
1115 !!req.need_resv_pool);1115 !!req.need_resv_pool, req.wl_threshold);
1116 mutex_unlock(&ubi_devices_mutex);1116 mutex_unlock(&ubi_devices_mutex);
1117 if (err < 0)1117 if (err < 0)
1118 put_mtd_device(mtd);1118 put_mtd_device(mtd);
drivers/mtd/ubi/fastmap-wl.c+4−4
@@ -238,7 +238,7 @@ void ubi_refill_pools_and_lock(struct ubi_device *ubi) · 237 unmodified lines
238 if (left_free <= 0)238 if (left_free <= 0)
239 break;239 break;
240 240
241 e = find_wl_entry(ubi, &ubi->free, WL_FREE_MAX_DIFF,241 e = find_wl_entry(ubi, &ubi->free, ubi->wl_free_max_diff,
242 !can_fill_pools(ubi, left_free));242 !can_fill_pools(ubi, left_free));
243 self_check_in_wl_tree(ubi, e, &ubi->free);243 self_check_in_wl_tree(ubi, e, &ubi->free);
244 rb_erase(&e->u.rb, &ubi->free);244 rb_erase(&e->u.rb, &ubi->free);
@@ -392,18 +392,18 @@ static bool need_wear_leveling(struct ubi_device *ubi) · 147 unmodified lines
392 if (!e) {392 if (!e) {
393 if (!ubi->free.rb_node)393 if (!ubi->free.rb_node)
394 return false;394 return false;
395 e = find_wl_entry(ubi, &ubi->free, WL_FREE_MAX_DIFF, 0);395 e = find_wl_entry(ubi, &ubi->free, ubi->wl_free_max_diff, 0);
396 ec = e->ec;396 ec = e->ec;
397 } else {397 } else {
398 ec = e->ec;398 ec = e->ec;
399 if (ubi->free.rb_node) {399 if (ubi->free.rb_node) {
400 e = find_wl_entry(ubi, &ubi->free, WL_FREE_MAX_DIFF, 0);400 e = find_wl_entry(ubi, &ubi->free, ubi->wl_free_max_diff, 0);
401 ec = max(ec, e->ec);401 ec = max(ec, e->ec);
402 }402 }
403 }403 }
404 e = rb_entry(rb_first(&ubi->used), struct ubi_wl_entry, u.rb);404 e = rb_entry(rb_first(&ubi->used), struct ubi_wl_entry, u.rb);
405 405
406 return ec - e->ec >= UBI_WL_THRESHOLD;406 return ec - e->ec >= ubi->wl_threshold;
407}407}
408 408
409/* get_peb_for_wl - returns a PEB to be used internally by the WL sub-system.409/* get_peb_for_wl - returns a PEB to be used internally by the WL sub-system.
drivers/mtd/ubi/fastmap.c+4−2
@@ -1526,7 +1526,8 @@ int ubi_update_fastmap(struct ubi_device *ubi) · 1525 unmodified lines
1526 1526
1527 if (!tmp_e) {1527 if (!tmp_e) {
1528 if (old_fm && old_fm->e[i]) {1528 if (old_fm && old_fm->e[i]) {
1529 ret = ubi_sync_erase(ubi, old_fm->e[i], 0);1529 ret = ubi_sync_erase(ubi, old_fm->e[i],
1530 &old_fm->to_be_tortured[i]);
1530 if (ret < 0) {1531 if (ret < 0) {
1531 ubi_err(ubi, "could not erase old fastmap PEB");1532 ubi_err(ubi, "could not erase old fastmap PEB");
1532 1533
@@ -1578,7 +1579,8 @@ int ubi_update_fastmap(struct ubi_device *ubi) · 45 unmodified lines
1578 if (old_fm) {1579 if (old_fm) {
1579 /* no fresh anchor PEB was found, reuse the old one */1580 /* no fresh anchor PEB was found, reuse the old one */
1580 if (!tmp_e) {1581 if (!tmp_e) {
1581 ret = ubi_sync_erase(ubi, old_fm->e[0], 0);1582 ret = ubi_sync_erase(ubi, old_fm->e[0],
1583 &old_fm->to_be_tortured[0]);
1582 if (ret < 0) {1584 if (ret < 0) {
1583 ubi_err(ubi, "could not erase old anchor PEB");1585 ubi_err(ubi, "could not erase old anchor PEB");
1584 1586
drivers/mtd/ubi/io.c+7−4
@@ -519,8 +519,10 @@ error: · 518 unmodified lines
519/**519/**
520 * ubi_io_sync_erase - synchronously erase a physical eraseblock.520 * ubi_io_sync_erase - synchronously erase a physical eraseblock.
521 * @ubi: UBI device description object521 * @ubi: UBI device description object
522 * @pnum: physical eraseblock number to erase522 * @pnum: the physical eraseblock number to erase
523 * @torture: if this physical eraseblock has to be tortured523 * @torture: if this physical eraseblock has to be tortured; cleared to zero
524 * once the torture test has completed successfully so that a retry
525 * of the erase does not torture the physical eraseblock again
524 *526 *
525 * This function synchronously erases physical eraseblock @pnum. If @torture527 * This function synchronously erases physical eraseblock @pnum. If @torture
526 * flag is not zero, the physical eraseblock is checked by means of writing528 * flag is not zero, the physical eraseblock is checked by means of writing
@@ -532,7 +534,7 @@ error: · 5 unmodified lines
532 * codes in case of other errors. Note, %-EIO means that the physical534 * codes in case of other errors. Note, %-EIO means that the physical
533 * eraseblock is bad.535 * eraseblock is bad.
534 */536 */
535int ubi_io_sync_erase(struct ubi_device *ubi, int pnum, int torture)537int ubi_io_sync_erase(struct ubi_device *ubi, int pnum, int *torture)
536{538{
537 int err, ret = 0;539 int err, ret = 0;
538 540
@@ -560,10 +562,11 @@ int ubi_io_sync_erase(struct ubi_device *ubi, int pnum, int torture) · 21 unmodified lines
560 return err;562 return err;
561 }563 }
562 564
563 if (torture) {565 if (*torture) {
564 ret = torture_peb(ubi, pnum);566 ret = torture_peb(ubi, pnum);
565 if (ret < 0)567 if (ret < 0)
566 return ret;568 return ret;
569 *torture = 0;
567 }570 }
568 571
569 err = do_sync_erase(ubi, pnum);572 err = do_sync_erase(ubi, pnum);
drivers/mtd/ubi/ubi.h+22−3
@@ -516,6 +516,22 @@ struct ubi_debug_info { · 515 unmodified lines
516 * @bgt_thread: background thread description object516 * @bgt_thread: background thread description object
517 * @thread_enabled: if the background thread is enabled517 * @thread_enabled: if the background thread is enabled
518 * @bgt_name: background thread name518 * @bgt_name: background thread name
519 * @wl_threshold: Maximum difference between two erase counters. If this
520 * threshold is exceeded, the WL sub-system starts moving
521 * data from used physical eraseblocks with low erase
522 * counter to free physical eraseblocks with high erase counter.
523 * @wl_free_max_diff: When a physical eraseblock is moved, the WL sub-system
524 * has to pick the target physical eraseblock to move to.
525 * The simplest way would be just to pick the one with the
526 * highest erase counter. But in certain workloads this
527 * could lead to an unlimited wear of one or few physical
528 * eraseblock. Indeed, imagine a situation when the picked
529 * physical eraseblock is constantly erased after the
530 * data is written to it. So, we have a constant which
531 * limits the highest erase counter of the free physical
532 * eraseblock to pick. Namely, the WL sub-system does not
533 * pick eraseblocks with erase counter greater than the
534 * lowest erase counter plus @wl_free_max_diff.
519 *535 *
520 * @flash_size: underlying MTD device size (in bytes)536 * @flash_size: underlying MTD device size (in bytes)
521 * @peb_count: count of physical eraseblocks on the MTD device537 * @peb_count: count of physical eraseblocks on the MTD device
@@ -623,6 +639,8 @@ struct ubi_device { · 101 unmodified lines
623 struct task_struct *bgt_thread;639 struct task_struct *bgt_thread;
624 int thread_enabled;640 int thread_enabled;
625 char bgt_name[sizeof(UBI_BGT_NAME_PATTERN)+2];641 char bgt_name[sizeof(UBI_BGT_NAME_PATTERN)+2];
642 int wl_threshold;
643 int wl_free_max_diff;
626 644
627 /* I/O sub-system's stuff */645 /* I/O sub-system's stuff */
628 long long flash_size;646 long long flash_size;
@@ -901,7 +919,7 @@ int self_check_eba(struct ubi_device *ubi, struct ubi_attach_info *ai_fastmap, · 272 unmodified lines
901 struct ubi_attach_info *ai_scan);919 struct ubi_attach_info *ai_scan);
902 920
903/* wl.c */921/* wl.c */
904int ubi_sync_erase(struct ubi_device *ubi, struct ubi_wl_entry *e, int torture);922int ubi_sync_erase(struct ubi_device *ubi, struct ubi_wl_entry *e, int *torture);
905int ubi_wl_get_peb(struct ubi_device *ubi);923int ubi_wl_get_peb(struct ubi_device *ubi);
906int ubi_wl_put_peb(struct ubi_device *ubi, int vol_id, int lnum,924int ubi_wl_put_peb(struct ubi_device *ubi, int vol_id, int lnum,
907 int pnum, int torture);925 int pnum, int torture);
@@ -923,7 +941,7 @@ int ubi_io_read(const struct ubi_device *ubi, void *buf, int pnum, int offset, · 15 unmodified lines
923 int len);941 int len);
924int ubi_io_write(struct ubi_device *ubi, const void *buf, int pnum, int offset,942int ubi_io_write(struct ubi_device *ubi, const void *buf, int pnum, int offset,
925 int len);943 int len);
926int ubi_io_sync_erase(struct ubi_device *ubi, int pnum, int torture);944int ubi_io_sync_erase(struct ubi_device *ubi, int pnum, int *torture);
927int ubi_io_is_bad(const struct ubi_device *ubi, int pnum);945int ubi_io_is_bad(const struct ubi_device *ubi, int pnum);
928int ubi_io_mark_bad(const struct ubi_device *ubi, int pnum);946int ubi_io_mark_bad(const struct ubi_device *ubi, int pnum);
929int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum,947int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum,
@@ -938,7 +956,8 @@ int ubi_io_write_vid_hdr(struct ubi_device *ubi, int pnum, · 8 unmodified lines
938/* build.c */956/* build.c */
939int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,957int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
940 int vid_hdr_offset, int max_beb_per1024,958 int vid_hdr_offset, int max_beb_per1024,
941 bool disable_fm, bool need_resv_pool);959 bool disable_fm, bool need_resv_pool,
960 int wl_threshold);
942int ubi_detach_mtd_dev(int ubi_num, int anyway);961int ubi_detach_mtd_dev(int ubi_num, int anyway);
943struct ubi_device *ubi_get_device(int ubi_num);962struct ubi_device *ubi_get_device(int ubi_num);
944void ubi_put_device(struct ubi_device *ubi);963void ubi_put_device(struct ubi_device *ubi);
drivers/mtd/ubi/wl.c+18−36
@@ -95,27 +95,6 @@ · 94 unmodified lines
95/* Number of physical eraseblocks reserved for wear-leveling purposes */95/* Number of physical eraseblocks reserved for wear-leveling purposes */
96#define WL_RESERVED_PEBS 196#define WL_RESERVED_PEBS 1
97 97
98/*
99 * Maximum difference between two erase counters. If this threshold is
100 * exceeded, the WL sub-system starts moving data from used physical
101 * eraseblocks with low erase counter to free physical eraseblocks with high
102 * erase counter.
103 */
104#define UBI_WL_THRESHOLD CONFIG_MTD_UBI_WL_THRESHOLD
105
106/*
107 * When a physical eraseblock is moved, the WL sub-system has to pick the target
108 * physical eraseblock to move to. The simplest way would be just to pick the
109 * one with the highest erase counter. But in certain workloads this could lead
110 * to an unlimited wear of one or few physical eraseblock. Indeed, imagine a
111 * situation when the picked physical eraseblock is constantly erased after the
112 * data is written to it. So, we have a constant which limits the highest erase
113 * counter of the free physical eraseblock to pick. Namely, the WL sub-system
114 * does not pick eraseblocks with erase counter greater than the lowest erase
115 * counter plus %WL_FREE_MAX_DIFF.
116 */
117#define WL_FREE_MAX_DIFF (2*UBI_WL_THRESHOLD)
118
119/*98/*
120 * Maximum number of consecutive background thread failures which is enough to99 * Maximum number of consecutive background thread failures which is enough to
121 * switch to read-only mode.100 * switch to read-only mode.
@@ -358,7 +337,7 @@ static struct ubi_wl_entry *find_wl_entry(struct ubi_device *ubi, · 236 unmodified lines
358 *337 *
359 * This function looks for a wear leveling entry with medium erase counter,338 * This function looks for a wear leveling entry with medium erase counter,
360 * but not greater or equivalent than the lowest erase counter plus339 * but not greater or equivalent than the lowest erase counter plus
361 * %WL_FREE_MAX_DIFF/2.340 * @ubi->wl_free_max_diff/2.
362 */341 */
363static struct ubi_wl_entry *find_mean_wl_entry(struct ubi_device *ubi,342static struct ubi_wl_entry *find_mean_wl_entry(struct ubi_device *ubi,
364 struct rb_root *root)343 struct rb_root *root)
@@ -368,7 +347,7 @@ static struct ubi_wl_entry *find_mean_wl_entry(struct ubi_device *ubi, · 3 unmodified lines
368 first = rb_entry(rb_first(root), struct ubi_wl_entry, u.rb);347 first = rb_entry(rb_first(root), struct ubi_wl_entry, u.rb);
369 last = rb_entry(rb_last(root), struct ubi_wl_entry, u.rb);348 last = rb_entry(rb_last(root), struct ubi_wl_entry, u.rb);
370 349
371 if (last->ec - first->ec < WL_FREE_MAX_DIFF) {350 if (last->ec - first->ec < ubi->wl_free_max_diff) {
372 e = rb_entry(root->rb_node, struct ubi_wl_entry, u.rb);351 e = rb_entry(root->rb_node, struct ubi_wl_entry, u.rb);
373 352
374 /*353 /*
@@ -379,7 +358,7 @@ static struct ubi_wl_entry *find_mean_wl_entry(struct ubi_device *ubi, · 4 unmodified lines
379 */358 */
380 e = may_reserve_for_fm(ubi, e, root);359 e = may_reserve_for_fm(ubi, e, root);
381 } else360 } else
382 e = find_wl_entry(ubi, root, WL_FREE_MAX_DIFF/2, 0);361 e = find_wl_entry(ubi, root, ubi->wl_free_max_diff/2, 0);
383 362
384 return e;363 return e;
385}364}
@@ -443,12 +422,14 @@ static int prot_queue_del(struct ubi_device *ubi, int pnum) · 57 unmodified lines
443 * ubi_sync_erase - synchronously erase a physical eraseblock.422 * ubi_sync_erase - synchronously erase a physical eraseblock.
444 * @ubi: UBI device description object423 * @ubi: UBI device description object
445 * @e: the physical eraseblock to erase424 * @e: the physical eraseblock to erase
446 * @torture: if the physical eraseblock has to be tortured425 * @torture: if the physical eraseblock has to be tortured; cleared to zero
426 * once the torture test has completed successfully so that a retry
427 * of the erase does not torture the physical eraseblock again
447 *428 *
448 * This function returns zero in case of success and a negative error code in429 * This function returns zero in case of success and a negative error code in
449 * case of failure.430 * case of failure.
450 */431 */
451int ubi_sync_erase(struct ubi_device *ubi, struct ubi_wl_entry *e, int torture)432int ubi_sync_erase(struct ubi_device *ubi, struct ubi_wl_entry *e, int *torture)
452{433{
453 int err;434 int err;
454 struct ubi_ec_hdr *ec_hdr;435 struct ubi_ec_hdr *ec_hdr;
@@ -706,7 +687,7 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk, · 251 unmodified lines
706#ifdef CONFIG_MTD_UBI_FASTMAP687#ifdef CONFIG_MTD_UBI_FASTMAP
707 e1 = find_anchor_wl_entry(&ubi->used);688 e1 = find_anchor_wl_entry(&ubi->used);
708 if (e1 && ubi->fm_anchor &&689 if (e1 && ubi->fm_anchor &&
709 (ubi->fm_anchor->ec - e1->ec >= UBI_WL_THRESHOLD)) {690 (ubi->fm_anchor->ec - e1->ec >= ubi->wl_threshold)) {
710 ubi->fm_do_produce_anchor = 1;691 ubi->fm_do_produce_anchor = 1;
711 /*692 /*
712 * fm_anchor is no longer considered a good anchor.693 * fm_anchor is no longer considered a good anchor.
@@ -743,7 +724,7 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk, · 30 unmodified lines
743 if (!e2)724 if (!e2)
744 goto out_cancel;725 goto out_cancel;
745 726
746 if (!(e2->ec - e1->ec >= UBI_WL_THRESHOLD)) {727 if (!(e2->ec - e1->ec >= ubi->wl_threshold)) {
747 dbg_wl("no WL needed: min used EC %d, max free EC %d",728 dbg_wl("no WL needed: min used EC %d, max free EC %d",
748 e1->ec, e2->ec);729 e1->ec, e2->ec);
749 730
@@ -1056,12 +1037,12 @@ static int ensure_wear_leveling(struct ubi_device *ubi, int nested) · 306 unmodified lines
1056 * We schedule wear-leveling only if the difference between the1037 * We schedule wear-leveling only if the difference between the
1057 * lowest erase counter of used physical eraseblocks and a high1038 * lowest erase counter of used physical eraseblocks and a high
1058 * erase counter of free physical eraseblocks is greater than1039 * erase counter of free physical eraseblocks is greater than
1059 * %UBI_WL_THRESHOLD.1040 * @ubi->wl_threshold.
1060 */1041 */
1061 e1 = rb_entry(rb_first(&ubi->used), struct ubi_wl_entry, u.rb);1042 e1 = rb_entry(rb_first(&ubi->used), struct ubi_wl_entry, u.rb);
1062 e2 = find_wl_entry(ubi, &ubi->free, WL_FREE_MAX_DIFF, 0);1043 e2 = find_wl_entry(ubi, &ubi->free, ubi->wl_free_max_diff, 0);
1063 1044
1064 if (!(e2->ec - e1->ec >= UBI_WL_THRESHOLD))1045 if (!(e2->ec - e1->ec >= ubi->wl_threshold))
1065 goto out_unlock;1046 goto out_unlock;
1066#endif1047#endif
1067 dbg_wl("schedule wear-leveling");1048 dbg_wl("schedule wear-leveling");
@@ -1113,7 +1094,7 @@ static int __erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk) · 45 unmodified lines
1113 dbg_wl("erase PEB %d EC %d LEB %d:%d",1094 dbg_wl("erase PEB %d EC %d LEB %d:%d",
1114 pnum, e->ec, wl_wrk->vol_id, wl_wrk->lnum);1095 pnum, e->ec, wl_wrk->vol_id, wl_wrk->lnum);
1115 1096
1116 err = ubi_sync_erase(ubi, e, wl_wrk->torture);1097 err = ubi_sync_erase(ubi, e, &wl_wrk->torture);
1117 if (!err) {1098 if (!err) {
1118 spin_lock(&ubi->wl_lock);1099 spin_lock(&ubi->wl_lock);
1119 1100
@@ -1150,7 +1131,8 @@ static int __erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk) · 30 unmodified lines
1150 int err1;1131 int err1;
1151 1132
1152 /* Re-schedule the LEB for erasure */1133 /* Re-schedule the LEB for erasure */
1153 err1 = schedule_erase(ubi, e, vol_id, lnum, 0, true);1134 err1 = schedule_erase(ubi, e, vol_id, lnum, wl_wrk->torture,
1135 true);
1154 if (err1) {1136 if (err1) {
1155 spin_lock(&ubi->wl_lock);1137 spin_lock(&ubi->wl_lock);
1156 wl_entry_destroy(ubi, e);1138 wl_entry_destroy(ubi, e);
@@ -1757,7 +1739,7 @@ static void shutdown_work(struct ubi_device *ubi) · 600 unmodified lines
1757static int erase_aeb(struct ubi_device *ubi, struct ubi_ainf_peb *aeb, bool sync)1739static int erase_aeb(struct ubi_device *ubi, struct ubi_ainf_peb *aeb, bool sync)
1758{1740{
1759 struct ubi_wl_entry *e;1741 struct ubi_wl_entry *e;
1760 int err;1742 int err, torture = 0;
1761 1743
1762 e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL);1744 e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL);
1763 if (!e)1745 if (!e)
@@ -1768,7 +1750,7 @@ static int erase_aeb(struct ubi_device *ubi, struct ubi_ainf_peb *aeb, bool sync · 4 unmodified lines
1768 ubi->lookuptbl[e->pnum] = e;1750 ubi->lookuptbl[e->pnum] = e;
1769 1751
1770 if (sync) {1752 if (sync) {
1771 err = ubi_sync_erase(ubi, e, false);1753 err = ubi_sync_erase(ubi, e, &torture);
1772 if (err)1754 if (err)
1773 goto out_free;1755 goto out_free;
1774 1756
@@ -2090,7 +2072,7 @@ static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi) · 315 unmodified lines
2090{2072{
2091 struct ubi_wl_entry *e;2073 struct ubi_wl_entry *e;
2092 2074
2093 e = find_wl_entry(ubi, &ubi->free, WL_FREE_MAX_DIFF, 0);2075 e = find_wl_entry(ubi, &ubi->free, ubi->wl_free_max_diff, 0);
2094 self_check_in_wl_tree(ubi, e, &ubi->free);2076 self_check_in_wl_tree(ubi, e, &ubi->free);
2095 ubi->free_count--;2077 ubi->free_count--;
2096 ubi_assert(ubi->free_count >= 0);2078 ubi_assert(ubi->free_count >= 0);
fs/ubifs/auth.c+1−1
@@ -217,7 +217,7 @@ int ubifs_sb_verify_signature(struct ubifs_info *c, · 216 unmodified lines
217 217
218 signode = snod->node;218 signode = snod->node;
219 219
220 if (le32_to_cpu(signode->len) > snod->len + sizeof(struct ubifs_sig_node)) {220 if (le32_to_cpu(signode->len) > snod->len - sizeof(struct ubifs_sig_node)) {
221 ubifs_err(c, "invalid signature len %d", le32_to_cpu(signode->len));221 ubifs_err(c, "invalid signature len %d", le32_to_cpu(signode->len));
222 err = -EINVAL;222 err = -EINVAL;
223 goto out_destroy;223 goto out_destroy;
fs/ubifs/debug.h+2−2
@@ -26,7 +26,7 @@ typedef int (*dbg_znode_callback)(struct ubifs_info *c, · 25 unmodified lines
26#define UBIFS_DFS_DIR_LEN (3 + 1 + 2 + 3 + 1)26#define UBIFS_DFS_DIR_LEN (3 + 1 + 2 + 3 + 1)
27 27
28/**28/**
29 * ubifs_debug_info - per-FS debugging information.29 * struct ubifs_debug_info - per-FS debugging information.
30 * @old_zroot: old index root - used by 'dbg_check_old_index()'30 * @old_zroot: old index root - used by 'dbg_check_old_index()'
31 * @old_zroot_level: old index root level - used by 'dbg_check_old_index()'31 * @old_zroot_level: old index root level - used by 'dbg_check_old_index()'
32 * @old_zroot_sqnum: old index root sqnum - used by 'dbg_check_old_index()'32 * @old_zroot_sqnum: old index root sqnum - used by 'dbg_check_old_index()'
@@ -119,7 +119,7 @@ struct ubifs_debug_info { · 86 unmodified lines
119};119};
120 120
121/**121/**
122 * ubifs_global_debug_info - global (not per-FS) UBIFS debugging information.122 * struct ubifs_global_debug_info - global (not per-FS) UBIFS debugging information.
123 *123 *
124 * @chk_gen: if general extra checks are enabled124 * @chk_gen: if general extra checks are enabled
125 * @chk_index: if index xtra checks are enabled125 * @chk_index: if index xtra checks are enabled
fs/ubifs/key.h+1−1
@@ -33,7 +33,7 @@ · 32 unmodified lines
33 33
34/**34/**
35 * key_mask_hash - mask a valid hash value.35 * key_mask_hash - mask a valid hash value.
36 * @val: value to be masked36 * @hash: value to be masked
37 *37 *
38 * We use hash values as offset in directories, so values %0 and %1 are38 * We use hash values as offset in directories, so values %0 and %1 are
39 * reserved for "." and "..". %2 is reserved for "end of readdir" marker. This39 * reserved for "." and "..". %2 is reserved for "end of readdir" marker. This
fs/ubifs/ubifs.h+12−8
@@ -738,6 +738,7 @@ struct ubifs_jhead { · 737 unmodified lines
738 * struct ubifs_zbranch - key/coordinate/length branch stored in znodes.738 * struct ubifs_zbranch - key/coordinate/length branch stored in znodes.
739 * @key: key739 * @key: key
740 * @znode: znode address in memory740 * @znode: znode address in memory
741 * @leaf: leaf node
741 * @lnum: LEB number of the target node (indexing node or data node)742 * @lnum: LEB number of the target node (indexing node or data node)
742 * @offs: target node offset within @lnum743 * @offs: target node offset within @lnum
743 * @len: target node length744 * @len: target node length
@@ -801,7 +802,7 @@ struct ubifs_znode { · 57 unmodified lines
801 * @gc_seq: GC sequence number to detect races with GC802 * @gc_seq: GC sequence number to detect races with GC
802 * @cnt: number of data nodes for bulk read803 * @cnt: number of data nodes for bulk read
803 * @blk_cnt: number of data blocks including holes804 * @blk_cnt: number of data blocks including holes
804 * @oef: end of file reached805 * @eof: end of file reached
805 */806 */
806struct bu_info {807struct bu_info {
807 union ubifs_key key;808 union ubifs_key key;
@@ -985,7 +986,7 @@ struct ubifs_budg_info { · 177 unmodified lines
985};986};
986 987
987/**988/**
988 * ubifs_stats_info - per-FS statistics information.989 * struct ubifs_stats_info - per-FS statistics information.
989 * @magic_errors: number of bad magic numbers (will be reset with a new mount).990 * @magic_errors: number of bad magic numbers (will be reset with a new mount).
990 * @node_errors: number of bad nodes (will be reset with a new mount).991 * @node_errors: number of bad nodes (will be reset with a new mount).
991 * @crc_errors: number of bad crcs (will be reset with a new mount).992 * @crc_errors: number of bad crcs (will be reset with a new mount).
@@ -1051,6 +1052,7 @@ struct ubifs_debug_info; · 59 unmodified lines
1051 * @rw_incompat: the media is not R/W compatible1052 * @rw_incompat: the media is not R/W compatible
1052 * @assert_action: action to take when a ubifs_assert() fails1053 * @assert_action: action to take when a ubifs_assert() fails
1053 * @authenticated: flag indigating the FS is mounted in authenticated mode1054 * @authenticated: flag indigating the FS is mounted in authenticated mode
1055 * @superblock_need_write: superblock node needs to be written
1054 *1056 *
1055 * @tnc_mutex: protects the Tree Node Cache (TNC), @zroot, @cnext, @enext, and1057 * @tnc_mutex: protects the Tree Node Cache (TNC), @zroot, @cnext, @enext, and
1056 * @calc_idx_sz1058 * @calc_idx_sz
@@ -1588,8 +1590,9 @@ int ubifs_prepare_auth_node(struct ubifs_info *c, void *node, · 531 unmodified lines
1588 * @expected: first hash1590 * @expected: first hash
1589 * @got: second hash1591 * @got: second hash
1590 *1592 *
1591 * Compare two hashes @expected and @got. Returns 0 when they are equal, a1593 * Compare two hashes @expected and @got.
1592 * negative error code otherwise.1594 *
1595 * Returns: 0 when they are equal, a negative error code otherwise.
1593 */1596 */
1594static inline int ubifs_check_hash(const struct ubifs_info *c,1597static inline int ubifs_check_hash(const struct ubifs_info *c,
1595 const u8 *expected, const u8 *got)1598 const u8 *expected, const u8 *got)
@@ -1603,8 +1606,9 @@ static inline int ubifs_check_hash(const struct ubifs_info *c, · 7 unmodified lines
1603 * @expected: first HMAC1606 * @expected: first HMAC
1604 * @got: second HMAC1607 * @got: second HMAC
1605 *1608 *
1606 * Compare two hashes @expected and @got. Returns 0 when they are equal, a1609 * Compare two hashes @expected and @got.
1607 * negative error code otherwise.1610 *
1611 * Returns: 0 when they are equal, a negative error code otherwise.
1608 */1612 */
1609static inline int ubifs_check_hmac(const struct ubifs_info *c,1613static inline int ubifs_check_hmac(const struct ubifs_info *c,
1610 const u8 *expected, const u8 *got)1614 const u8 *expected, const u8 *got)
@@ -1644,7 +1648,7 @@ static inline void ubifs_exit_authentication(struct ubifs_info *c) · 33 unmodified lines
1644 * @c: UBIFS file-system description object1648 * @c: UBIFS file-system description object
1645 * @br: branch to get the hash from1649 * @br: branch to get the hash from
1646 *1650 *
1647 * This returns a pointer to the hash of a branch. Since the key already is a1651 * Returns: a pointer to the hash of a branch. Since the key already is a
1648 * dynamically sized object we cannot use a struct member here.1652 * dynamically sized object we cannot use a struct member here.
1649 */1653 */
1650static inline u8 *ubifs_branch_hash(struct ubifs_info *c,1654static inline u8 *ubifs_branch_hash(struct ubifs_info *c,
@@ -1694,7 +1698,7 @@ static inline int ubifs_node_verify_hmac(const struct ubifs_info *c, · 43 unmodified lines
1694 * ubifs_auth_node_sz - returns the size of an authentication node1698 * ubifs_auth_node_sz - returns the size of an authentication node
1695 * @c: UBIFS file-system description object1699 * @c: UBIFS file-system description object
1696 *1700 *
1697 * This function returns the size of an authentication node which can1701 * Returns: the size of an authentication node which can
1698 * be 0 for unauthenticated filesystems or the real size of an auth node1702 * be 0 for unauthenticated filesystems or the real size of an auth node
1699 * authentication is enabled.1703 * authentication is enabled.
1700 */1704 */
include/uapi/mtd/ubi-user.h+9−1
@@ -289,6 +289,13 @@ enum { · 288 unmodified lines
289 * If @disable_fm is not zero, ubi doesn't create new fastmap even the module289 * If @disable_fm is not zero, ubi doesn't create new fastmap even the module
290 * param 'fm_autoconvert' is set, and existed old fastmap will be destroyed290 * param 'fm_autoconvert' is set, and existed old fastmap will be destroyed
291 * after doing full scanning.291 * after doing full scanning.
292 *
293 * The @wl_threshold defines the maximum difference between the highest and the
294 * lowest erase counter value of eraseblocks of this UBI device. When this
295 * threshold is exceeded, UBI starts performing wear leveling by means of
296 * moving data from eraseblock with low erase counter to eraseblocks with high
297 * erase counter. If @wl_threshold is zero, the default kernel value of
298 * %CONFIG_MTD_UBI_WL_THRESHOLD is used. The accepted range is 2-65536.
292 */299 */
293struct ubi_attach_req {300struct ubi_attach_req {
294 __s32 ubi_num;301 __s32 ubi_num;
@@ -297,7 +304,8 @@ struct ubi_attach_req { · 2 unmodified lines
297 __s16 max_beb_per1024;304 __s16 max_beb_per1024;
298 __s8 disable_fm;305 __s8 disable_fm;
299 __s8 need_resv_pool;306 __s8 need_resv_pool;
300 __s8 padding[8];307 __s32 wl_threshold;
308 __s8 padding[4];
301};309};
302 310
303/*311/*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t