aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ubifs/budget.c1
-rw-r--r--fs/ubifs/recovery.c31
2 files changed, 4 insertions, 28 deletions
diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c
index d0231ba783df..eaf6d891d46f 100644
--- a/fs/ubifs/budget.c
+++ b/fs/ubifs/budget.c
@@ -91,7 +91,6 @@ static int shrink_liability(struct ubifs_info *c, int nr_to_write)
91 return nr_written; 91 return nr_written;
92} 92}
93 93
94
95/** 94/**
96 * run_gc - run garbage collector. 95 * run_gc - run garbage collector.
97 * @c: UBIFS file-system description object 96 * @c: UBIFS file-system description object
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c
index 10662975d2ef..805605250f12 100644
--- a/fs/ubifs/recovery.c
+++ b/fs/ubifs/recovery.c
@@ -343,33 +343,15 @@ int ubifs_write_rcvrd_mst_node(struct ubifs_info *c)
343 * 343 *
344 * This function returns %1 if @offs was in the last write to the LEB whose data 344 * This function returns %1 if @offs was in the last write to the LEB whose data
345 * is in @buf, otherwise %0 is returned. The determination is made by checking 345 * is in @buf, otherwise %0 is returned. The determination is made by checking
346 * for subsequent empty space starting from the next min_io_size boundary (or a 346 * for subsequent empty space starting from the next @c->min_io_size boundary.
347 * bit less than the common header size if min_io_size is one).
348 */ 347 */
349static int is_last_write(const struct ubifs_info *c, void *buf, int offs) 348static int is_last_write(const struct ubifs_info *c, void *buf, int offs)
350{ 349{
351 int empty_offs; 350 int empty_offs, check_len;
352 int check_len;
353 uint8_t *p; 351 uint8_t *p;
354 352
355 if (c->min_io_size == 1) {
356 check_len = c->leb_size - offs;
357 p = buf + check_len;
358 for (; check_len > 0; check_len--)
359 if (*--p != 0xff)
360 break;
361 /*
362 * 'check_len' is the size of the corruption which cannot be
363 * more than the size of 1 node if it was caused by an unclean
364 * unmount.
365 */
366 if (check_len > UBIFS_MAX_NODE_SZ)
367 return 0;
368 return 1;
369 }
370
371 /* 353 /*
372 * Round up to the next c->min_io_size boundary i.e. 'offs' is in the 354 * Round up to the next @c->min_io_size boundary i.e. @offs is in the
373 * last wbuf written. After that should be empty space. 355 * last wbuf written. After that should be empty space.
374 */ 356 */
375 empty_offs = ALIGN(offs + 1, c->min_io_size); 357 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 * 374 *
393 * This function pads up to the next min_io_size boundary (if there is one) and 375 * This function pads up to the next min_io_size boundary (if there is one) and
394 * sets empty space to all 0xff. @buf, @offs and @len are updated to the next 376 * sets empty space to all 0xff. @buf, @offs and @len are updated to the next
395 * min_io_size boundary (if there is one). 377 * @c->min_io_size boundary.
396 */ 378 */
397static void clean_buf(const struct ubifs_info *c, void **buf, int lnum, 379static void clean_buf(const struct ubifs_info *c, void **buf, int lnum,
398 int *offs, int *len) 380 int *offs, int *len)
@@ -402,11 +384,6 @@ static void clean_buf(const struct ubifs_info *c, void **buf, int lnum,
402 lnum = lnum; 384 lnum = lnum;
403 dbg_rcvry("cleaning corruption at %d:%d", lnum, *offs); 385 dbg_rcvry("cleaning corruption at %d:%d", lnum, *offs);
404 386
405 if (c->min_io_size == 1) {
406 memset(*buf, 0xff, c->leb_size - *offs);
407 return;
408 }
409
410 ubifs_assert(!(*offs & 7)); 387 ubifs_assert(!(*offs & 7));
411 empty_offs = ALIGN(*offs, c->min_io_size); 388 empty_offs = ALIGN(*offs, c->min_io_size);
412 pad_len = empty_offs - *offs; 389 pad_len = empty_offs - *offs;