Commit 428ff9d2 authored by Artem Bityutskiy's avatar Artem Bityutskiy

UBIFS: remove dead code

UBIFS assumes that @c->min_io_size is 8 in case of NOR flash. This
is because UBIFS alignes all nodes to 8-byte boundary, and maintaining
@c->min_io_size introduced unnecessary complications.

This patch removes senseless constructs like:

if (c->min_io_size == 1)
	NOR-specific code

Also, few commentaries amendments.
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
parent 7c83f5cb
...@@ -91,7 +91,6 @@ static int shrink_liability(struct ubifs_info *c, int nr_to_write) ...@@ -91,7 +91,6 @@ static int shrink_liability(struct ubifs_info *c, int nr_to_write)
return nr_written; return nr_written;
} }
/** /**
* run_gc - run garbage collector. * run_gc - run garbage collector.
* @c: UBIFS file-system description object * @c: UBIFS file-system description object
......
...@@ -343,33 +343,15 @@ int ubifs_write_rcvrd_mst_node(struct ubifs_info *c) ...@@ -343,33 +343,15 @@ int ubifs_write_rcvrd_mst_node(struct ubifs_info *c)
* *
* This function returns %1 if @offs was in the last write to the LEB whose data * This function returns %1 if @offs was in the last write to the LEB whose data
* is in @buf, otherwise %0 is returned. The determination is made by checking * is in @buf, otherwise %0 is returned. The determination is made by checking
* for subsequent empty space starting from the next min_io_size boundary (or a * for subsequent empty space starting from the next @c->min_io_size boundary.
* bit less than the common header size if min_io_size is one).
*/ */
static int is_last_write(const struct ubifs_info *c, void *buf, int offs) static int is_last_write(const struct ubifs_info *c, void *buf, int offs)
{ {
int empty_offs; int empty_offs, check_len;
int check_len;
uint8_t *p; uint8_t *p;
if (c->min_io_size == 1) {
check_len = c->leb_size - offs;
p = buf + check_len;
for (; check_len > 0; check_len--)
if (*--p != 0xff)
break;
/*
* 'check_len' is the size of the corruption which cannot be
* more than the size of 1 node if it was caused by an unclean
* unmount.
*/
if (check_len > UBIFS_MAX_NODE_SZ)
return 0;
return 1;
}
/* /*
* Round up to the next c->min_io_size boundary i.e. 'offs' is in the * Round up to the next @c->min_io_size boundary i.e. @offs is in the
* last wbuf written. After that should be empty space. * last wbuf written. After that should be empty space.
*/ */
empty_offs = ALIGN(offs + 1, c->min_io_size); empty_offs = ALIGN(offs + 1, c->min_io_size);
...@@ -392,7 +374,7 @@ static int is_last_write(const struct ubifs_info *c, void *buf, int offs) ...@@ -392,7 +374,7 @@ static int is_last_write(const struct ubifs_info *c, void *buf, int offs)
* *
* This function pads up to the next min_io_size boundary (if there is one) and * This function pads up to the next min_io_size boundary (if there is one) and
* sets empty space to all 0xff. @buf, @offs and @len are updated to the next * sets empty space to all 0xff. @buf, @offs and @len are updated to the next
* min_io_size boundary (if there is one). * @c->min_io_size boundary.
*/ */
static void clean_buf(const struct ubifs_info *c, void **buf, int lnum, static void clean_buf(const struct ubifs_info *c, void **buf, int lnum,
int *offs, int *len) int *offs, int *len)
...@@ -402,11 +384,6 @@ static void clean_buf(const struct ubifs_info *c, void **buf, int lnum, ...@@ -402,11 +384,6 @@ static void clean_buf(const struct ubifs_info *c, void **buf, int lnum,
lnum = lnum; lnum = lnum;
dbg_rcvry("cleaning corruption at %d:%d", lnum, *offs); dbg_rcvry("cleaning corruption at %d:%d", lnum, *offs);
if (c->min_io_size == 1) {
memset(*buf, 0xff, c->leb_size - *offs);
return;
}
ubifs_assert(!(*offs & 7)); ubifs_assert(!(*offs & 7));
empty_offs = ALIGN(*offs, c->min_io_size); empty_offs = ALIGN(*offs, c->min_io_size);
pad_len = empty_offs - *offs; pad_len = empty_offs - *offs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment