diff options
-rw-r--r-- | drivers/mtd/ubi/cdev.c | 8 | ||||
-rw-r--r-- | drivers/mtd/ubi/eba.c | 20 | ||||
-rw-r--r-- | drivers/mtd/ubi/gluebi.c | 2 | ||||
-rw-r--r-- | drivers/mtd/ubi/kapi.c | 30 | ||||
-rw-r--r-- | drivers/mtd/ubi/ubi.h | 12 | ||||
-rw-r--r-- | drivers/mtd/ubi/upd.c | 12 | ||||
-rw-r--r-- | drivers/mtd/ubi/vtbl.c | 4 | ||||
-rw-r--r-- | drivers/mtd/ubi/wl.c | 50 | ||||
-rw-r--r-- | fs/ubifs/debug.c | 12 | ||||
-rw-r--r-- | fs/ubifs/debug.h | 7 | ||||
-rw-r--r-- | fs/ubifs/gc.c | 2 | ||||
-rw-r--r-- | fs/ubifs/io.c | 42 | ||||
-rw-r--r-- | fs/ubifs/journal.c | 2 | ||||
-rw-r--r-- | fs/ubifs/log.c | 10 | ||||
-rw-r--r-- | fs/ubifs/lpt.c | 13 | ||||
-rw-r--r-- | fs/ubifs/lpt_commit.c | 10 | ||||
-rw-r--r-- | fs/ubifs/master.c | 4 | ||||
-rw-r--r-- | fs/ubifs/orphan.c | 5 | ||||
-rw-r--r-- | fs/ubifs/recovery.c | 13 | ||||
-rw-r--r-- | fs/ubifs/replay.c | 3 | ||||
-rw-r--r-- | fs/ubifs/sb.c | 22 | ||||
-rw-r--r-- | fs/ubifs/super.c | 2 | ||||
-rw-r--r-- | fs/ubifs/tnc_commit.c | 6 | ||||
-rw-r--r-- | fs/ubifs/ubifs.h | 15 | ||||
-rw-r--r-- | include/linux/mtd/ubi.h | 27 |
25 files changed, 108 insertions, 225 deletions
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c index ad76592fb2f4..f4061126926b 100644 --- a/drivers/mtd/ubi/cdev.c +++ b/drivers/mtd/ubi/cdev.c | |||
@@ -334,8 +334,7 @@ static ssize_t vol_cdev_direct_write(struct file *file, const char __user *buf, | |||
334 | break; | 334 | break; |
335 | } | 335 | } |
336 | 336 | ||
337 | err = ubi_eba_write_leb(ubi, vol, lnum, tbuf, off, len, | 337 | err = ubi_eba_write_leb(ubi, vol, lnum, tbuf, off, len); |
338 | UBI_UNKNOWN); | ||
339 | if (err) | 338 | if (err) |
340 | break; | 339 | break; |
341 | 340 | ||
@@ -477,9 +476,6 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd, | |||
477 | if (req.lnum < 0 || req.lnum >= vol->reserved_pebs || | 476 | if (req.lnum < 0 || req.lnum >= vol->reserved_pebs || |
478 | req.bytes < 0 || req.lnum >= vol->usable_leb_size) | 477 | req.bytes < 0 || req.lnum >= vol->usable_leb_size) |
479 | break; | 478 | break; |
480 | if (req.dtype != UBI_LONGTERM && req.dtype != UBI_SHORTTERM && | ||
481 | req.dtype != UBI_UNKNOWN) | ||
482 | break; | ||
483 | 479 | ||
484 | err = get_exclusive(desc); | 480 | err = get_exclusive(desc); |
485 | if (err < 0) | 481 | if (err < 0) |
@@ -532,7 +528,7 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd, | |||
532 | err = -EFAULT; | 528 | err = -EFAULT; |
533 | break; | 529 | break; |
534 | } | 530 | } |
535 | err = ubi_leb_map(desc, req.lnum, req.dtype); | 531 | err = ubi_leb_map(desc, req.lnum); |
536 | break; | 532 | break; |
537 | } | 533 | } |
538 | 534 | ||
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c index 2455d620d96b..bd5fdbf7cb41 100644 --- a/drivers/mtd/ubi/eba.c +++ b/drivers/mtd/ubi/eba.c | |||
@@ -507,7 +507,7 @@ static int recover_peb(struct ubi_device *ubi, int pnum, int vol_id, int lnum, | |||
507 | return -ENOMEM; | 507 | return -ENOMEM; |
508 | 508 | ||
509 | retry: | 509 | retry: |
510 | new_pnum = ubi_wl_get_peb(ubi, UBI_UNKNOWN); | 510 | new_pnum = ubi_wl_get_peb(ubi); |
511 | if (new_pnum < 0) { | 511 | if (new_pnum < 0) { |
512 | ubi_free_vid_hdr(ubi, vid_hdr); | 512 | ubi_free_vid_hdr(ubi, vid_hdr); |
513 | return new_pnum; | 513 | return new_pnum; |
@@ -585,7 +585,6 @@ write_error: | |||
585 | * @buf: the data to write | 585 | * @buf: the data to write |
586 | * @offset: offset within the logical eraseblock where to write | 586 | * @offset: offset within the logical eraseblock where to write |
587 | * @len: how many bytes to write | 587 | * @len: how many bytes to write |
588 | * @dtype: data type | ||
589 | * | 588 | * |
590 | * This function writes data to logical eraseblock @lnum of a dynamic volume | 589 | * This function writes data to logical eraseblock @lnum of a dynamic volume |
591 | * @vol. Returns zero in case of success and a negative error code in case | 590 | * @vol. Returns zero in case of success and a negative error code in case |
@@ -593,7 +592,7 @@ write_error: | |||
593 | * written to the flash media, but may be some garbage. | 592 | * written to the flash media, but may be some garbage. |
594 | */ | 593 | */ |
595 | int ubi_eba_write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, | 594 | int ubi_eba_write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, |
596 | const void *buf, int offset, int len, int dtype) | 595 | const void *buf, int offset, int len) |
597 | { | 596 | { |
598 | int err, pnum, tries = 0, vol_id = vol->vol_id; | 597 | int err, pnum, tries = 0, vol_id = vol->vol_id; |
599 | struct ubi_vid_hdr *vid_hdr; | 598 | struct ubi_vid_hdr *vid_hdr; |
@@ -641,7 +640,7 @@ int ubi_eba_write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, | |||
641 | vid_hdr->data_pad = cpu_to_be32(vol->data_pad); | 640 | vid_hdr->data_pad = cpu_to_be32(vol->data_pad); |
642 | 641 | ||
643 | retry: | 642 | retry: |
644 | pnum = ubi_wl_get_peb(ubi, dtype); | 643 | pnum = ubi_wl_get_peb(ubi); |
645 | if (pnum < 0) { | 644 | if (pnum < 0) { |
646 | ubi_free_vid_hdr(ubi, vid_hdr); | 645 | ubi_free_vid_hdr(ubi, vid_hdr); |
647 | leb_write_unlock(ubi, vol_id, lnum); | 646 | leb_write_unlock(ubi, vol_id, lnum); |
@@ -707,7 +706,6 @@ write_error: | |||
707 | * @lnum: logical eraseblock number | 706 | * @lnum: logical eraseblock number |
708 | * @buf: data to write | 707 | * @buf: data to write |
709 | * @len: how many bytes to write | 708 | * @len: how many bytes to write |
710 | * @dtype: data type | ||
711 | * @used_ebs: how many logical eraseblocks will this volume contain | 709 | * @used_ebs: how many logical eraseblocks will this volume contain |
712 | * | 710 | * |
713 | * This function writes data to logical eraseblock @lnum of static volume | 711 | * This function writes data to logical eraseblock @lnum of static volume |
@@ -724,8 +722,7 @@ write_error: | |||
724 | * code in case of failure. | 722 | * code in case of failure. |
725 | */ | 723 | */ |
726 | int ubi_eba_write_leb_st(struct ubi_device *ubi, struct ubi_volume *vol, | 724 | int ubi_eba_write_leb_st(struct ubi_device *ubi, struct ubi_volume *vol, |
727 | int lnum, const void *buf, int len, int dtype, | 725 | int lnum, const void *buf, int len, int used_ebs) |
728 | int used_ebs) | ||
729 | { | 726 | { |
730 | int err, pnum, tries = 0, data_size = len, vol_id = vol->vol_id; | 727 | int err, pnum, tries = 0, data_size = len, vol_id = vol->vol_id; |
731 | struct ubi_vid_hdr *vid_hdr; | 728 | struct ubi_vid_hdr *vid_hdr; |
@@ -763,7 +760,7 @@ int ubi_eba_write_leb_st(struct ubi_device *ubi, struct ubi_volume *vol, | |||
763 | vid_hdr->data_crc = cpu_to_be32(crc); | 760 | vid_hdr->data_crc = cpu_to_be32(crc); |
764 | 761 | ||
765 | retry: | 762 | retry: |
766 | pnum = ubi_wl_get_peb(ubi, dtype); | 763 | pnum = ubi_wl_get_peb(ubi); |
767 | if (pnum < 0) { | 764 | if (pnum < 0) { |
768 | ubi_free_vid_hdr(ubi, vid_hdr); | 765 | ubi_free_vid_hdr(ubi, vid_hdr); |
769 | leb_write_unlock(ubi, vol_id, lnum); | 766 | leb_write_unlock(ubi, vol_id, lnum); |
@@ -827,7 +824,6 @@ write_error: | |||
827 | * @lnum: logical eraseblock number | 824 | * @lnum: logical eraseblock number |
828 | * @buf: data to write | 825 | * @buf: data to write |
829 | * @len: how many bytes to write | 826 | * @len: how many bytes to write |
830 | * @dtype: data type | ||
831 | * | 827 | * |
832 | * This function changes the contents of a logical eraseblock atomically. @buf | 828 | * This function changes the contents of a logical eraseblock atomically. @buf |
833 | * has to contain new logical eraseblock data, and @len - the length of the | 829 | * has to contain new logical eraseblock data, and @len - the length of the |
@@ -839,7 +835,7 @@ write_error: | |||
839 | * LEB change may be done at a time. This is ensured by @ubi->alc_mutex. | 835 | * LEB change may be done at a time. This is ensured by @ubi->alc_mutex. |
840 | */ | 836 | */ |
841 | int ubi_eba_atomic_leb_change(struct ubi_device *ubi, struct ubi_volume *vol, | 837 | int ubi_eba_atomic_leb_change(struct ubi_device *ubi, struct ubi_volume *vol, |
842 | int lnum, const void *buf, int len, int dtype) | 838 | int lnum, const void *buf, int len) |
843 | { | 839 | { |
844 | int err, pnum, tries = 0, vol_id = vol->vol_id; | 840 | int err, pnum, tries = 0, vol_id = vol->vol_id; |
845 | struct ubi_vid_hdr *vid_hdr; | 841 | struct ubi_vid_hdr *vid_hdr; |
@@ -856,7 +852,7 @@ int ubi_eba_atomic_leb_change(struct ubi_device *ubi, struct ubi_volume *vol, | |||
856 | err = ubi_eba_unmap_leb(ubi, vol, lnum); | 852 | err = ubi_eba_unmap_leb(ubi, vol, lnum); |
857 | if (err) | 853 | if (err) |
858 | return err; | 854 | return err; |
859 | return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0, dtype); | 855 | return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0); |
860 | } | 856 | } |
861 | 857 | ||
862 | vid_hdr = ubi_zalloc_vid_hdr(ubi, GFP_NOFS); | 858 | vid_hdr = ubi_zalloc_vid_hdr(ubi, GFP_NOFS); |
@@ -881,7 +877,7 @@ int ubi_eba_atomic_leb_change(struct ubi_device *ubi, struct ubi_volume *vol, | |||
881 | vid_hdr->data_crc = cpu_to_be32(crc); | 877 | vid_hdr->data_crc = cpu_to_be32(crc); |
882 | 878 | ||
883 | retry: | 879 | retry: |
884 | pnum = ubi_wl_get_peb(ubi, dtype); | 880 | pnum = ubi_wl_get_peb(ubi); |
885 | if (pnum < 0) { | 881 | if (pnum < 0) { |
886 | err = pnum; | 882 | err = pnum; |
887 | goto out_leb_unlock; | 883 | goto out_leb_unlock; |
diff --git a/drivers/mtd/ubi/gluebi.c b/drivers/mtd/ubi/gluebi.c index 90b98822d9a4..4e44bee4c564 100644 --- a/drivers/mtd/ubi/gluebi.c +++ b/drivers/mtd/ubi/gluebi.c | |||
@@ -227,7 +227,7 @@ static int gluebi_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
227 | if (to_write > total_written) | 227 | if (to_write > total_written) |
228 | to_write = total_written; | 228 | to_write = total_written; |
229 | 229 | ||
230 | err = ubi_write(gluebi->desc, lnum, buf, offs, to_write); | 230 | err = ubi_leb_write(gluebi->desc, lnum, buf, offs, to_write); |
231 | if (err) | 231 | if (err) |
232 | break; | 232 | break; |
233 | 233 | ||
diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c index 9fdb35367fe0..33ede23769db 100644 --- a/drivers/mtd/ubi/kapi.c +++ b/drivers/mtd/ubi/kapi.c | |||
@@ -426,11 +426,9 @@ EXPORT_SYMBOL_GPL(ubi_leb_read); | |||
426 | * @buf: data to write | 426 | * @buf: data to write |
427 | * @offset: offset within the logical eraseblock where to write | 427 | * @offset: offset within the logical eraseblock where to write |
428 | * @len: how many bytes to write | 428 | * @len: how many bytes to write |
429 | * @dtype: expected data type | ||
430 | * | 429 | * |
431 | * This function writes @len bytes of data from @buf to offset @offset of | 430 | * This function writes @len bytes of data from @buf to offset @offset of |
432 | * logical eraseblock @lnum. The @dtype argument describes expected lifetime of | 431 | * logical eraseblock @lnum. |
433 | * the data. | ||
434 | * | 432 | * |
435 | * This function takes care of physical eraseblock write failures. If write to | 433 | * This function takes care of physical eraseblock write failures. If write to |
436 | * the physical eraseblock write operation fails, the logical eraseblock is | 434 | * the physical eraseblock write operation fails, the logical eraseblock is |
@@ -447,7 +445,7 @@ EXPORT_SYMBOL_GPL(ubi_leb_read); | |||
447 | * returns immediately with %-EBADF code. | 445 | * returns immediately with %-EBADF code. |
448 | */ | 446 | */ |
449 | int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf, | 447 | int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf, |
450 | int offset, int len, int dtype) | 448 | int offset, int len) |
451 | { | 449 | { |
452 | struct ubi_volume *vol = desc->vol; | 450 | struct ubi_volume *vol = desc->vol; |
453 | struct ubi_device *ubi = vol->ubi; | 451 | struct ubi_device *ubi = vol->ubi; |
@@ -466,17 +464,13 @@ int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf, | |||
466 | offset & (ubi->min_io_size - 1) || len & (ubi->min_io_size - 1)) | 464 | offset & (ubi->min_io_size - 1) || len & (ubi->min_io_size - 1)) |
467 | return -EINVAL; | 465 | return -EINVAL; |
468 | 466 | ||
469 | if (dtype != UBI_LONGTERM && dtype != UBI_SHORTTERM && | ||
470 | dtype != UBI_UNKNOWN) | ||
471 | return -EINVAL; | ||
472 | |||
473 | if (vol->upd_marker) | 467 | if (vol->upd_marker) |
474 | return -EBADF; | 468 | return -EBADF; |
475 | 469 | ||
476 | if (len == 0) | 470 | if (len == 0) |
477 | return 0; | 471 | return 0; |
478 | 472 | ||
479 | return ubi_eba_write_leb(ubi, vol, lnum, buf, offset, len, dtype); | 473 | return ubi_eba_write_leb(ubi, vol, lnum, buf, offset, len); |
480 | } | 474 | } |
481 | EXPORT_SYMBOL_GPL(ubi_leb_write); | 475 | EXPORT_SYMBOL_GPL(ubi_leb_write); |
482 | 476 | ||
@@ -486,7 +480,6 @@ EXPORT_SYMBOL_GPL(ubi_leb_write); | |||
486 | * @lnum: logical eraseblock number to change | 480 | * @lnum: logical eraseblock number to change |
487 | * @buf: data to write | 481 | * @buf: data to write |
488 | * @len: how many bytes to write | 482 | * @len: how many bytes to write |
489 | * @dtype: expected data type | ||
490 | * | 483 | * |
491 | * This function changes the contents of a logical eraseblock atomically. @buf | 484 | * This function changes the contents of a logical eraseblock atomically. @buf |
492 | * has to contain new logical eraseblock data, and @len - the length of the | 485 | * has to contain new logical eraseblock data, and @len - the length of the |
@@ -497,7 +490,7 @@ EXPORT_SYMBOL_GPL(ubi_leb_write); | |||
497 | * code in case of failure. | 490 | * code in case of failure. |
498 | */ | 491 | */ |
499 | int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf, | 492 | int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf, |
500 | int len, int dtype) | 493 | int len) |
501 | { | 494 | { |
502 | struct ubi_volume *vol = desc->vol; | 495 | struct ubi_volume *vol = desc->vol; |
503 | struct ubi_device *ubi = vol->ubi; | 496 | struct ubi_device *ubi = vol->ubi; |
@@ -515,17 +508,13 @@ int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf, | |||
515 | len > vol->usable_leb_size || len & (ubi->min_io_size - 1)) | 508 | len > vol->usable_leb_size || len & (ubi->min_io_size - 1)) |
516 | return -EINVAL; | 509 | return -EINVAL; |
517 | 510 | ||
518 | if (dtype != UBI_LONGTERM && dtype != UBI_SHORTTERM && | ||
519 | dtype != UBI_UNKNOWN) | ||
520 | return -EINVAL; | ||
521 | |||
522 | if (vol->upd_marker) | 511 | if (vol->upd_marker) |
523 | return -EBADF; | 512 | return -EBADF; |
524 | 513 | ||
525 | if (len == 0) | 514 | if (len == 0) |
526 | return 0; | 515 | return 0; |
527 | 516 | ||
528 | return ubi_eba_atomic_leb_change(ubi, vol, lnum, buf, len, dtype); | 517 | return ubi_eba_atomic_leb_change(ubi, vol, lnum, buf, len); |
529 | } | 518 | } |
530 | EXPORT_SYMBOL_GPL(ubi_leb_change); | 519 | EXPORT_SYMBOL_GPL(ubi_leb_change); |
531 | 520 | ||
@@ -626,7 +615,6 @@ EXPORT_SYMBOL_GPL(ubi_leb_unmap); | |||
626 | * ubi_leb_map - map logical eraseblock to a physical eraseblock. | 615 | * ubi_leb_map - map logical eraseblock to a physical eraseblock. |
627 | * @desc: volume descriptor | 616 | * @desc: volume descriptor |
628 | * @lnum: logical eraseblock number | 617 | * @lnum: logical eraseblock number |
629 | * @dtype: expected data type | ||
630 | * | 618 | * |
631 | * This function maps an un-mapped logical eraseblock @lnum to a physical | 619 | * This function maps an un-mapped logical eraseblock @lnum to a physical |
632 | * eraseblock. This means, that after a successful invocation of this | 620 | * eraseblock. This means, that after a successful invocation of this |
@@ -639,7 +627,7 @@ EXPORT_SYMBOL_GPL(ubi_leb_unmap); | |||
639 | * eraseblock is already mapped, and other negative error codes in case of | 627 | * eraseblock is already mapped, and other negative error codes in case of |
640 | * other failures. | 628 | * other failures. |
641 | */ | 629 | */ |
642 | int ubi_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype) | 630 | int ubi_leb_map(struct ubi_volume_desc *desc, int lnum) |
643 | { | 631 | { |
644 | struct ubi_volume *vol = desc->vol; | 632 | struct ubi_volume *vol = desc->vol; |
645 | struct ubi_device *ubi = vol->ubi; | 633 | struct ubi_device *ubi = vol->ubi; |
@@ -652,17 +640,13 @@ int ubi_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype) | |||
652 | if (lnum < 0 || lnum >= vol->reserved_pebs) | 640 | if (lnum < 0 || lnum >= vol->reserved_pebs) |
653 | return -EINVAL; | 641 | return -EINVAL; |
654 | 642 | ||
655 | if (dtype != UBI_LONGTERM && dtype != UBI_SHORTTERM && | ||
656 | dtype != UBI_UNKNOWN) | ||
657 | return -EINVAL; | ||
658 | |||
659 | if (vol->upd_marker) | 643 | if (vol->upd_marker) |
660 | return -EBADF; | 644 | return -EBADF; |
661 | 645 | ||
662 | if (vol->eba_tbl[lnum] >= 0) | 646 | if (vol->eba_tbl[lnum] >= 0) |
663 | return -EBADMSG; | 647 | return -EBADMSG; |
664 | 648 | ||
665 | return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0, dtype); | 649 | return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0); |
666 | } | 650 | } |
667 | EXPORT_SYMBOL_GPL(ubi_leb_map); | 651 | EXPORT_SYMBOL_GPL(ubi_leb_map); |
668 | 652 | ||
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index 4f5c9f136519..75b9f1c61b78 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h | |||
@@ -222,8 +222,6 @@ struct ubi_volume_desc; | |||
222 | * @upd_ebs: how many eraseblocks are expected to be updated | 222 | * @upd_ebs: how many eraseblocks are expected to be updated |
223 | * @ch_lnum: LEB number which is being changing by the atomic LEB change | 223 | * @ch_lnum: LEB number which is being changing by the atomic LEB change |
224 | * operation | 224 | * operation |
225 | * @ch_dtype: data persistency type which is being changing by the atomic LEB | ||
226 | * change operation | ||
227 | * @upd_bytes: how many bytes are expected to be received for volume update or | 225 | * @upd_bytes: how many bytes are expected to be received for volume update or |
228 | * atomic LEB change | 226 | * atomic LEB change |
229 | * @upd_received: how many bytes were already received for volume update or | 227 | * @upd_received: how many bytes were already received for volume update or |
@@ -270,7 +268,6 @@ struct ubi_volume { | |||
270 | 268 | ||
271 | int upd_ebs; | 269 | int upd_ebs; |
272 | int ch_lnum; | 270 | int ch_lnum; |
273 | int ch_dtype; | ||
274 | long long upd_bytes; | 271 | long long upd_bytes; |
275 | long long upd_received; | 272 | long long upd_received; |
276 | void *upd_buf; | 273 | void *upd_buf; |
@@ -525,18 +522,17 @@ int ubi_eba_unmap_leb(struct ubi_device *ubi, struct ubi_volume *vol, | |||
525 | int ubi_eba_read_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, | 522 | int ubi_eba_read_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, |
526 | void *buf, int offset, int len, int check); | 523 | void *buf, int offset, int len, int check); |
527 | int ubi_eba_write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, | 524 | int ubi_eba_write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, |
528 | const void *buf, int offset, int len, int dtype); | 525 | const void *buf, int offset, int len); |
529 | int ubi_eba_write_leb_st(struct ubi_device *ubi, struct ubi_volume *vol, | 526 | int ubi_eba_write_leb_st(struct ubi_device *ubi, struct ubi_volume *vol, |
530 | int lnum, const void *buf, int len, int dtype, | 527 | int lnum, const void *buf, int len, int used_ebs); |
531 | int used_ebs); | ||
532 | int ubi_eba_atomic_leb_change(struct ubi_device *ubi, struct ubi_volume *vol, | 528 | int ubi_eba_atomic_leb_change(struct ubi_device *ubi, struct ubi_volume *vol, |
533 | int lnum, const void *buf, int len, int dtype); | 529 | int lnum, const void *buf, int len); |
534 | int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to, | 530 | int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to, |
535 | struct ubi_vid_hdr *vid_hdr); | 531 | struct ubi_vid_hdr *vid_hdr); |
536 | int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_scan_info *si); | 532 | int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_scan_info *si); |
537 | 533 | ||
538 | /* wl.c */ | 534 | /* wl.c */ |
539 | int ubi_wl_get_peb(struct ubi_device *ubi, int dtype); | 535 | int ubi_wl_get_peb(struct ubi_device *ubi); |
540 | int ubi_wl_put_peb(struct ubi_device *ubi, int pnum, int torture); | 536 | int ubi_wl_put_peb(struct ubi_device *ubi, int pnum, int torture); |
541 | int ubi_wl_flush(struct ubi_device *ubi); | 537 | int ubi_wl_flush(struct ubi_device *ubi); |
542 | int ubi_wl_scrub_peb(struct ubi_device *ubi, int pnum); | 538 | int ubi_wl_scrub_peb(struct ubi_device *ubi, int pnum); |
diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c index 425bf5a3edd4..11a28f9ce0db 100644 --- a/drivers/mtd/ubi/upd.c +++ b/drivers/mtd/ubi/upd.c | |||
@@ -186,14 +186,12 @@ int ubi_start_leb_change(struct ubi_device *ubi, struct ubi_volume *vol, | |||
186 | dbg_gen("start changing LEB %d:%d, %u bytes", | 186 | dbg_gen("start changing LEB %d:%d, %u bytes", |
187 | vol->vol_id, req->lnum, req->bytes); | 187 | vol->vol_id, req->lnum, req->bytes); |
188 | if (req->bytes == 0) | 188 | if (req->bytes == 0) |
189 | return ubi_eba_atomic_leb_change(ubi, vol, req->lnum, NULL, 0, | 189 | return ubi_eba_atomic_leb_change(ubi, vol, req->lnum, NULL, 0); |
190 | req->dtype); | ||
191 | 190 | ||
192 | vol->upd_bytes = req->bytes; | 191 | vol->upd_bytes = req->bytes; |
193 | vol->upd_received = 0; | 192 | vol->upd_received = 0; |
194 | vol->changing_leb = 1; | 193 | vol->changing_leb = 1; |
195 | vol->ch_lnum = req->lnum; | 194 | vol->ch_lnum = req->lnum; |
196 | vol->ch_dtype = req->dtype; | ||
197 | 195 | ||
198 | vol->upd_buf = vmalloc(req->bytes); | 196 | vol->upd_buf = vmalloc(req->bytes); |
199 | if (!vol->upd_buf) | 197 | if (!vol->upd_buf) |
@@ -246,8 +244,7 @@ static int write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, | |||
246 | return 0; | 244 | return 0; |
247 | } | 245 | } |
248 | 246 | ||
249 | err = ubi_eba_write_leb(ubi, vol, lnum, buf, 0, len, | 247 | err = ubi_eba_write_leb(ubi, vol, lnum, buf, 0, len); |
250 | UBI_UNKNOWN); | ||
251 | } else { | 248 | } else { |
252 | /* | 249 | /* |
253 | * When writing static volume, and this is the last logical | 250 | * When writing static volume, and this is the last logical |
@@ -259,8 +256,7 @@ static int write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, | |||
259 | * contain zeros, not random trash. | 256 | * contain zeros, not random trash. |
260 | */ | 257 | */ |
261 | memset(buf + len, 0, vol->usable_leb_size - len); | 258 | memset(buf + len, 0, vol->usable_leb_size - len); |
262 | err = ubi_eba_write_leb_st(ubi, vol, lnum, buf, len, | 259 | err = ubi_eba_write_leb_st(ubi, vol, lnum, buf, len, used_ebs); |
263 | UBI_UNKNOWN, used_ebs); | ||
264 | } | 260 | } |
265 | 261 | ||
266 | return err; | 262 | return err; |
@@ -421,7 +417,7 @@ int ubi_more_leb_change_data(struct ubi_device *ubi, struct ubi_volume *vol, | |||
421 | len - vol->upd_bytes); | 417 | len - vol->upd_bytes); |
422 | len = ubi_calc_data_len(ubi, vol->upd_buf, len); | 418 | len = ubi_calc_data_len(ubi, vol->upd_buf, len); |
423 | err = ubi_eba_atomic_leb_change(ubi, vol, vol->ch_lnum, | 419 | err = ubi_eba_atomic_leb_change(ubi, vol, vol->ch_lnum, |
424 | vol->upd_buf, len, UBI_UNKNOWN); | 420 | vol->upd_buf, len); |
425 | if (err) | 421 | if (err) |
426 | return err; | 422 | return err; |
427 | } | 423 | } |
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c index 17cec0c01544..a6f4b13d8417 100644 --- a/drivers/mtd/ubi/vtbl.c +++ b/drivers/mtd/ubi/vtbl.c | |||
@@ -106,7 +106,7 @@ int ubi_change_vtbl_record(struct ubi_device *ubi, int idx, | |||
106 | return err; | 106 | return err; |
107 | 107 | ||
108 | err = ubi_eba_write_leb(ubi, layout_vol, i, ubi->vtbl, 0, | 108 | err = ubi_eba_write_leb(ubi, layout_vol, i, ubi->vtbl, 0, |
109 | ubi->vtbl_size, UBI_LONGTERM); | 109 | ubi->vtbl_size); |
110 | if (err) | 110 | if (err) |
111 | return err; | 111 | return err; |
112 | } | 112 | } |
@@ -158,7 +158,7 @@ int ubi_vtbl_rename_volumes(struct ubi_device *ubi, | |||
158 | return err; | 158 | return err; |
159 | 159 | ||
160 | err = ubi_eba_write_leb(ubi, layout_vol, i, ubi->vtbl, 0, | 160 | err = ubi_eba_write_leb(ubi, layout_vol, i, ubi->vtbl, 0, |
161 | ubi->vtbl_size, UBI_LONGTERM); | 161 | ubi->vtbl_size); |
162 | if (err) | 162 | if (err) |
163 | return err; | 163 | return err; |
164 | } | 164 | } |
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index b0a6d53ef047..f0bc10743bc0 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c | |||
@@ -383,19 +383,15 @@ static struct ubi_wl_entry *find_wl_entry(struct rb_root *root, int diff) | |||
383 | /** | 383 | /** |
384 | * ubi_wl_get_peb - get a physical eraseblock. | 384 | * ubi_wl_get_peb - get a physical eraseblock. |
385 | * @ubi: UBI device description object | 385 | * @ubi: UBI device description object |
386 | * @dtype: type of data which will be stored in this physical eraseblock | ||
387 | * | 386 | * |
388 | * This function returns a physical eraseblock in case of success and a | 387 | * This function returns a physical eraseblock in case of success and a |
389 | * negative error code in case of failure. Might sleep. | 388 | * negative error code in case of failure. Might sleep. |
390 | */ | 389 | */ |
391 | int ubi_wl_get_peb(struct ubi_device *ubi, int dtype) | 390 | int ubi_wl_get_peb(struct ubi_device *ubi) |
392 | { | 391 | { |
393 | int err; | 392 | int err; |
394 | struct ubi_wl_entry *e, *first, *last; | 393 | struct ubi_wl_entry *e, *first, *last; |
395 | 394 | ||
396 | ubi_assert(dtype == UBI_LONGTERM || dtype == UBI_SHORTTERM || | ||
397 | dtype == UBI_UNKNOWN); | ||
398 | |||
399 | retry: | 395 | retry: |
400 | spin_lock(&ubi->wl_lock); | 396 | spin_lock(&ubi->wl_lock); |
401 | if (!ubi->free.rb_node) { | 397 | if (!ubi->free.rb_node) { |
@@ -413,43 +409,13 @@ retry: | |||
413 | goto retry; | 409 | goto retry; |
414 | } | 410 | } |
415 | 411 | ||
416 | switch (dtype) { | 412 | first = rb_entry(rb_first(&ubi->free), struct ubi_wl_entry, u.rb); |
417 | case UBI_LONGTERM: | 413 | last = rb_entry(rb_last(&ubi->free), struct ubi_wl_entry, u.rb); |
418 | /* | 414 | |
419 | * For long term data we pick a physical eraseblock with high | 415 | if (last->ec - first->ec < WL_FREE_MAX_DIFF) |
420 | * erase counter. But the highest erase counter we can pick is | 416 | e = rb_entry(ubi->free.rb_node, struct ubi_wl_entry, u.rb); |
421 | * bounded by the the lowest erase counter plus | 417 | else |
422 | * %WL_FREE_MAX_DIFF. | 418 | e = find_wl_entry(&ubi->free, WL_FREE_MAX_DIFF/2); |
423 | */ | ||
424 | e = find_wl_entry(&ubi->free, WL_FREE_MAX_DIFF); | ||
425 | break; | ||
426 | case UBI_UNKNOWN: | ||
427 | /* | ||
428 | * For unknown data we pick a physical eraseblock with medium | ||
429 | * erase counter. But we by no means can pick a physical | ||
430 | * eraseblock with erase counter greater or equivalent than the | ||
431 | * lowest erase counter plus %WL_FREE_MAX_DIFF/2. | ||
432 | */ | ||
433 | first = rb_entry(rb_first(&ubi->free), struct ubi_wl_entry, | ||
434 | u.rb); | ||
435 | last = rb_entry(rb_last(&ubi->free), struct ubi_wl_entry, u.rb); | ||
436 | |||
437 | if (last->ec - first->ec < WL_FREE_MAX_DIFF) | ||
438 | e = rb_entry(ubi->free.rb_node, | ||
439 | struct ubi_wl_entry, u.rb); | ||
440 | else | ||
441 | e = find_wl_entry(&ubi->free, WL_FREE_MAX_DIFF/2); | ||
442 | break; | ||
443 | case UBI_SHORTTERM: | ||
444 | /* | ||
445 | * For short term data we pick a physical eraseblock with the | ||
446 | * lowest erase counter as we expect it will be erased soon. | ||
447 | */ | ||
448 | e = rb_entry(rb_first(&ubi->free), struct ubi_wl_entry, u.rb); | ||
449 | break; | ||
450 | default: | ||
451 | BUG(); | ||
452 | } | ||
453 | 419 | ||
454 | paranoid_check_in_wl_tree(ubi, e, &ubi->free); | 420 | paranoid_check_in_wl_tree(ubi, e, &ubi->free); |
455 | 421 | ||
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index df83d7b495fc..685a83756b2b 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c | |||
@@ -2676,7 +2676,7 @@ static void cut_data(const void *buf, unsigned int len) | |||
2676 | } | 2676 | } |
2677 | 2677 | ||
2678 | int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, | 2678 | int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, |
2679 | int offs, int len, int dtype) | 2679 | int offs, int len) |
2680 | { | 2680 | { |
2681 | int err, failing; | 2681 | int err, failing; |
2682 | 2682 | ||
@@ -2686,7 +2686,7 @@ int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, | |||
2686 | failing = power_cut_emulated(c, lnum, 1); | 2686 | failing = power_cut_emulated(c, lnum, 1); |
2687 | if (failing) | 2687 | if (failing) |
2688 | cut_data(buf, len); | 2688 | cut_data(buf, len); |
2689 | err = ubi_leb_write(c->ubi, lnum, buf, offs, len, dtype); | 2689 | err = ubi_leb_write(c->ubi, lnum, buf, offs, len); |
2690 | if (err) | 2690 | if (err) |
2691 | return err; | 2691 | return err; |
2692 | if (failing) | 2692 | if (failing) |
@@ -2695,7 +2695,7 @@ int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, | |||
2695 | } | 2695 | } |
2696 | 2696 | ||
2697 | int dbg_leb_change(struct ubifs_info *c, int lnum, const void *buf, | 2697 | int dbg_leb_change(struct ubifs_info *c, int lnum, const void *buf, |
2698 | int len, int dtype) | 2698 | int len) |
2699 | { | 2699 | { |
2700 | int err; | 2700 | int err; |
2701 | 2701 | ||
@@ -2703,7 +2703,7 @@ int dbg_leb_change(struct ubifs_info *c, int lnum, const void *buf, | |||
2703 | return -EROFS; | 2703 | return -EROFS; |
2704 | if (power_cut_emulated(c, lnum, 1)) | 2704 | if (power_cut_emulated(c, lnum, 1)) |
2705 | return -EROFS; | 2705 | return -EROFS; |
2706 | err = ubi_leb_change(c->ubi, lnum, buf, len, dtype); | 2706 | err = ubi_leb_change(c->ubi, lnum, buf, len); |
2707 | if (err) | 2707 | if (err) |
2708 | return err; | 2708 | return err; |
2709 | if (power_cut_emulated(c, lnum, 1)) | 2709 | if (power_cut_emulated(c, lnum, 1)) |
@@ -2727,7 +2727,7 @@ int dbg_leb_unmap(struct ubifs_info *c, int lnum) | |||
2727 | return 0; | 2727 | return 0; |
2728 | } | 2728 | } |
2729 | 2729 | ||
2730 | int dbg_leb_map(struct ubifs_info *c, int lnum, int dtype) | 2730 | int dbg_leb_map(struct ubifs_info *c, int lnum) |
2731 | { | 2731 | { |
2732 | int err; | 2732 | int err; |
2733 | 2733 | ||
@@ -2735,7 +2735,7 @@ int dbg_leb_map(struct ubifs_info *c, int lnum, int dtype) | |||
2735 | return -EROFS; | 2735 | return -EROFS; |
2736 | if (power_cut_emulated(c, lnum, 0)) | 2736 | if (power_cut_emulated(c, lnum, 0)) |
2737 | return -EROFS; | 2737 | return -EROFS; |
2738 | err = ubi_leb_map(c->ubi, lnum, dtype); | 2738 | err = ubi_leb_map(c->ubi, lnum); |
2739 | if (err) | 2739 | if (err) |
2740 | return err; | 2740 | return err; |
2741 | if (power_cut_emulated(c, lnum, 0)) | 2741 | if (power_cut_emulated(c, lnum, 0)) |
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h index 6b3a9e2ee19c..486a8e024fb6 100644 --- a/fs/ubifs/debug.h +++ b/fs/ubifs/debug.h | |||
@@ -299,11 +299,10 @@ int dbg_check_data_nodes_order(struct ubifs_info *c, struct list_head *head); | |||
299 | int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head); | 299 | int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head); |
300 | 300 | ||
301 | int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, | 301 | int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, |
302 | int len, int dtype); | 302 | int len); |
303 | int dbg_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len, | 303 | int dbg_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len); |
304 | int dtype); | ||
305 | int dbg_leb_unmap(struct ubifs_info *c, int lnum); | 304 | int dbg_leb_unmap(struct ubifs_info *c, int lnum); |
306 | int dbg_leb_map(struct ubifs_info *c, int lnum, int dtype); | 305 | int dbg_leb_map(struct ubifs_info *c, int lnum); |
307 | 306 | ||
308 | /* Debugfs-related stuff */ | 307 | /* Debugfs-related stuff */ |
309 | int dbg_debugfs_init(void); | 308 | int dbg_debugfs_init(void); |
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c index ded29f6224c2..04dd6f47635e 100644 --- a/fs/ubifs/gc.c +++ b/fs/ubifs/gc.c | |||
@@ -109,7 +109,7 @@ static int switch_gc_head(struct ubifs_info *c) | |||
109 | return err; | 109 | return err; |
110 | 110 | ||
111 | c->gc_lnum = -1; | 111 | c->gc_lnum = -1; |
112 | err = ubifs_wbuf_seek_nolock(wbuf, gc_lnum, 0, UBI_LONGTERM); | 112 | err = ubifs_wbuf_seek_nolock(wbuf, gc_lnum, 0); |
113 | return err; | 113 | return err; |
114 | } | 114 | } |
115 | 115 | ||
diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c index 21f0835d78c9..e18b9889a51b 100644 --- a/fs/ubifs/io.c +++ b/fs/ubifs/io.c | |||
@@ -115,7 +115,7 @@ int ubifs_leb_read(const struct ubifs_info *c, int lnum, void *buf, int offs, | |||
115 | } | 115 | } |
116 | 116 | ||
117 | int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, | 117 | int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, |
118 | int len, int dtype) | 118 | int len) |
119 | { | 119 | { |
120 | int err; | 120 | int err; |
121 | 121 | ||
@@ -123,9 +123,9 @@ int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, | |||
123 | if (c->ro_error) | 123 | if (c->ro_error) |
124 | return -EROFS; | 124 | return -EROFS; |
125 | if (!dbg_is_tst_rcvry(c)) | 125 | if (!dbg_is_tst_rcvry(c)) |
126 | err = ubi_leb_write(c->ubi, lnum, buf, offs, len, dtype); | 126 | err = ubi_leb_write(c->ubi, lnum, buf, offs, len); |
127 | else | 127 | else |
128 | err = dbg_leb_write(c, lnum, buf, offs, len, dtype); | 128 | err = dbg_leb_write(c, lnum, buf, offs, len); |
129 | if (err) { | 129 | if (err) { |
130 | ubifs_err("writing %d bytes to LEB %d:%d failed, error %d", | 130 | ubifs_err("writing %d bytes to LEB %d:%d failed, error %d", |
131 | len, lnum, offs, err); | 131 | len, lnum, offs, err); |
@@ -135,8 +135,7 @@ int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, | |||
135 | return err; | 135 | return err; |
136 | } | 136 | } |
137 | 137 | ||
138 | int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len, | 138 | int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len) |
139 | int dtype) | ||
140 | { | 139 | { |
141 | int err; | 140 | int err; |
142 | 141 | ||
@@ -144,9 +143,9 @@ int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len, | |||
144 | if (c->ro_error) | 143 | if (c->ro_error) |
145 | return -EROFS; | 144 | return -EROFS; |
146 | if (!dbg_is_tst_rcvry(c)) | 145 | if (!dbg_is_tst_rcvry(c)) |
147 | err = ubi_leb_change(c->ubi, lnum, buf, len, dtype); | 146 | err = ubi_leb_change(c->ubi, lnum, buf, len); |
148 | else | 147 | else |
149 | err = dbg_leb_change(c, lnum, buf, len, dtype); | 148 | err = dbg_leb_change(c, lnum, buf, len); |
150 | if (err) { | 149 | if (err) { |
151 | ubifs_err("changing %d bytes in LEB %d failed, error %d", | 150 | ubifs_err("changing %d bytes in LEB %d failed, error %d", |
152 | len, lnum, err); | 151 | len, lnum, err); |
@@ -175,7 +174,7 @@ int ubifs_leb_unmap(struct ubifs_info *c, int lnum) | |||
175 | return err; | 174 | return err; |
176 | } | 175 | } |
177 | 176 | ||
178 | int ubifs_leb_map(struct ubifs_info *c, int lnum, int dtype) | 177 | int ubifs_leb_map(struct ubifs_info *c, int lnum) |
179 | { | 178 | { |
180 | int err; | 179 | int err; |
181 | 180 | ||
@@ -183,9 +182,9 @@ int ubifs_leb_map(struct ubifs_info *c, int lnum, int dtype) | |||
183 | if (c->ro_error) | 182 | if (c->ro_error) |
184 | return -EROFS; | 183 | return -EROFS; |
185 | if (!dbg_is_tst_rcvry(c)) | 184 | if (!dbg_is_tst_rcvry(c)) |
186 | err = ubi_leb_map(c->ubi, lnum, dtype); | 185 | err = ubi_leb_map(c->ubi, lnum); |
187 | else | 186 | else |
188 | err = dbg_leb_map(c, lnum, dtype); | 187 | err = dbg_leb_map(c, lnum); |
189 | if (err) { | 188 | if (err) { |
190 | ubifs_err("mapping LEB %d failed, error %d", lnum, err); | 189 | ubifs_err("mapping LEB %d failed, error %d", lnum, err); |
191 | ubifs_ro_mode(c, err); | 190 | ubifs_ro_mode(c, err); |
@@ -523,8 +522,7 @@ int ubifs_wbuf_sync_nolock(struct ubifs_wbuf *wbuf) | |||
523 | dirt = sync_len - wbuf->used; | 522 | dirt = sync_len - wbuf->used; |
524 | if (dirt) | 523 | if (dirt) |
525 | ubifs_pad(c, wbuf->buf + wbuf->used, dirt); | 524 | ubifs_pad(c, wbuf->buf + wbuf->used, dirt); |
526 | err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, wbuf->offs, sync_len, | 525 | err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, wbuf->offs, sync_len); |
527 | wbuf->dtype); | ||
528 | if (err) | 526 | if (err) |
529 | return err; | 527 | return err; |
530 | 528 | ||
@@ -562,14 +560,12 @@ int ubifs_wbuf_sync_nolock(struct ubifs_wbuf *wbuf) | |||
562 | * @wbuf: write-buffer | 560 | * @wbuf: write-buffer |
563 | * @lnum: logical eraseblock number to seek to | 561 | * @lnum: logical eraseblock number to seek to |
564 | * @offs: logical eraseblock offset to seek to | 562 | * @offs: logical eraseblock offset to seek to |
565 | * @dtype: data type | ||
566 | * | 563 | * |
567 | * This function targets the write-buffer to logical eraseblock @lnum:@offs. | 564 | * This function targets the write-buffer to logical eraseblock @lnum:@offs. |
568 | * The write-buffer has to be empty. Returns zero in case of success and a | 565 | * The write-buffer has to be empty. Returns zero in case of success and a |
569 | * negative error code in case of failure. | 566 | * negative error code in case of failure. |
570 | */ | 567 | */ |
571 | int ubifs_wbuf_seek_nolock(struct ubifs_wbuf *wbuf, int lnum, int offs, | 568 | int ubifs_wbuf_seek_nolock(struct ubifs_wbuf *wbuf, int lnum, int offs) |
572 | int dtype) | ||
573 | { | 569 | { |
574 | const struct ubifs_info *c = wbuf->c; | 570 | const struct ubifs_info *c = wbuf->c; |
575 | 571 | ||
@@ -592,7 +588,6 @@ int ubifs_wbuf_seek_nolock(struct ubifs_wbuf *wbuf, int lnum, int offs, | |||
592 | wbuf->avail = wbuf->size; | 588 | wbuf->avail = wbuf->size; |
593 | wbuf->used = 0; | 589 | wbuf->used = 0; |
594 | spin_unlock(&wbuf->lock); | 590 | spin_unlock(&wbuf->lock); |
595 | wbuf->dtype = dtype; | ||
596 | 591 | ||
597 | return 0; | 592 | return 0; |
598 | } | 593 | } |
@@ -719,8 +714,7 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len) | |||
719 | dbg_io("flush jhead %s wbuf to LEB %d:%d", | 714 | dbg_io("flush jhead %s wbuf to LEB %d:%d", |
720 | dbg_jhead(wbuf->jhead), wbuf->lnum, wbuf->offs); | 715 | dbg_jhead(wbuf->jhead), wbuf->lnum, wbuf->offs); |
721 | err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, | 716 | err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, |
722 | wbuf->offs, wbuf->size, | 717 | wbuf->offs, wbuf->size); |
723 | wbuf->dtype); | ||
724 | if (err) | 718 | if (err) |
725 | goto out; | 719 | goto out; |
726 | 720 | ||
@@ -756,7 +750,7 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len) | |||
756 | dbg_jhead(wbuf->jhead), wbuf->lnum, wbuf->offs); | 750 | dbg_jhead(wbuf->jhead), wbuf->lnum, wbuf->offs); |
757 | memcpy(wbuf->buf + wbuf->used, buf, wbuf->avail); | 751 | memcpy(wbuf->buf + wbuf->used, buf, wbuf->avail); |
758 | err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, wbuf->offs, | 752 | err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, wbuf->offs, |
759 | wbuf->size, wbuf->dtype); | 753 | wbuf->size); |
760 | if (err) | 754 | if (err) |
761 | goto out; | 755 | goto out; |
762 | 756 | ||
@@ -775,7 +769,7 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len) | |||
775 | dbg_io("write %d bytes to LEB %d:%d", | 769 | dbg_io("write %d bytes to LEB %d:%d", |
776 | wbuf->size, wbuf->lnum, wbuf->offs); | 770 | wbuf->size, wbuf->lnum, wbuf->offs); |
777 | err = ubifs_leb_write(c, wbuf->lnum, buf, wbuf->offs, | 771 | err = ubifs_leb_write(c, wbuf->lnum, buf, wbuf->offs, |
778 | wbuf->size, wbuf->dtype); | 772 | wbuf->size); |
779 | if (err) | 773 | if (err) |
780 | goto out; | 774 | goto out; |
781 | 775 | ||
@@ -797,7 +791,7 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len) | |||
797 | dbg_io("write %d bytes to LEB %d:%d", n, wbuf->lnum, | 791 | dbg_io("write %d bytes to LEB %d:%d", n, wbuf->lnum, |
798 | wbuf->offs); | 792 | wbuf->offs); |
799 | err = ubifs_leb_write(c, wbuf->lnum, buf + written, | 793 | err = ubifs_leb_write(c, wbuf->lnum, buf + written, |
800 | wbuf->offs, n, wbuf->dtype); | 794 | wbuf->offs, n); |
801 | if (err) | 795 | if (err) |
802 | goto out; | 796 | goto out; |
803 | wbuf->offs += n; | 797 | wbuf->offs += n; |
@@ -854,7 +848,6 @@ out: | |||
854 | * @len: node length | 848 | * @len: node length |
855 | * @lnum: logical eraseblock number | 849 | * @lnum: logical eraseblock number |
856 | * @offs: offset within the logical eraseblock | 850 | * @offs: offset within the logical eraseblock |
857 | * @dtype: node life-time hint (%UBI_LONGTERM, %UBI_SHORTTERM, %UBI_UNKNOWN) | ||
858 | * | 851 | * |
859 | * This function automatically fills node magic number, assigns sequence | 852 | * This function automatically fills node magic number, assigns sequence |
860 | * number, and calculates node CRC checksum. The length of the @buf buffer has | 853 | * number, and calculates node CRC checksum. The length of the @buf buffer has |
@@ -863,7 +856,7 @@ out: | |||
863 | * success and a negative error code in case of failure. | 856 | * success and a negative error code in case of failure. |
864 | */ | 857 | */ |
865 | int ubifs_write_node(struct ubifs_info *c, void *buf, int len, int lnum, | 858 | int ubifs_write_node(struct ubifs_info *c, void *buf, int len, int lnum, |
866 | int offs, int dtype) | 859 | int offs) |
867 | { | 860 | { |
868 | int err, buf_len = ALIGN(len, c->min_io_size); | 861 | int err, buf_len = ALIGN(len, c->min_io_size); |
869 | 862 | ||
@@ -879,7 +872,7 @@ int ubifs_write_node(struct ubifs_info *c, void *buf, int len, int lnum, | |||
879 | return -EROFS; | 872 | return -EROFS; |
880 | 873 | ||
881 | ubifs_prepare_node(c, buf, len, 1); | 874 | ubifs_prepare_node(c, buf, len, 1); |
882 | err = ubifs_leb_write(c, lnum, buf, offs, buf_len, dtype); | 875 | err = ubifs_leb_write(c, lnum, buf, offs, buf_len); |
883 | if (err) | 876 | if (err) |
884 | ubifs_dump_node(c, buf); | 877 | ubifs_dump_node(c, buf); |
885 | 878 | ||
@@ -1056,7 +1049,6 @@ int ubifs_wbuf_init(struct ubifs_info *c, struct ubifs_wbuf *wbuf) | |||
1056 | */ | 1049 | */ |
1057 | size = c->max_write_size - (c->leb_start % c->max_write_size); | 1050 | size = c->max_write_size - (c->leb_start % c->max_write_size); |
1058 | wbuf->avail = wbuf->size = size; | 1051 | wbuf->avail = wbuf->size = size; |
1059 | wbuf->dtype = UBI_UNKNOWN; | ||
1060 | wbuf->sync_callback = NULL; | 1052 | wbuf->sync_callback = NULL; |
1061 | mutex_init(&wbuf->io_mutex); | 1053 | mutex_init(&wbuf->io_mutex); |
1062 | spin_lock_init(&wbuf->lock); | 1054 | spin_lock_init(&wbuf->lock); |
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c index 61cd8535ffd6..12c0f154ca83 100644 --- a/fs/ubifs/journal.c +++ b/fs/ubifs/journal.c | |||
@@ -214,7 +214,7 @@ out: | |||
214 | err = ubifs_add_bud_to_log(c, jhead, lnum, offs); | 214 | err = ubifs_add_bud_to_log(c, jhead, lnum, offs); |
215 | if (err) | 215 | if (err) |
216 | goto out_return; | 216 | goto out_return; |
217 | err = ubifs_wbuf_seek_nolock(wbuf, lnum, offs, wbuf->dtype); | 217 | err = ubifs_wbuf_seek_nolock(wbuf, lnum, offs); |
218 | if (err) | 218 | if (err) |
219 | goto out_unlock; | 219 | goto out_unlock; |
220 | 220 | ||
diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c index 9967b5a21f41..c80b15d6c8de 100644 --- a/fs/ubifs/log.c +++ b/fs/ubifs/log.c | |||
@@ -258,7 +258,7 @@ int ubifs_add_bud_to_log(struct ubifs_info *c, int jhead, int lnum, int offs) | |||
258 | * an unclean reboot, because the target LEB might have been | 258 | * an unclean reboot, because the target LEB might have been |
259 | * unmapped, but not yet physically erased. | 259 | * unmapped, but not yet physically erased. |
260 | */ | 260 | */ |
261 | err = ubifs_leb_map(c, bud->lnum, UBI_SHORTTERM); | 261 | err = ubifs_leb_map(c, bud->lnum); |
262 | if (err) | 262 | if (err) |
263 | goto out_unlock; | 263 | goto out_unlock; |
264 | } | 264 | } |
@@ -266,7 +266,7 @@ int ubifs_add_bud_to_log(struct ubifs_info *c, int jhead, int lnum, int offs) | |||
266 | dbg_log("write ref LEB %d:%d", | 266 | dbg_log("write ref LEB %d:%d", |
267 | c->lhead_lnum, c->lhead_offs); | 267 | c->lhead_lnum, c->lhead_offs); |
268 | err = ubifs_write_node(c, ref, UBIFS_REF_NODE_SZ, c->lhead_lnum, | 268 | err = ubifs_write_node(c, ref, UBIFS_REF_NODE_SZ, c->lhead_lnum, |
269 | c->lhead_offs, UBI_SHORTTERM); | 269 | c->lhead_offs); |
270 | if (err) | 270 | if (err) |
271 | goto out_unlock; | 271 | goto out_unlock; |
272 | 272 | ||
@@ -418,7 +418,7 @@ int ubifs_log_start_commit(struct ubifs_info *c, int *ltail_lnum) | |||
418 | 418 | ||
419 | len = ALIGN(len, c->min_io_size); | 419 | len = ALIGN(len, c->min_io_size); |
420 | dbg_log("writing commit start at LEB %d:0, len %d", c->lhead_lnum, len); | 420 | dbg_log("writing commit start at LEB %d:0, len %d", c->lhead_lnum, len); |
421 | err = ubifs_leb_write(c, c->lhead_lnum, cs, 0, len, UBI_SHORTTERM); | 421 | err = ubifs_leb_write(c, c->lhead_lnum, cs, 0, len); |
422 | if (err) | 422 | if (err) |
423 | goto out; | 423 | goto out; |
424 | 424 | ||
@@ -619,7 +619,7 @@ static int add_node(struct ubifs_info *c, void *buf, int *lnum, int *offs, | |||
619 | int sz = ALIGN(*offs, c->min_io_size), err; | 619 | int sz = ALIGN(*offs, c->min_io_size), err; |
620 | 620 | ||
621 | ubifs_pad(c, buf + *offs, sz - *offs); | 621 | ubifs_pad(c, buf + *offs, sz - *offs); |
622 | err = ubifs_leb_change(c, *lnum, buf, sz, UBI_SHORTTERM); | 622 | err = ubifs_leb_change(c, *lnum, buf, sz); |
623 | if (err) | 623 | if (err) |
624 | return err; | 624 | return err; |
625 | *lnum = ubifs_next_log_lnum(c, *lnum); | 625 | *lnum = ubifs_next_log_lnum(c, *lnum); |
@@ -698,7 +698,7 @@ int ubifs_consolidate_log(struct ubifs_info *c) | |||
698 | int sz = ALIGN(offs, c->min_io_size); | 698 | int sz = ALIGN(offs, c->min_io_size); |
699 | 699 | ||
700 | ubifs_pad(c, buf + offs, sz - offs); | 700 | ubifs_pad(c, buf + offs, sz - offs); |
701 | err = ubifs_leb_change(c, write_lnum, buf, sz, UBI_SHORTTERM); | 701 | err = ubifs_leb_change(c, write_lnum, buf, sz); |
702 | if (err) | 702 | if (err) |
703 | goto out_free; | 703 | goto out_free; |
704 | offs = ALIGN(offs, c->min_io_size); | 704 | offs = ALIGN(offs, c->min_io_size); |
diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c index b4280c44949c..ce33b2beb151 100644 --- a/fs/ubifs/lpt.c +++ b/fs/ubifs/lpt.c | |||
@@ -701,8 +701,7 @@ int ubifs_create_dflt_lpt(struct ubifs_info *c, int *main_lebs, int lpt_first, | |||
701 | alen = ALIGN(len, c->min_io_size); | 701 | alen = ALIGN(len, c->min_io_size); |
702 | set_ltab(c, lnum, c->leb_size - alen, alen - len); | 702 | set_ltab(c, lnum, c->leb_size - alen, alen - len); |
703 | memset(p, 0xff, alen - len); | 703 | memset(p, 0xff, alen - len); |
704 | err = ubifs_leb_change(c, lnum++, buf, alen, | 704 | err = ubifs_leb_change(c, lnum++, buf, alen); |
705 | UBI_SHORTTERM); | ||
706 | if (err) | 705 | if (err) |
707 | goto out; | 706 | goto out; |
708 | p = buf; | 707 | p = buf; |
@@ -732,8 +731,7 @@ int ubifs_create_dflt_lpt(struct ubifs_info *c, int *main_lebs, int lpt_first, | |||
732 | set_ltab(c, lnum, c->leb_size - alen, | 731 | set_ltab(c, lnum, c->leb_size - alen, |
733 | alen - len); | 732 | alen - len); |
734 | memset(p, 0xff, alen - len); | 733 | memset(p, 0xff, alen - len); |
735 | err = ubifs_leb_change(c, lnum++, buf, alen, | 734 | err = ubifs_leb_change(c, lnum++, buf, alen); |
736 | UBI_SHORTTERM); | ||
737 | if (err) | 735 | if (err) |
738 | goto out; | 736 | goto out; |
739 | p = buf; | 737 | p = buf; |
@@ -780,8 +778,7 @@ int ubifs_create_dflt_lpt(struct ubifs_info *c, int *main_lebs, int lpt_first, | |||
780 | alen = ALIGN(len, c->min_io_size); | 778 | alen = ALIGN(len, c->min_io_size); |
781 | set_ltab(c, lnum, c->leb_size - alen, alen - len); | 779 | set_ltab(c, lnum, c->leb_size - alen, alen - len); |
782 | memset(p, 0xff, alen - len); | 780 | memset(p, 0xff, alen - len); |
783 | err = ubifs_leb_change(c, lnum++, buf, alen, | 781 | err = ubifs_leb_change(c, lnum++, buf, alen); |
784 | UBI_SHORTTERM); | ||
785 | if (err) | 782 | if (err) |
786 | goto out; | 783 | goto out; |
787 | p = buf; | 784 | p = buf; |
@@ -806,7 +803,7 @@ int ubifs_create_dflt_lpt(struct ubifs_info *c, int *main_lebs, int lpt_first, | |||
806 | alen = ALIGN(len, c->min_io_size); | 803 | alen = ALIGN(len, c->min_io_size); |
807 | set_ltab(c, lnum, c->leb_size - alen, alen - len); | 804 | set_ltab(c, lnum, c->leb_size - alen, alen - len); |
808 | memset(p, 0xff, alen - len); | 805 | memset(p, 0xff, alen - len); |
809 | err = ubifs_leb_change(c, lnum++, buf, alen, UBI_SHORTTERM); | 806 | err = ubifs_leb_change(c, lnum++, buf, alen); |
810 | if (err) | 807 | if (err) |
811 | goto out; | 808 | goto out; |
812 | p = buf; | 809 | p = buf; |
@@ -826,7 +823,7 @@ int ubifs_create_dflt_lpt(struct ubifs_info *c, int *main_lebs, int lpt_first, | |||
826 | 823 | ||
827 | /* Write remaining buffer */ | 824 | /* Write remaining buffer */ |
828 | memset(p, 0xff, alen - len); | 825 | memset(p, 0xff, alen - len); |
829 | err = ubifs_leb_change(c, lnum, buf, alen, UBI_SHORTTERM); | 826 | err = ubifs_leb_change(c, lnum, buf, alen); |
830 | if (err) | 827 | if (err) |
831 | goto out; | 828 | goto out; |
832 | 829 | ||
diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c index 862c4ca98b85..4fa70734e6e7 100644 --- a/fs/ubifs/lpt_commit.c +++ b/fs/ubifs/lpt_commit.c | |||
@@ -416,7 +416,7 @@ static int write_cnodes(struct ubifs_info *c) | |||
416 | alen = ALIGN(wlen, c->min_io_size); | 416 | alen = ALIGN(wlen, c->min_io_size); |
417 | memset(buf + offs, 0xff, alen - wlen); | 417 | memset(buf + offs, 0xff, alen - wlen); |
418 | err = ubifs_leb_write(c, lnum, buf + from, from, | 418 | err = ubifs_leb_write(c, lnum, buf + from, from, |
419 | alen, UBI_SHORTTERM); | 419 | alen); |
420 | if (err) | 420 | if (err) |
421 | return err; | 421 | return err; |
422 | } | 422 | } |
@@ -474,8 +474,7 @@ static int write_cnodes(struct ubifs_info *c) | |||
474 | wlen = offs - from; | 474 | wlen = offs - from; |
475 | alen = ALIGN(wlen, c->min_io_size); | 475 | alen = ALIGN(wlen, c->min_io_size); |
476 | memset(buf + offs, 0xff, alen - wlen); | 476 | memset(buf + offs, 0xff, alen - wlen); |
477 | err = ubifs_leb_write(c, lnum, buf + from, from, alen, | 477 | err = ubifs_leb_write(c, lnum, buf + from, from, alen); |
478 | UBI_SHORTTERM); | ||
479 | if (err) | 478 | if (err) |
480 | return err; | 479 | return err; |
481 | dbg_chk_lpt_sz(c, 2, c->leb_size - offs); | 480 | dbg_chk_lpt_sz(c, 2, c->leb_size - offs); |
@@ -501,8 +500,7 @@ static int write_cnodes(struct ubifs_info *c) | |||
501 | wlen = offs - from; | 500 | wlen = offs - from; |
502 | alen = ALIGN(wlen, c->min_io_size); | 501 | alen = ALIGN(wlen, c->min_io_size); |
503 | memset(buf + offs, 0xff, alen - wlen); | 502 | memset(buf + offs, 0xff, alen - wlen); |
504 | err = ubifs_leb_write(c, lnum, buf + from, from, alen, | 503 | err = ubifs_leb_write(c, lnum, buf + from, from, alen); |
505 | UBI_SHORTTERM); | ||
506 | if (err) | 504 | if (err) |
507 | return err; | 505 | return err; |
508 | dbg_chk_lpt_sz(c, 2, c->leb_size - offs); | 506 | dbg_chk_lpt_sz(c, 2, c->leb_size - offs); |
@@ -526,7 +524,7 @@ static int write_cnodes(struct ubifs_info *c) | |||
526 | wlen = offs - from; | 524 | wlen = offs - from; |
527 | alen = ALIGN(wlen, c->min_io_size); | 525 | alen = ALIGN(wlen, c->min_io_size); |
528 | memset(buf + offs, 0xff, alen - wlen); | 526 | memset(buf + offs, 0xff, alen - wlen); |
529 | err = ubifs_leb_write(c, lnum, buf + from, from, alen, UBI_SHORTTERM); | 527 | err = ubifs_leb_write(c, lnum, buf + from, from, alen); |
530 | if (err) | 528 | if (err) |
531 | return err; | 529 | return err; |
532 | 530 | ||
diff --git a/fs/ubifs/master.c b/fs/ubifs/master.c index 9fc282984f94..ab83ace9910a 100644 --- a/fs/ubifs/master.c +++ b/fs/ubifs/master.c | |||
@@ -379,7 +379,7 @@ int ubifs_write_master(struct ubifs_info *c) | |||
379 | c->mst_offs = offs; | 379 | c->mst_offs = offs; |
380 | c->mst_node->highest_inum = cpu_to_le64(c->highest_inum); | 380 | c->mst_node->highest_inum = cpu_to_le64(c->highest_inum); |
381 | 381 | ||
382 | err = ubifs_write_node(c, c->mst_node, len, lnum, offs, UBI_SHORTTERM); | 382 | err = ubifs_write_node(c, c->mst_node, len, lnum, offs); |
383 | if (err) | 383 | if (err) |
384 | return err; | 384 | return err; |
385 | 385 | ||
@@ -390,7 +390,7 @@ int ubifs_write_master(struct ubifs_info *c) | |||
390 | if (err) | 390 | if (err) |
391 | return err; | 391 | return err; |
392 | } | 392 | } |
393 | err = ubifs_write_node(c, c->mst_node, len, lnum, offs, UBI_SHORTTERM); | 393 | err = ubifs_write_node(c, c->mst_node, len, lnum, offs); |
394 | 394 | ||
395 | return err; | 395 | return err; |
396 | } | 396 | } |
diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c index 95155cc18084..b02734db187c 100644 --- a/fs/ubifs/orphan.c +++ b/fs/ubifs/orphan.c | |||
@@ -244,8 +244,7 @@ static int do_write_orph_node(struct ubifs_info *c, int len, int atomic) | |||
244 | ubifs_assert(c->ohead_offs == 0); | 244 | ubifs_assert(c->ohead_offs == 0); |
245 | ubifs_prepare_node(c, c->orph_buf, len, 1); | 245 | ubifs_prepare_node(c, c->orph_buf, len, 1); |
246 | len = ALIGN(len, c->min_io_size); | 246 | len = ALIGN(len, c->min_io_size); |
247 | err = ubifs_leb_change(c, c->ohead_lnum, c->orph_buf, len, | 247 | err = ubifs_leb_change(c, c->ohead_lnum, c->orph_buf, len); |
248 | UBI_SHORTTERM); | ||
249 | } else { | 248 | } else { |
250 | if (c->ohead_offs == 0) { | 249 | if (c->ohead_offs == 0) { |
251 | /* Ensure LEB has been unmapped */ | 250 | /* Ensure LEB has been unmapped */ |
@@ -254,7 +253,7 @@ static int do_write_orph_node(struct ubifs_info *c, int len, int atomic) | |||
254 | return err; | 253 | return err; |
255 | } | 254 | } |
256 | err = ubifs_write_node(c, c->orph_buf, len, c->ohead_lnum, | 255 | err = ubifs_write_node(c, c->orph_buf, len, c->ohead_lnum, |
257 | c->ohead_offs, UBI_SHORTTERM); | 256 | c->ohead_offs); |
258 | } | 257 | } |
259 | return err; | 258 | return err; |
260 | } | 259 | } |
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index 01a348dd4587..c30d976b4be8 100644 --- a/fs/ubifs/recovery.c +++ b/fs/ubifs/recovery.c | |||
@@ -213,10 +213,10 @@ static int write_rcvrd_mst_node(struct ubifs_info *c, | |||
213 | mst->flags |= cpu_to_le32(UBIFS_MST_RCVRY); | 213 | mst->flags |= cpu_to_le32(UBIFS_MST_RCVRY); |
214 | 214 | ||
215 | ubifs_prepare_node(c, mst, UBIFS_MST_NODE_SZ, 1); | 215 | ubifs_prepare_node(c, mst, UBIFS_MST_NODE_SZ, 1); |
216 | err = ubifs_leb_change(c, lnum, mst, sz, UBI_SHORTTERM); | 216 | err = ubifs_leb_change(c, lnum, mst, sz); |
217 | if (err) | 217 | if (err) |
218 | goto out; | 218 | goto out; |
219 | err = ubifs_leb_change(c, lnum + 1, mst, sz, UBI_SHORTTERM); | 219 | err = ubifs_leb_change(c, lnum + 1, mst, sz); |
220 | if (err) | 220 | if (err) |
221 | goto out; | 221 | goto out; |
222 | out: | 222 | out: |
@@ -555,8 +555,7 @@ static int fix_unclean_leb(struct ubifs_info *c, struct ubifs_scan_leb *sleb, | |||
555 | ubifs_pad(c, buf, pad_len); | 555 | ubifs_pad(c, buf, pad_len); |
556 | } | 556 | } |
557 | } | 557 | } |
558 | err = ubifs_leb_change(c, lnum, sleb->buf, len, | 558 | err = ubifs_leb_change(c, lnum, sleb->buf, len); |
559 | UBI_UNKNOWN); | ||
560 | if (err) | 559 | if (err) |
561 | return err; | 560 | return err; |
562 | } | 561 | } |
@@ -941,7 +940,7 @@ static int recover_head(struct ubifs_info *c, int lnum, int offs, void *sbuf) | |||
941 | err = ubifs_leb_read(c, lnum, sbuf, 0, offs, 1); | 940 | err = ubifs_leb_read(c, lnum, sbuf, 0, offs, 1); |
942 | if (err) | 941 | if (err) |
943 | return err; | 942 | return err; |
944 | return ubifs_leb_change(c, lnum, sbuf, offs, UBI_UNKNOWN); | 943 | return ubifs_leb_change(c, lnum, sbuf, offs); |
945 | } | 944 | } |
946 | 945 | ||
947 | return 0; | 946 | return 0; |
@@ -1071,7 +1070,7 @@ static int clean_an_unclean_leb(struct ubifs_info *c, | |||
1071 | } | 1070 | } |
1072 | 1071 | ||
1073 | /* Write back the LEB atomically */ | 1072 | /* Write back the LEB atomically */ |
1074 | err = ubifs_leb_change(c, lnum, sbuf, len, UBI_UNKNOWN); | 1073 | err = ubifs_leb_change(c, lnum, sbuf, len); |
1075 | if (err) | 1074 | if (err) |
1076 | return err; | 1075 | return err; |
1077 | 1076 | ||
@@ -1472,7 +1471,7 @@ static int fix_size_in_place(struct ubifs_info *c, struct size_entry *e) | |||
1472 | len -= 1; | 1471 | len -= 1; |
1473 | len = ALIGN(len + 1, c->min_io_size); | 1472 | len = ALIGN(len + 1, c->min_io_size); |
1474 | /* Atomically write the fixed LEB back again */ | 1473 | /* Atomically write the fixed LEB back again */ |
1475 | err = ubifs_leb_change(c, lnum, c->sbuf, len, UBI_UNKNOWN); | 1474 | err = ubifs_leb_change(c, lnum, c->sbuf, len); |
1476 | if (err) | 1475 | if (err) |
1477 | goto out; | 1476 | goto out; |
1478 | dbg_rcvry("inode %lu at %d:%d size %lld -> %lld", | 1477 | dbg_rcvry("inode %lu at %d:%d size %lld -> %lld", |
diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c index 2a2e3ee720fe..3a2da7e476e5 100644 --- a/fs/ubifs/replay.c +++ b/fs/ubifs/replay.c | |||
@@ -154,8 +154,7 @@ static int set_bud_lprops(struct ubifs_info *c, struct bud_entry *b) | |||
154 | 154 | ||
155 | /* Make sure the journal head points to the latest bud */ | 155 | /* Make sure the journal head points to the latest bud */ |
156 | err = ubifs_wbuf_seek_nolock(&c->jheads[b->bud->jhead].wbuf, | 156 | err = ubifs_wbuf_seek_nolock(&c->jheads[b->bud->jhead].wbuf, |
157 | b->bud->lnum, c->leb_size - b->free, | 157 | b->bud->lnum, c->leb_size - b->free); |
158 | UBI_SHORTTERM); | ||
159 | 158 | ||
160 | out: | 159 | out: |
161 | ubifs_release_lprops(c); | 160 | ubifs_release_lprops(c); |
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c index a880d0c152e5..ef3d1ba6d992 100644 --- a/fs/ubifs/sb.c +++ b/fs/ubifs/sb.c | |||
@@ -194,7 +194,7 @@ static int create_default_filesystem(struct ubifs_info *c) | |||
194 | sup->rp_size = cpu_to_le64(tmp64); | 194 | sup->rp_size = cpu_to_le64(tmp64); |
195 | sup->ro_compat_version = cpu_to_le32(UBIFS_RO_COMPAT_VERSION); | 195 | sup->ro_compat_version = cpu_to_le32(UBIFS_RO_COMPAT_VERSION); |
196 | 196 | ||
197 | err = ubifs_write_node(c, sup, UBIFS_SB_NODE_SZ, 0, 0, UBI_LONGTERM); | 197 | err = ubifs_write_node(c, sup, UBIFS_SB_NODE_SZ, 0, 0); |
198 | kfree(sup); | 198 | kfree(sup); |
199 | if (err) | 199 | if (err) |
200 | return err; | 200 | return err; |
@@ -250,14 +250,13 @@ static int create_default_filesystem(struct ubifs_info *c) | |||
250 | 250 | ||
251 | mst->total_used = cpu_to_le64(UBIFS_INO_NODE_SZ); | 251 | mst->total_used = cpu_to_le64(UBIFS_INO_NODE_SZ); |
252 | 252 | ||
253 | err = ubifs_write_node(c, mst, UBIFS_MST_NODE_SZ, UBIFS_MST_LNUM, 0, | 253 | err = ubifs_write_node(c, mst, UBIFS_MST_NODE_SZ, UBIFS_MST_LNUM, 0); |
254 | UBI_UNKNOWN); | ||
255 | if (err) { | 254 | if (err) { |
256 | kfree(mst); | 255 | kfree(mst); |
257 | return err; | 256 | return err; |
258 | } | 257 | } |
259 | err = ubifs_write_node(c, mst, UBIFS_MST_NODE_SZ, UBIFS_MST_LNUM + 1, 0, | 258 | err = ubifs_write_node(c, mst, UBIFS_MST_NODE_SZ, UBIFS_MST_LNUM + 1, |
260 | UBI_UNKNOWN); | 259 | 0); |
261 | kfree(mst); | 260 | kfree(mst); |
262 | if (err) | 261 | if (err) |
263 | return err; | 262 | return err; |
@@ -280,8 +279,7 @@ static int create_default_filesystem(struct ubifs_info *c) | |||
280 | key_write_idx(c, &key, &br->key); | 279 | key_write_idx(c, &key, &br->key); |
281 | br->lnum = cpu_to_le32(main_first + DEFAULT_DATA_LEB); | 280 | br->lnum = cpu_to_le32(main_first + DEFAULT_DATA_LEB); |
282 | br->len = cpu_to_le32(UBIFS_INO_NODE_SZ); | 281 | br->len = cpu_to_le32(UBIFS_INO_NODE_SZ); |
283 | err = ubifs_write_node(c, idx, tmp, main_first + DEFAULT_IDX_LEB, 0, | 282 | err = ubifs_write_node(c, idx, tmp, main_first + DEFAULT_IDX_LEB, 0); |
284 | UBI_UNKNOWN); | ||
285 | kfree(idx); | 283 | kfree(idx); |
286 | if (err) | 284 | if (err) |
287 | return err; | 285 | return err; |
@@ -313,8 +311,7 @@ static int create_default_filesystem(struct ubifs_info *c) | |||
313 | ino->flags = cpu_to_le32(UBIFS_COMPR_FL); | 311 | ino->flags = cpu_to_le32(UBIFS_COMPR_FL); |
314 | 312 | ||
315 | err = ubifs_write_node(c, ino, UBIFS_INO_NODE_SZ, | 313 | err = ubifs_write_node(c, ino, UBIFS_INO_NODE_SZ, |
316 | main_first + DEFAULT_DATA_LEB, 0, | 314 | main_first + DEFAULT_DATA_LEB, 0); |
317 | UBI_UNKNOWN); | ||
318 | kfree(ino); | 315 | kfree(ino); |
319 | if (err) | 316 | if (err) |
320 | return err; | 317 | return err; |
@@ -333,8 +330,7 @@ static int create_default_filesystem(struct ubifs_info *c) | |||
333 | return -ENOMEM; | 330 | return -ENOMEM; |
334 | 331 | ||
335 | cs->ch.node_type = UBIFS_CS_NODE; | 332 | cs->ch.node_type = UBIFS_CS_NODE; |
336 | err = ubifs_write_node(c, cs, UBIFS_CS_NODE_SZ, UBIFS_LOG_LNUM, | 333 | err = ubifs_write_node(c, cs, UBIFS_CS_NODE_SZ, UBIFS_LOG_LNUM, 0); |
337 | 0, UBI_UNKNOWN); | ||
338 | kfree(cs); | 334 | kfree(cs); |
339 | 335 | ||
340 | ubifs_msg("default file-system created"); | 336 | ubifs_msg("default file-system created"); |
@@ -516,7 +512,7 @@ int ubifs_write_sb_node(struct ubifs_info *c, struct ubifs_sb_node *sup) | |||
516 | int len = ALIGN(UBIFS_SB_NODE_SZ, c->min_io_size); | 512 | int len = ALIGN(UBIFS_SB_NODE_SZ, c->min_io_size); |
517 | 513 | ||
518 | ubifs_prepare_node(c, sup, UBIFS_SB_NODE_SZ, 1); | 514 | ubifs_prepare_node(c, sup, UBIFS_SB_NODE_SZ, 1); |
519 | return ubifs_leb_change(c, UBIFS_SB_LNUM, sup, len, UBI_LONGTERM); | 515 | return ubifs_leb_change(c, UBIFS_SB_LNUM, sup, len); |
520 | } | 516 | } |
521 | 517 | ||
522 | /** | 518 | /** |
@@ -689,7 +685,7 @@ static int fixup_leb(struct ubifs_info *c, int lnum, int len) | |||
689 | if (err) | 685 | if (err) |
690 | return err; | 686 | return err; |
691 | 687 | ||
692 | return ubifs_leb_change(c, lnum, c->sbuf, len, UBI_UNKNOWN); | 688 | return ubifs_leb_change(c, lnum, c->sbuf, len); |
693 | } | 689 | } |
694 | 690 | ||
695 | /** | 691 | /** |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 675b781b4699..d7cbf7aabdb7 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -813,13 +813,11 @@ static int alloc_wbufs(struct ubifs_info *c) | |||
813 | c->jheads[i].grouped = 1; | 813 | c->jheads[i].grouped = 1; |
814 | } | 814 | } |
815 | 815 | ||
816 | c->jheads[BASEHD].wbuf.dtype = UBI_SHORTTERM; | ||
817 | /* | 816 | /* |
818 | * Garbage Collector head likely contains long-term data and | 817 | * Garbage Collector head likely contains long-term data and |
819 | * does not need to be synchronized by timer. Also GC head nodes are | 818 | * does not need to be synchronized by timer. Also GC head nodes are |
820 | * not grouped. | 819 | * not grouped. |
821 | */ | 820 | */ |
822 | c->jheads[GCHD].wbuf.dtype = UBI_LONGTERM; | ||
823 | c->jheads[GCHD].wbuf.no_timer = 1; | 821 | c->jheads[GCHD].wbuf.no_timer = 1; |
824 | c->jheads[GCHD].grouped = 0; | 822 | c->jheads[GCHD].grouped = 0; |
825 | 823 | ||
diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c index ef5df1e24dca..523bbad69c0c 100644 --- a/fs/ubifs/tnc_commit.c +++ b/fs/ubifs/tnc_commit.c | |||
@@ -320,8 +320,7 @@ static int layout_leb_in_gaps(struct ubifs_info *c, int *p) | |||
320 | 0, 0, 0); | 320 | 0, 0, 0); |
321 | if (err) | 321 | if (err) |
322 | return err; | 322 | return err; |
323 | err = ubifs_leb_change(c, lnum, c->ileb_buf, c->ileb_len, | 323 | err = ubifs_leb_change(c, lnum, c->ileb_buf, c->ileb_len); |
324 | UBI_SHORTTERM); | ||
325 | if (err) | 324 | if (err) |
326 | return err; | 325 | return err; |
327 | dbg_gc("LEB %d wrote %d index nodes", lnum, tot_written); | 326 | dbg_gc("LEB %d wrote %d index nodes", lnum, tot_written); |
@@ -951,8 +950,7 @@ static int write_index(struct ubifs_info *c) | |||
951 | } | 950 | } |
952 | 951 | ||
953 | /* The buffer is full or there are no more znodes to do */ | 952 | /* The buffer is full or there are no more znodes to do */ |
954 | err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs, blen, | 953 | err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs, blen); |
955 | UBI_SHORTTERM); | ||
956 | if (err) | 954 | if (err) |
957 | return err; | 955 | return err; |
958 | buf_offs += blen; | 956 | buf_offs += blen; |
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index c2cf509e14db..1e5a08623d11 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h | |||
@@ -650,8 +650,6 @@ typedef int (*ubifs_lpt_scan_callback)(struct ubifs_info *c, | |||
650 | * @avail: number of bytes available in the write-buffer | 650 | * @avail: number of bytes available in the write-buffer |
651 | * @used: number of used bytes in the write-buffer | 651 | * @used: number of used bytes in the write-buffer |
652 | * @size: write-buffer size (in [@c->min_io_size, @c->max_write_size] range) | 652 | * @size: write-buffer size (in [@c->min_io_size, @c->max_write_size] range) |
653 | * @dtype: type of data stored in this LEB (%UBI_LONGTERM, %UBI_SHORTTERM, | ||
654 | * %UBI_UNKNOWN) | ||
655 | * @jhead: journal head the mutex belongs to (note, needed only to shut lockdep | 653 | * @jhead: journal head the mutex belongs to (note, needed only to shut lockdep |
656 | * up by 'mutex_lock_nested()). | 654 | * up by 'mutex_lock_nested()). |
657 | * @sync_callback: write-buffer synchronization callback | 655 | * @sync_callback: write-buffer synchronization callback |
@@ -685,7 +683,6 @@ struct ubifs_wbuf { | |||
685 | int avail; | 683 | int avail; |
686 | int used; | 684 | int used; |
687 | int size; | 685 | int size; |
688 | int dtype; | ||
689 | int jhead; | 686 | int jhead; |
690 | int (*sync_callback)(struct ubifs_info *c, int lnum, int free, int pad); | 687 | int (*sync_callback)(struct ubifs_info *c, int lnum, int free, int pad); |
691 | struct mutex io_mutex; | 688 | struct mutex io_mutex; |
@@ -1469,22 +1466,20 @@ void ubifs_ro_mode(struct ubifs_info *c, int err); | |||
1469 | int ubifs_leb_read(const struct ubifs_info *c, int lnum, void *buf, int offs, | 1466 | int ubifs_leb_read(const struct ubifs_info *c, int lnum, void *buf, int offs, |
1470 | int len, int even_ebadmsg); | 1467 | int len, int even_ebadmsg); |
1471 | int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, | 1468 | int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, |
1472 | int len, int dtype); | 1469 | int len); |
1473 | int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len, | 1470 | int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len); |
1474 | int dtype); | ||
1475 | int ubifs_leb_unmap(struct ubifs_info *c, int lnum); | 1471 | int ubifs_leb_unmap(struct ubifs_info *c, int lnum); |
1476 | int ubifs_leb_map(struct ubifs_info *c, int lnum, int dtype); | 1472 | int ubifs_leb_map(struct ubifs_info *c, int lnum); |
1477 | int ubifs_is_mapped(const struct ubifs_info *c, int lnum); | 1473 | int ubifs_is_mapped(const struct ubifs_info *c, int lnum); |
1478 | int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len); | 1474 | int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len); |
1479 | int ubifs_wbuf_seek_nolock(struct ubifs_wbuf *wbuf, int lnum, int offs, | 1475 | int ubifs_wbuf_seek_nolock(struct ubifs_wbuf *wbuf, int lnum, int offs); |
1480 | int dtype); | ||
1481 | int ubifs_wbuf_init(struct ubifs_info *c, struct ubifs_wbuf *wbuf); | 1476 | int ubifs_wbuf_init(struct ubifs_info *c, struct ubifs_wbuf *wbuf); |
1482 | int ubifs_read_node(const struct ubifs_info *c, void *buf, int type, int len, | 1477 | int ubifs_read_node(const struct ubifs_info *c, void *buf, int type, int len, |
1483 | int lnum, int offs); | 1478 | int lnum, int offs); |
1484 | int ubifs_read_node_wbuf(struct ubifs_wbuf *wbuf, void *buf, int type, int len, | 1479 | int ubifs_read_node_wbuf(struct ubifs_wbuf *wbuf, void *buf, int type, int len, |
1485 | int lnum, int offs); | 1480 | int lnum, int offs); |
1486 | int ubifs_write_node(struct ubifs_info *c, void *node, int len, int lnum, | 1481 | int ubifs_write_node(struct ubifs_info *c, void *node, int len, int lnum, |
1487 | int offs, int dtype); | 1482 | int offs); |
1488 | int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum, | 1483 | int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum, |
1489 | int offs, int quiet, int must_chk_crc); | 1484 | int offs, int quiet, int must_chk_crc); |
1490 | void ubifs_prepare_node(struct ubifs_info *c, void *buf, int len, int pad); | 1485 | void ubifs_prepare_node(struct ubifs_info *c, void *buf, int len, int pad); |
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h index db4836bed514..9838dce7e235 100644 --- a/include/linux/mtd/ubi.h +++ b/include/linux/mtd/ubi.h | |||
@@ -208,12 +208,12 @@ void ubi_close_volume(struct ubi_volume_desc *desc); | |||
208 | int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, | 208 | int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, |
209 | int len, int check); | 209 | int len, int check); |
210 | int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf, | 210 | int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf, |
211 | int offset, int len, int dtype); | 211 | int offset, int len); |
212 | int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf, | 212 | int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf, |
213 | int len, int dtype); | 213 | int len); |
214 | int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum); | 214 | int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum); |
215 | int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum); | 215 | int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum); |
216 | int ubi_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype); | 216 | int ubi_leb_map(struct ubi_volume_desc *desc, int lnum); |
217 | int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum); | 217 | int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum); |
218 | int ubi_sync(int ubi_num); | 218 | int ubi_sync(int ubi_num); |
219 | 219 | ||
@@ -226,25 +226,4 @@ static inline int ubi_read(struct ubi_volume_desc *desc, int lnum, char *buf, | |||
226 | { | 226 | { |
227 | return ubi_leb_read(desc, lnum, buf, offset, len, 0); | 227 | return ubi_leb_read(desc, lnum, buf, offset, len, 0); |
228 | } | 228 | } |
229 | |||
230 | /* | ||
231 | * This function is the same as the 'ubi_leb_write()' functions, but it does | ||
232 | * not have the data type argument. | ||
233 | */ | ||
234 | static inline int ubi_write(struct ubi_volume_desc *desc, int lnum, | ||
235 | const void *buf, int offset, int len) | ||
236 | { | ||
237 | return ubi_leb_write(desc, lnum, buf, offset, len, UBI_UNKNOWN); | ||
238 | } | ||
239 | |||
240 | /* | ||
241 | * This function is the same as the 'ubi_leb_change()' functions, but it does | ||
242 | * not have the data type argument. | ||
243 | */ | ||
244 | static inline int ubi_change(struct ubi_volume_desc *desc, int lnum, | ||
245 | const void *buf, int len) | ||
246 | { | ||
247 | return ubi_leb_change(desc, lnum, buf, len, UBI_UNKNOWN); | ||
248 | } | ||
249 | |||
250 | #endif /* !__LINUX_UBI_H__ */ | 229 | #endif /* !__LINUX_UBI_H__ */ |