aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ubifs/lpt_commit.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c
index 3216a1f277f8..27c97a1873d5 100644
--- a/fs/ubifs/lpt_commit.c
+++ b/fs/ubifs/lpt_commit.c
@@ -229,7 +229,7 @@ static int layout_cnodes(struct ubifs_info *c)
229 while (offs + len > c->leb_size) { 229 while (offs + len > c->leb_size) {
230 alen = ALIGN(offs, c->min_io_size); 230 alen = ALIGN(offs, c->min_io_size);
231 upd_ltab(c, lnum, c->leb_size - alen, alen - offs); 231 upd_ltab(c, lnum, c->leb_size - alen, alen - offs);
232 dbg_chk_lpt_sz(c, 2, alen - offs); 232 dbg_chk_lpt_sz(c, 2, c->leb_size - offs);
233 err = alloc_lpt_leb(c, &lnum); 233 err = alloc_lpt_leb(c, &lnum);
234 if (err) 234 if (err)
235 goto no_space; 235 goto no_space;
@@ -272,7 +272,7 @@ static int layout_cnodes(struct ubifs_info *c)
272 if (offs + c->lsave_sz > c->leb_size) { 272 if (offs + c->lsave_sz > c->leb_size) {
273 alen = ALIGN(offs, c->min_io_size); 273 alen = ALIGN(offs, c->min_io_size);
274 upd_ltab(c, lnum, c->leb_size - alen, alen - offs); 274 upd_ltab(c, lnum, c->leb_size - alen, alen - offs);
275 dbg_chk_lpt_sz(c, 2, alen - offs); 275 dbg_chk_lpt_sz(c, 2, c->leb_size - offs);
276 err = alloc_lpt_leb(c, &lnum); 276 err = alloc_lpt_leb(c, &lnum);
277 if (err) 277 if (err)
278 goto no_space; 278 goto no_space;
@@ -292,7 +292,7 @@ static int layout_cnodes(struct ubifs_info *c)
292 if (offs + c->ltab_sz > c->leb_size) { 292 if (offs + c->ltab_sz > c->leb_size) {
293 alen = ALIGN(offs, c->min_io_size); 293 alen = ALIGN(offs, c->min_io_size);
294 upd_ltab(c, lnum, c->leb_size - alen, alen - offs); 294 upd_ltab(c, lnum, c->leb_size - alen, alen - offs);
295 dbg_chk_lpt_sz(c, 2, alen - offs); 295 dbg_chk_lpt_sz(c, 2, c->leb_size - offs);
296 err = alloc_lpt_leb(c, &lnum); 296 err = alloc_lpt_leb(c, &lnum);
297 if (err) 297 if (err)
298 goto no_space; 298 goto no_space;
@@ -416,9 +416,8 @@ static int write_cnodes(struct ubifs_info *c)
416 alen, UBI_SHORTTERM); 416 alen, UBI_SHORTTERM);
417 if (err) 417 if (err)
418 return err; 418 return err;
419 dbg_chk_lpt_sz(c, 4, alen - wlen);
420 } 419 }
421 dbg_chk_lpt_sz(c, 2, 0); 420 dbg_chk_lpt_sz(c, 2, c->leb_size - offs);
422 err = realloc_lpt_leb(c, &lnum); 421 err = realloc_lpt_leb(c, &lnum);
423 if (err) 422 if (err)
424 goto no_space; 423 goto no_space;
@@ -477,7 +476,7 @@ static int write_cnodes(struct ubifs_info *c)
477 UBI_SHORTTERM); 476 UBI_SHORTTERM);
478 if (err) 477 if (err)
479 return err; 478 return err;
480 dbg_chk_lpt_sz(c, 2, alen - wlen); 479 dbg_chk_lpt_sz(c, 2, c->leb_size - offs);
481 err = realloc_lpt_leb(c, &lnum); 480 err = realloc_lpt_leb(c, &lnum);
482 if (err) 481 if (err)
483 goto no_space; 482 goto no_space;
@@ -504,7 +503,7 @@ static int write_cnodes(struct ubifs_info *c)
504 UBI_SHORTTERM); 503 UBI_SHORTTERM);
505 if (err) 504 if (err)
506 return err; 505 return err;
507 dbg_chk_lpt_sz(c, 2, alen - wlen); 506 dbg_chk_lpt_sz(c, 2, c->leb_size - offs);
508 err = realloc_lpt_leb(c, &lnum); 507 err = realloc_lpt_leb(c, &lnum);
509 if (err) 508 if (err)
510 goto no_space; 509 goto no_space;
@@ -1756,10 +1755,16 @@ int dbg_chk_lpt_free_spc(struct ubifs_info *c)
1756/** 1755/**
1757 * dbg_chk_lpt_sz - check LPT does not write more than LPT size. 1756 * dbg_chk_lpt_sz - check LPT does not write more than LPT size.
1758 * @c: the UBIFS file-system description object 1757 * @c: the UBIFS file-system description object
1759 * @action: action 1758 * @action: what to do
1760 * @len: length written 1759 * @len: length written
1761 * 1760 *
1762 * This function returns %0 on success and a negative error code on failure. 1761 * This function returns %0 on success and a negative error code on failure.
1762 * The @action argument may be one of:
1763 * o %0 - LPT debugging checking starts, initialize debugging variables;
1764 * o %1 - wrote an LPT node, increase LPT size by @len bytes;
1765 * o %2 - switched to a different LEB and wasted @len bytes;
1766 * o %3 - check that we've written the right number of bytes.
1767 * o %4 - wasted @len bytes;
1763 */ 1768 */
1764int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len) 1769int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len)
1765{ 1770{