aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-07-21 10:14:29 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-08-13 04:27:47 -0400
commit014eb04b03202dc75c1c749df4246d98045f5e69 (patch)
tree99edd8f2907b478616bba8d44a308b6b750ead99 /fs/ubifs
parentfd6c6b51e3677937090314b20b00f2194900d81b (diff)
UBIFS: increment commit number earlier
Increment the commit number at the beginnig of the commit, instead of doing this after the commit. This is needed for further optimizations. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/commit.c3
-rw-r--r--fs/ubifs/log.c2
-rw-r--r--fs/ubifs/orphan.c4
-rw-r--r--fs/ubifs/ubifs.h3
4 files changed, 7 insertions, 5 deletions
diff --git a/fs/ubifs/commit.c b/fs/ubifs/commit.c
index 3b516316c9b3..0a6aa2cc78f0 100644
--- a/fs/ubifs/commit.c
+++ b/fs/ubifs/commit.c
@@ -74,6 +74,7 @@ static int do_commit(struct ubifs_info *c)
74 goto out_up; 74 goto out_up;
75 } 75 }
76 76
77 c->cmt_no += 1;
77 err = ubifs_gc_start_commit(c); 78 err = ubifs_gc_start_commit(c);
78 if (err) 79 if (err)
79 goto out_up; 80 goto out_up;
@@ -115,7 +116,7 @@ static int do_commit(struct ubifs_info *c)
115 goto out; 116 goto out;
116 117
117 mutex_lock(&c->mst_mutex); 118 mutex_lock(&c->mst_mutex);
118 c->mst_node->cmt_no = cpu_to_le64(++c->cmt_no); 119 c->mst_node->cmt_no = cpu_to_le64(c->cmt_no);
119 c->mst_node->log_lnum = cpu_to_le32(new_ltail_lnum); 120 c->mst_node->log_lnum = cpu_to_le32(new_ltail_lnum);
120 c->mst_node->root_lnum = cpu_to_le32(zroot.lnum); 121 c->mst_node->root_lnum = cpu_to_le32(zroot.lnum);
121 c->mst_node->root_offs = cpu_to_le32(zroot.offs); 122 c->mst_node->root_offs = cpu_to_le32(zroot.offs);
diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c
index e14829e50693..3e0aa7367556 100644
--- a/fs/ubifs/log.c
+++ b/fs/ubifs/log.c
@@ -412,7 +412,7 @@ int ubifs_log_start_commit(struct ubifs_info *c, int *ltail_lnum)
412 return -ENOMEM; 412 return -ENOMEM;
413 413
414 cs->ch.node_type = UBIFS_CS_NODE; 414 cs->ch.node_type = UBIFS_CS_NODE;
415 cs->cmt_no = cpu_to_le64(c->cmt_no + 1); 415 cs->cmt_no = cpu_to_le64(c->cmt_no);
416 ubifs_prepare_node(c, cs, UBIFS_CS_NODE_SZ, 0); 416 ubifs_prepare_node(c, cs, UBIFS_CS_NODE_SZ, 0);
417 417
418 /* 418 /*
diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c
index 3afeb9242c6a..02d3462f4d3e 100644
--- a/fs/ubifs/orphan.c
+++ b/fs/ubifs/orphan.c
@@ -310,10 +310,10 @@ static int write_orph_node(struct ubifs_info *c, int atomic)
310 c->cmt_orphans -= cnt; 310 c->cmt_orphans -= cnt;
311 spin_unlock(&c->orphan_lock); 311 spin_unlock(&c->orphan_lock);
312 if (c->cmt_orphans) 312 if (c->cmt_orphans)
313 orph->cmt_no = cpu_to_le64(c->cmt_no + 1); 313 orph->cmt_no = cpu_to_le64(c->cmt_no);
314 else 314 else
315 /* Mark the last node of the commit */ 315 /* Mark the last node of the commit */
316 orph->cmt_no = cpu_to_le64((c->cmt_no + 1) | (1ULL << 63)); 316 orph->cmt_no = cpu_to_le64((c->cmt_no) | (1ULL << 63));
317 ubifs_assert(c->ohead_offs + len <= c->leb_size); 317 ubifs_assert(c->ohead_offs + len <= c->leb_size);
318 ubifs_assert(c->ohead_lnum >= c->orph_first); 318 ubifs_assert(c->ohead_lnum >= c->orph_first);
319 ubifs_assert(c->ohead_lnum <= c->orph_last); 319 ubifs_assert(c->ohead_lnum <= c->orph_last);
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 6ddd1de2ea64..21502b6040f0 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -865,7 +865,8 @@ struct ubifs_mount_opts {
865 * @highest_inum: highest used inode number 865 * @highest_inum: highest used inode number
866 * @vfs_gen: VFS inode generation counter 866 * @vfs_gen: VFS inode generation counter
867 * @max_sqnum: current global sequence number 867 * @max_sqnum: current global sequence number
868 * @cmt_no: commit number (last successfully completed commit) 868 * @cmt_no: commit number of the last successfully completed commit, protected
869 * by @commit_sem
869 * @cnt_lock: protects @highest_inum, @vfs_gen, and @max_sqnum counters 870 * @cnt_lock: protects @highest_inum, @vfs_gen, and @max_sqnum counters
870 * @fmt_version: UBIFS on-flash format version 871 * @fmt_version: UBIFS on-flash format version
871 * @uuid: UUID from super block 872 * @uuid: UUID from super block