]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
UBIFS: increment commit number earlier
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Mon, 21 Jul 2008 14:14:29 +0000 (17:14 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Wed, 13 Aug 2008 08:27:47 +0000 (11:27 +0300)
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>
fs/ubifs/commit.c
fs/ubifs/log.c
fs/ubifs/orphan.c
fs/ubifs/ubifs.h

index 3b516316c9b39cdfab996b8cd6245c9cca6d4a18..0a6aa2cc78f07eb7e0aa4ce6af2dfe8b5fe32ca5 100644 (file)
@@ -74,6 +74,7 @@ static int do_commit(struct ubifs_info *c)
                        goto out_up;
        }
 
+       c->cmt_no += 1;
        err = ubifs_gc_start_commit(c);
        if (err)
                goto out_up;
@@ -115,7 +116,7 @@ static int do_commit(struct ubifs_info *c)
                goto out;
 
        mutex_lock(&c->mst_mutex);
-       c->mst_node->cmt_no      = cpu_to_le64(++c->cmt_no);
+       c->mst_node->cmt_no      = cpu_to_le64(c->cmt_no);
        c->mst_node->log_lnum    = cpu_to_le32(new_ltail_lnum);
        c->mst_node->root_lnum   = cpu_to_le32(zroot.lnum);
        c->mst_node->root_offs   = cpu_to_le32(zroot.offs);
index e14829e506934904bd5917b95dd55e602ecc63c1..3e0aa7367556903e4f41f416443f92fa8cdab228 100644 (file)
@@ -412,7 +412,7 @@ int ubifs_log_start_commit(struct ubifs_info *c, int *ltail_lnum)
                return -ENOMEM;
 
        cs->ch.node_type = UBIFS_CS_NODE;
-       cs->cmt_no = cpu_to_le64(c->cmt_no + 1);
+       cs->cmt_no = cpu_to_le64(c->cmt_no);
        ubifs_prepare_node(c, cs, UBIFS_CS_NODE_SZ, 0);
 
        /*
index 3afeb9242c6ac9bd9fb6ef67603c841e7987daa6..02d3462f4d3e99edb907ddaee16ed75300e827b0 100644 (file)
@@ -310,10 +310,10 @@ static int write_orph_node(struct ubifs_info *c, int atomic)
        c->cmt_orphans -= cnt;
        spin_unlock(&c->orphan_lock);
        if (c->cmt_orphans)
-               orph->cmt_no = cpu_to_le64(c->cmt_no + 1);
+               orph->cmt_no = cpu_to_le64(c->cmt_no);
        else
                /* Mark the last node of the commit */
-               orph->cmt_no = cpu_to_le64((c->cmt_no + 1) | (1ULL << 63));
+               orph->cmt_no = cpu_to_le64((c->cmt_no) | (1ULL << 63));
        ubifs_assert(c->ohead_offs + len <= c->leb_size);
        ubifs_assert(c->ohead_lnum >= c->orph_first);
        ubifs_assert(c->ohead_lnum <= c->orph_last);
index 6ddd1de2ea6493722f0846cf8c975cc5d8d01ad4..21502b6040f069e8aab97af987d895dcca8ddd42 100644 (file)
@@ -865,7 +865,8 @@ struct ubifs_mount_opts {
  * @highest_inum: highest used inode number
  * @vfs_gen: VFS inode generation counter
  * @max_sqnum: current global sequence number
- * @cmt_no: commit number (last successfully completed commit)
+ * @cmt_no: commit number of the last successfully completed commit, protected
+ *          by @commit_sem
  * @cnt_lock: protects @highest_inum, @vfs_gen, and @max_sqnum counters
  * @fmt_version: UBIFS on-flash format version
  * @uuid: UUID from super block