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>
This commit is contained in:
parent
12e776a088
commit
1f42596ec0
|
@ -491,25 +491,6 @@ static int layout_in_empty_space(struct ubifs_info *c)
|
||||||
else
|
else
|
||||||
next_len = ubifs_idx_node_sz(c, cnext->child_cnt);
|
next_len = ubifs_idx_node_sz(c, cnext->child_cnt);
|
||||||
|
|
||||||
if (c->min_io_size == 1) {
|
|
||||||
buf_offs += ALIGN(len, 8);
|
|
||||||
if (next_len) {
|
|
||||||
if (buf_offs + next_len <= c->leb_size)
|
|
||||||
continue;
|
|
||||||
err = ubifs_update_one_lp(c, lnum, 0,
|
|
||||||
c->leb_size - buf_offs, 0, 0);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
lnum = -1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
err = ubifs_update_one_lp(c, lnum,
|
|
||||||
c->leb_size - buf_offs, 0, 0, 0);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Update buffer positions */
|
/* Update buffer positions */
|
||||||
wlen = used + len;
|
wlen = used + len;
|
||||||
used += ALIGN(len, 8);
|
used += ALIGN(len, 8);
|
||||||
|
@ -830,7 +811,7 @@ static int write_index(struct ubifs_info *c)
|
||||||
struct ubifs_idx_node *idx;
|
struct ubifs_idx_node *idx;
|
||||||
struct ubifs_znode *znode, *cnext;
|
struct ubifs_znode *znode, *cnext;
|
||||||
int i, lnum, offs, len, next_len, buf_len, buf_offs, used;
|
int i, lnum, offs, len, next_len, buf_len, buf_offs, used;
|
||||||
int avail, wlen, err, lnum_pos = 0;
|
int avail, wlen, err, lnum_pos = 0, blen, nxt_offs;
|
||||||
|
|
||||||
cnext = c->enext;
|
cnext = c->enext;
|
||||||
if (!cnext)
|
if (!cnext)
|
||||||
|
@ -938,65 +919,38 @@ static int write_index(struct ubifs_info *c)
|
||||||
else
|
else
|
||||||
next_len = ubifs_idx_node_sz(c, cnext->child_cnt);
|
next_len = ubifs_idx_node_sz(c, cnext->child_cnt);
|
||||||
|
|
||||||
if (c->min_io_size == 1) {
|
nxt_offs = buf_offs + used + next_len;
|
||||||
/*
|
if (next_len && nxt_offs <= c->leb_size) {
|
||||||
* Write the prepared index node immediately if there is
|
if (avail > 0)
|
||||||
* no minimum IO size
|
|
||||||
*/
|
|
||||||
err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs,
|
|
||||||
wlen, UBI_SHORTTERM);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
buf_offs += ALIGN(wlen, 8);
|
|
||||||
if (next_len) {
|
|
||||||
used = 0;
|
|
||||||
avail = buf_len;
|
|
||||||
if (buf_offs + next_len > c->leb_size) {
|
|
||||||
err = ubifs_update_one_lp(c, lnum,
|
|
||||||
LPROPS_NC, 0, 0, LPROPS_TAKEN);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
lnum = -1;
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
else
|
||||||
|
blen = buf_len;
|
||||||
} else {
|
} else {
|
||||||
int blen, nxt_offs = buf_offs + used + next_len;
|
wlen = ALIGN(wlen, 8);
|
||||||
|
blen = ALIGN(wlen, c->min_io_size);
|
||||||
|
ubifs_pad(c, c->cbuf + wlen, blen - wlen);
|
||||||
|
}
|
||||||
|
|
||||||
if (next_len && nxt_offs <= c->leb_size) {
|
/* The buffer is full or there are no more znodes to do */
|
||||||
if (avail > 0)
|
err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs, blen,
|
||||||
continue;
|
UBI_SHORTTERM);
|
||||||
else
|
if (err)
|
||||||
blen = buf_len;
|
return err;
|
||||||
} else {
|
buf_offs += blen;
|
||||||
wlen = ALIGN(wlen, 8);
|
if (next_len) {
|
||||||
blen = ALIGN(wlen, c->min_io_size);
|
if (nxt_offs > c->leb_size) {
|
||||||
ubifs_pad(c, c->cbuf + wlen, blen - wlen);
|
err = ubifs_update_one_lp(c, lnum, LPROPS_NC, 0,
|
||||||
}
|
0, LPROPS_TAKEN);
|
||||||
/*
|
if (err)
|
||||||
* The buffer is full or there are no more znodes
|
return err;
|
||||||
* to do
|
lnum = -1;
|
||||||
*/
|
|
||||||
err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs,
|
|
||||||
blen, UBI_SHORTTERM);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
buf_offs += blen;
|
|
||||||
if (next_len) {
|
|
||||||
if (nxt_offs > c->leb_size) {
|
|
||||||
err = ubifs_update_one_lp(c, lnum,
|
|
||||||
LPROPS_NC, 0, 0, LPROPS_TAKEN);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
lnum = -1;
|
|
||||||
}
|
|
||||||
used -= blen;
|
|
||||||
if (used < 0)
|
|
||||||
used = 0;
|
|
||||||
avail = buf_len - used;
|
|
||||||
memmove(c->cbuf, c->cbuf + blen, used);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
used -= blen;
|
||||||
|
if (used < 0)
|
||||||
|
used = 0;
|
||||||
|
avail = buf_len - used;
|
||||||
|
memmove(c->cbuf, c->cbuf + blen, used);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue