aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/tnc_commit.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ubifs/tnc_commit.c')
-rw-r--r--fs/ubifs/tnc_commit.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c
index 4c15f07a8bb2..523bbad69c0c 100644
--- a/fs/ubifs/tnc_commit.c
+++ b/fs/ubifs/tnc_commit.c
@@ -54,18 +54,16 @@ static int make_idx_node(struct ubifs_info *c, struct ubifs_idx_node *idx,
54 br->len = cpu_to_le32(zbr->len); 54 br->len = cpu_to_le32(zbr->len);
55 if (!zbr->lnum || !zbr->len) { 55 if (!zbr->lnum || !zbr->len) {
56 ubifs_err("bad ref in znode"); 56 ubifs_err("bad ref in znode");
57 dbg_dump_znode(c, znode); 57 ubifs_dump_znode(c, znode);
58 if (zbr->znode) 58 if (zbr->znode)
59 dbg_dump_znode(c, zbr->znode); 59 ubifs_dump_znode(c, zbr->znode);
60 } 60 }
61 } 61 }
62 ubifs_prepare_node(c, idx, len, 0); 62 ubifs_prepare_node(c, idx, len, 0);
63 63
64#ifdef CONFIG_UBIFS_FS_DEBUG
65 znode->lnum = lnum; 64 znode->lnum = lnum;
66 znode->offs = offs; 65 znode->offs = offs;
67 znode->len = len; 66 znode->len = len;
68#endif
69 67
70 err = insert_old_idx_znode(c, znode); 68 err = insert_old_idx_znode(c, znode);
71 69
@@ -322,8 +320,7 @@ static int layout_leb_in_gaps(struct ubifs_info *c, int *p)
322 0, 0, 0); 320 0, 0, 0);
323 if (err) 321 if (err)
324 return err; 322 return err;
325 err = ubifs_leb_change(c, lnum, c->ileb_buf, c->ileb_len, 323 err = ubifs_leb_change(c, lnum, c->ileb_buf, c->ileb_len);
326 UBI_SHORTTERM);
327 if (err) 324 if (err)
328 return err; 325 return err;
329 dbg_gc("LEB %d wrote %d index nodes", lnum, tot_written); 326 dbg_gc("LEB %d wrote %d index nodes", lnum, tot_written);
@@ -388,8 +385,8 @@ static int layout_in_gaps(struct ubifs_info *c, int cnt)
388 * option which forces in-the-gaps is enabled. 385 * option which forces in-the-gaps is enabled.
389 */ 386 */
390 ubifs_warn("out of space"); 387 ubifs_warn("out of space");
391 dbg_dump_budg(c, &c->bi); 388 ubifs_dump_budg(c, &c->bi);
392 dbg_dump_lprops(c); 389 ubifs_dump_lprops(c);
393 } 390 }
394 /* Try to commit anyway */ 391 /* Try to commit anyway */
395 err = 0; 392 err = 0;
@@ -456,11 +453,9 @@ static int layout_in_empty_space(struct ubifs_info *c)
456 453
457 offs = buf_offs + used; 454 offs = buf_offs + used;
458 455
459#ifdef CONFIG_UBIFS_FS_DEBUG
460 znode->lnum = lnum; 456 znode->lnum = lnum;
461 znode->offs = offs; 457 znode->offs = offs;
462 znode->len = len; 458 znode->len = len;
463#endif
464 459
465 /* Update the parent */ 460 /* Update the parent */
466 zp = znode->parent; 461 zp = znode->parent;
@@ -536,10 +531,8 @@ static int layout_in_empty_space(struct ubifs_info *c)
536 break; 531 break;
537 } 532 }
538 533
539#ifdef CONFIG_UBIFS_FS_DEBUG
540 c->dbg->new_ihead_lnum = lnum; 534 c->dbg->new_ihead_lnum = lnum;
541 c->dbg->new_ihead_offs = buf_offs; 535 c->dbg->new_ihead_offs = buf_offs;
542#endif
543 536
544 return 0; 537 return 0;
545} 538}
@@ -864,9 +857,9 @@ static int write_index(struct ubifs_info *c)
864 br->len = cpu_to_le32(zbr->len); 857 br->len = cpu_to_le32(zbr->len);
865 if (!zbr->lnum || !zbr->len) { 858 if (!zbr->lnum || !zbr->len) {
866 ubifs_err("bad ref in znode"); 859 ubifs_err("bad ref in znode");
867 dbg_dump_znode(c, znode); 860 ubifs_dump_znode(c, znode);
868 if (zbr->znode) 861 if (zbr->znode)
869 dbg_dump_znode(c, zbr->znode); 862 ubifs_dump_znode(c, zbr->znode);
870 } 863 }
871 } 864 }
872 len = ubifs_idx_node_sz(c, znode->child_cnt); 865 len = ubifs_idx_node_sz(c, znode->child_cnt);
@@ -881,13 +874,11 @@ static int write_index(struct ubifs_info *c)
881 } 874 }
882 offs = buf_offs + used; 875 offs = buf_offs + used;
883 876
884#ifdef CONFIG_UBIFS_FS_DEBUG
885 if (lnum != znode->lnum || offs != znode->offs || 877 if (lnum != znode->lnum || offs != znode->offs ||
886 len != znode->len) { 878 len != znode->len) {
887 ubifs_err("inconsistent znode posn"); 879 ubifs_err("inconsistent znode posn");
888 return -EINVAL; 880 return -EINVAL;
889 } 881 }
890#endif
891 882
892 /* Grab some stuff from znode while we still can */ 883 /* Grab some stuff from znode while we still can */
893 cnext = znode->cnext; 884 cnext = znode->cnext;
@@ -959,8 +950,7 @@ static int write_index(struct ubifs_info *c)
959 } 950 }
960 951
961 /* The buffer is full or there are no more znodes to do */ 952 /* The buffer is full or there are no more znodes to do */
962 err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs, blen, 953 err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs, blen);
963 UBI_SHORTTERM);
964 if (err) 954 if (err)
965 return err; 955 return err;
966 buf_offs += blen; 956 buf_offs += blen;
@@ -982,13 +972,11 @@ static int write_index(struct ubifs_info *c)
982 break; 972 break;
983 } 973 }
984 974
985#ifdef CONFIG_UBIFS_FS_DEBUG
986 if (lnum != c->dbg->new_ihead_lnum || 975 if (lnum != c->dbg->new_ihead_lnum ||
987 buf_offs != c->dbg->new_ihead_offs) { 976 buf_offs != c->dbg->new_ihead_offs) {
988 ubifs_err("inconsistent ihead"); 977 ubifs_err("inconsistent ihead");
989 return -EINVAL; 978 return -EINVAL;
990 } 979 }
991#endif
992 980
993 c->ihead_lnum = lnum; 981 c->ihead_lnum = lnum;
994 c->ihead_offs = buf_offs; 982 c->ihead_offs = buf_offs;