aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/tnc_commit.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-05-30 07:30:51 -0400
committerArtem Bityutskiy <dedekind1@gmail.com>2011-07-04 03:54:27 -0400
commit1f42596ec0a7d3d50a494d95e3f1afbd117250f8 (patch)
treee0c3e0f5f75ea73ab8496ae07301e81c07c524a2 /fs/ubifs/tnc_commit.c
parent12e776a0882def45e7ee50918016968b392ac7bd (diff)
UBIFS: remove dead code
Remove dead pieces of code under "if (c->min_io_size == 1)" statement - we never execute it because in UBIFS 'c->min_io_size' is always at least 8. This are leftovers from old pre-mainline prototype. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/tnc_commit.c')
-rw-r--r--fs/ubifs/tnc_commit.c106
1 files changed, 30 insertions, 76 deletions
diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c
index 41920f357bbf..8315387be3fd 100644
--- a/fs/ubifs/tnc_commit.c
+++ b/fs/ubifs/tnc_commit.c
@@ -491,25 +491,6 @@ static int layout_in_empty_space(struct ubifs_info *c)
491 else 491 else
492 next_len = ubifs_idx_node_sz(c, cnext->child_cnt); 492 next_len = ubifs_idx_node_sz(c, cnext->child_cnt);
493 493
494 if (c->min_io_size == 1) {
495 buf_offs += ALIGN(len, 8);
496 if (next_len) {
497 if (buf_offs + next_len <= c->leb_size)
498 continue;
499 err = ubifs_update_one_lp(c, lnum, 0,
500 c->leb_size - buf_offs, 0, 0);
501 if (err)
502 return err;
503 lnum = -1;
504 continue;
505 }
506 err = ubifs_update_one_lp(c, lnum,
507 c->leb_size - buf_offs, 0, 0, 0);
508 if (err)
509 return err;
510 break;
511 }
512
513 /* Update buffer positions */ 494 /* Update buffer positions */
514 wlen = used + len; 495 wlen = used + len;
515 used += ALIGN(len, 8); 496 used += ALIGN(len, 8);
@@ -830,7 +811,7 @@ static int write_index(struct ubifs_info *c)
830 struct ubifs_idx_node *idx; 811 struct ubifs_idx_node *idx;
831 struct ubifs_znode *znode, *cnext; 812 struct ubifs_znode *znode, *cnext;
832 int i, lnum, offs, len, next_len, buf_len, buf_offs, used; 813 int i, lnum, offs, len, next_len, buf_len, buf_offs, used;
833 int avail, wlen, err, lnum_pos = 0; 814 int avail, wlen, err, lnum_pos = 0, blen, nxt_offs;
834 815
835 cnext = c->enext; 816 cnext = c->enext;
836 if (!cnext) 817 if (!cnext)
@@ -938,65 +919,38 @@ static int write_index(struct ubifs_info *c)
938 else 919 else
939 next_len = ubifs_idx_node_sz(c, cnext->child_cnt); 920 next_len = ubifs_idx_node_sz(c, cnext->child_cnt);
940 921
941 if (c->min_io_size == 1) { 922 nxt_offs = buf_offs + used + next_len;
942 /* 923 if (next_len && nxt_offs <= c->leb_size) {
943 * Write the prepared index node immediately if there is 924 if (avail > 0)
944 * no minimum IO size
945 */
946 err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs,
947 wlen, UBI_SHORTTERM);
948 if (err)
949 return err;
950 buf_offs += ALIGN(wlen, 8);
951 if (next_len) {
952 used = 0;
953 avail = buf_len;
954 if (buf_offs + next_len > c->leb_size) {
955 err = ubifs_update_one_lp(c, lnum,
956 LPROPS_NC, 0, 0, LPROPS_TAKEN);
957 if (err)
958 return err;
959 lnum = -1;
960 }
961 continue; 925 continue;
962 } 926 else
927 blen = buf_len;
963 } else { 928 } else {
964 int blen, nxt_offs = buf_offs + used + next_len; 929 wlen = ALIGN(wlen, 8);
965 930 blen = ALIGN(wlen, c->min_io_size);
966 if (next_len && nxt_offs <= c->leb_size) { 931 ubifs_pad(c, c->cbuf + wlen, blen - wlen);
967 if (avail > 0) 932 }
968 continue; 933
969 else 934 /* The buffer is full or there are no more znodes to do */
970 blen = buf_len; 935 err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs, blen,
971 } else { 936 UBI_SHORTTERM);
972 wlen = ALIGN(wlen, 8); 937 if (err)
973 blen = ALIGN(wlen, c->min_io_size); 938 return err;
974 ubifs_pad(c, c->cbuf + wlen, blen - wlen); 939 buf_offs += blen;
975 } 940 if (next_len) {
976 /* 941 if (nxt_offs > c->leb_size) {
977 * The buffer is full or there are no more znodes 942 err = ubifs_update_one_lp(c, lnum, LPROPS_NC, 0,
978 * to do 943 0, LPROPS_TAKEN);
979 */ 944 if (err)
980 err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs, 945 return err;
981 blen, UBI_SHORTTERM); 946 lnum = -1;
982 if (err)
983 return err;
984 buf_offs += blen;
985 if (next_len) {
986 if (nxt_offs > c->leb_size) {
987 err = ubifs_update_one_lp(c, lnum,
988 LPROPS_NC, 0, 0, LPROPS_TAKEN);
989 if (err)
990 return err;
991 lnum = -1;
992 }
993 used -= blen;
994 if (used < 0)
995 used = 0;
996 avail = buf_len - used;
997 memmove(c->cbuf, c->cbuf + blen, used);
998 continue;
999 } 947 }
948 used -= blen;
949 if (used < 0)
950 used = 0;
951 avail = buf_len - used;
952 memmove(c->cbuf, c->cbuf + blen, used);
953 continue;
1000 } 954 }
1001 break; 955 break;
1002 } 956 }