diff options
author | Richard Weinberger <richard@nod.at> | 2012-09-26 11:51:46 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-10-03 05:29:37 -0400 |
commit | 8974b15c6e84e686201d382c7d459aa9c8c96572 (patch) | |
tree | 64bfa3b4636c23ae9221043cec58e4fc7bbbc6a6 /drivers/mtd | |
parent | 77e6c2f04da6b26445e671458a3677f248c67c43 (diff) |
UBI: Wire-up ->fm_sem
Fastmap uses ->fm_sem to stop EBA changes while writing
a new fastmap.
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/ubi/eba.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c index d56ae1cf65e6..0e11671dadc4 100644 --- a/drivers/mtd/ubi/eba.c +++ b/drivers/mtd/ubi/eba.c | |||
@@ -340,7 +340,9 @@ int ubi_eba_unmap_leb(struct ubi_device *ubi, struct ubi_volume *vol, | |||
340 | 340 | ||
341 | dbg_eba("erase LEB %d:%d, PEB %d", vol_id, lnum, pnum); | 341 | dbg_eba("erase LEB %d:%d, PEB %d", vol_id, lnum, pnum); |
342 | 342 | ||
343 | down_read(&ubi->fm_sem); | ||
343 | vol->eba_tbl[lnum] = UBI_LEB_UNMAPPED; | 344 | vol->eba_tbl[lnum] = UBI_LEB_UNMAPPED; |
345 | up_read(&ubi->fm_sem); | ||
344 | err = ubi_wl_put_peb(ubi, vol_id, lnum, pnum, 0); | 346 | err = ubi_wl_put_peb(ubi, vol_id, lnum, pnum, 0); |
345 | 347 | ||
346 | out_unlock: | 348 | out_unlock: |
@@ -548,7 +550,9 @@ retry: | |||
548 | mutex_unlock(&ubi->buf_mutex); | 550 | mutex_unlock(&ubi->buf_mutex); |
549 | ubi_free_vid_hdr(ubi, vid_hdr); | 551 | ubi_free_vid_hdr(ubi, vid_hdr); |
550 | 552 | ||
553 | down_read(&ubi->fm_sem); | ||
551 | vol->eba_tbl[lnum] = new_pnum; | 554 | vol->eba_tbl[lnum] = new_pnum; |
555 | up_read(&ubi->fm_sem); | ||
552 | ubi_wl_put_peb(ubi, vol_id, lnum, pnum, 1); | 556 | ubi_wl_put_peb(ubi, vol_id, lnum, pnum, 1); |
553 | 557 | ||
554 | ubi_msg("data was successfully recovered"); | 558 | ubi_msg("data was successfully recovered"); |
@@ -665,7 +669,9 @@ retry: | |||
665 | } | 669 | } |
666 | } | 670 | } |
667 | 671 | ||
672 | down_read(&ubi->fm_sem); | ||
668 | vol->eba_tbl[lnum] = pnum; | 673 | vol->eba_tbl[lnum] = pnum; |
674 | up_read(&ubi->fm_sem); | ||
669 | 675 | ||
670 | leb_write_unlock(ubi, vol_id, lnum); | 676 | leb_write_unlock(ubi, vol_id, lnum); |
671 | ubi_free_vid_hdr(ubi, vid_hdr); | 677 | ubi_free_vid_hdr(ubi, vid_hdr); |
@@ -783,7 +789,9 @@ retry: | |||
783 | } | 789 | } |
784 | 790 | ||
785 | ubi_assert(vol->eba_tbl[lnum] < 0); | 791 | ubi_assert(vol->eba_tbl[lnum] < 0); |
792 | down_read(&ubi->fm_sem); | ||
786 | vol->eba_tbl[lnum] = pnum; | 793 | vol->eba_tbl[lnum] = pnum; |
794 | up_read(&ubi->fm_sem); | ||
787 | 795 | ||
788 | leb_write_unlock(ubi, vol_id, lnum); | 796 | leb_write_unlock(ubi, vol_id, lnum); |
789 | ubi_free_vid_hdr(ubi, vid_hdr); | 797 | ubi_free_vid_hdr(ubi, vid_hdr); |
@@ -904,7 +912,9 @@ retry: | |||
904 | goto out_leb_unlock; | 912 | goto out_leb_unlock; |
905 | } | 913 | } |
906 | 914 | ||
915 | down_read(&ubi->fm_sem); | ||
907 | vol->eba_tbl[lnum] = pnum; | 916 | vol->eba_tbl[lnum] = pnum; |
917 | up_read(&ubi->fm_sem); | ||
908 | 918 | ||
909 | out_leb_unlock: | 919 | out_leb_unlock: |
910 | leb_write_unlock(ubi, vol_id, lnum); | 920 | leb_write_unlock(ubi, vol_id, lnum); |
@@ -1151,7 +1161,9 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to, | |||
1151 | } | 1161 | } |
1152 | 1162 | ||
1153 | ubi_assert(vol->eba_tbl[lnum] == from); | 1163 | ubi_assert(vol->eba_tbl[lnum] == from); |
1164 | down_read(&ubi->fm_sem); | ||
1154 | vol->eba_tbl[lnum] = to; | 1165 | vol->eba_tbl[lnum] = to; |
1166 | up_read(&ubi->fm_sem); | ||
1155 | 1167 | ||
1156 | out_unlock_buf: | 1168 | out_unlock_buf: |
1157 | mutex_unlock(&ubi->buf_mutex); | 1169 | mutex_unlock(&ubi->buf_mutex); |