Commit d3b2578f56e0a77b9e261d83e9b5a0a666b82980

Authored by Artem Bityutskiy
Committed by Artem Bityutskiy
1 parent 987226a5d3

UBIFS: switch to I/O helpers

Switch the rest of direct UBI calls to UBIFS helper functions.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

Showing 5 changed files with 19 additions and 21 deletions Side-by-side Diff

... ... @@ -262,7 +262,7 @@
262 262 * an unclean reboot, because the target LEB might have been
263 263 * unmapped, but not yet physically erased.
264 264 */
265   - err = ubi_leb_map(c->ubi, bud->lnum, UBI_SHORTTERM);
  265 + err = ubifs_leb_map(c, bud->lnum, UBI_SHORTTERM);
266 266 if (err)
267 267 goto out_unlock;
268 268 }
... ... @@ -283,8 +283,6 @@
283 283 return 0;
284 284  
285 285 out_unlock:
286   - if (err != -EAGAIN)
287   - ubifs_ro_mode(c, err);
288 286 mutex_unlock(&c->log_mutex);
289 287 kfree(ref);
290 288 kfree(bud);
... ... @@ -701,8 +701,8 @@
701 701 alen = ALIGN(len, c->min_io_size);
702 702 set_ltab(c, lnum, c->leb_size - alen, alen - len);
703 703 memset(p, 0xff, alen - len);
704   - err = ubi_leb_change(c->ubi, lnum++, buf, alen,
705   - UBI_SHORTTERM);
  704 + err = ubifs_leb_change(c, lnum++, buf, alen,
  705 + UBI_SHORTTERM);
706 706 if (err)
707 707 goto out;
708 708 p = buf;
... ... @@ -732,8 +732,8 @@
732 732 set_ltab(c, lnum, c->leb_size - alen,
733 733 alen - len);
734 734 memset(p, 0xff, alen - len);
735   - err = ubi_leb_change(c->ubi, lnum++, buf, alen,
736   - UBI_SHORTTERM);
  735 + err = ubifs_leb_change(c, lnum++, buf, alen,
  736 + UBI_SHORTTERM);
737 737 if (err)
738 738 goto out;
739 739 p = buf;
... ... @@ -780,8 +780,8 @@
780 780 alen = ALIGN(len, c->min_io_size);
781 781 set_ltab(c, lnum, c->leb_size - alen, alen - len);
782 782 memset(p, 0xff, alen - len);
783   - err = ubi_leb_change(c->ubi, lnum++, buf, alen,
784   - UBI_SHORTTERM);
  783 + err = ubifs_leb_change(c, lnum++, buf, alen,
  784 + UBI_SHORTTERM);
785 785 if (err)
786 786 goto out;
787 787 p = buf;
... ... @@ -806,7 +806,7 @@
806 806 alen = ALIGN(len, c->min_io_size);
807 807 set_ltab(c, lnum, c->leb_size - alen, alen - len);
808 808 memset(p, 0xff, alen - len);
809   - err = ubi_leb_change(c->ubi, lnum++, buf, alen, UBI_SHORTTERM);
  809 + err = ubifs_leb_change(c, lnum++, buf, alen, UBI_SHORTTERM);
810 810 if (err)
811 811 goto out;
812 812 p = buf;
... ... @@ -826,7 +826,7 @@
826 826  
827 827 /* Write remaining buffer */
828 828 memset(p, 0xff, alen - len);
829   - err = ubi_leb_change(c->ubi, lnum, buf, alen, UBI_SHORTTERM);
  829 + err = ubifs_leb_change(c, lnum, buf, alen, UBI_SHORTTERM);
830 830 if (err)
831 831 goto out;
832 832  
... ... @@ -213,10 +213,10 @@
213 213 mst->flags |= cpu_to_le32(UBIFS_MST_RCVRY);
214 214  
215 215 ubifs_prepare_node(c, mst, UBIFS_MST_NODE_SZ, 1);
216   - err = ubi_leb_change(c->ubi, lnum, mst, sz, UBI_SHORTTERM);
  216 + err = ubifs_leb_change(c, lnum, mst, sz, UBI_SHORTTERM);
217 217 if (err)
218 218 goto out;
219   - err = ubi_leb_change(c->ubi, lnum + 1, mst, sz, UBI_SHORTTERM);
  219 + err = ubifs_leb_change(c, lnum + 1, mst, sz, UBI_SHORTTERM);
220 220 if (err)
221 221 goto out;
222 222 out:
... ... @@ -554,8 +554,8 @@
554 554 ubifs_pad(c, buf, pad_len);
555 555 }
556 556 }
557   - err = ubi_leb_change(c->ubi, lnum, sleb->buf, len,
558   - UBI_UNKNOWN);
  557 + err = ubifs_leb_change(c, lnum, sleb->buf, len,
  558 + UBI_UNKNOWN);
559 559 if (err)
560 560 return err;
561 561 }
... ... @@ -939,7 +939,7 @@
939 939 err = ubifs_leb_read(c, lnum, sbuf, 0, offs, 1);
940 940 if (err)
941 941 return err;
942   - return ubi_leb_change(c->ubi, lnum, sbuf, offs, UBI_UNKNOWN);
  942 + return ubifs_leb_change(c, lnum, sbuf, offs, UBI_UNKNOWN);
943 943 }
944 944  
945 945 return 0;
... ... @@ -1069,7 +1069,7 @@
1069 1069 }
1070 1070  
1071 1071 /* Write back the LEB atomically */
1072   - err = ubi_leb_change(c->ubi, lnum, sbuf, len, UBI_UNKNOWN);
  1072 + err = ubifs_leb_change(c, lnum, sbuf, len, UBI_UNKNOWN);
1073 1073 if (err)
1074 1074 return err;
1075 1075  
... ... @@ -1470,7 +1470,7 @@
1470 1470 len -= 1;
1471 1471 len = ALIGN(len + 1, c->min_io_size);
1472 1472 /* Atomically write the fixed LEB back again */
1473   - err = ubi_leb_change(c->ubi, lnum, c->sbuf, len, UBI_UNKNOWN);
  1473 + err = ubifs_leb_change(c, lnum, c->sbuf, len, UBI_UNKNOWN);
1474 1474 if (err)
1475 1475 goto out;
1476 1476 dbg_rcvry("inode %lu at %d:%d size %lld -> %lld",
... ... @@ -674,7 +674,7 @@
674 674  
675 675 if (len == 0) {
676 676 dbg_mnt("unmap empty LEB %d", lnum);
677   - return ubi_leb_unmap(c->ubi, lnum);
  677 + return ubifs_leb_unmap(c, lnum);
678 678 }
679 679  
680 680 dbg_mnt("fixup LEB %d, data len %d", lnum, len);
... ... @@ -682,7 +682,7 @@
682 682 if (err)
683 683 return err;
684 684  
685   - return ubi_leb_change(c->ubi, lnum, c->sbuf, len, UBI_UNKNOWN);
  685 + return ubifs_leb_change(c, lnum, c->sbuf, len, UBI_UNKNOWN);
686 686 }
687 687  
688 688 /**
... ... @@ -914,7 +914,7 @@
914 914  
915 915 c->empty = 1;
916 916 for (lnum = 0; lnum < c->leb_cnt; lnum++) {
917   - err = ubi_is_mapped(c->ubi, lnum);
  917 + err = ubifs_is_mapped(c, lnum);
918 918 if (unlikely(err < 0))
919 919 return err;
920 920 if (err == 1) {