gfs2-utils: master - libgfs2: Don't count sentinel dirent as an entry
Andrew Price
andyp at fedoraproject.org
Wed Oct 5 13:59:57 UTC 2011
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=5b2c8e2e8bd72d54da60f84bfc3e119826e0e610
Commit: 5b2c8e2e8bd72d54da60f84bfc3e119826e0e610
Parent: b9236511fd2d579f89cb6eca3f8a556d86c739ae
Author: Andrew Price <anprice at redhat.com>
AuthorDate: Wed Oct 5 00:18:17 2011 +0100
Committer: Andrew Price <anprice at redhat.com>
CommitterDate: Wed Oct 5 14:56:26 2011 +0100
libgfs2: Don't count sentinel dirent as an entry
dir_split_leaf() adds a sentinel dirent using dirent_alloc() which
increments di_entries in the directory dinode. Since sentinel dirents
aren't real directory entries, di_entries becomes too high in some
situations. This patch decrements di_entries after the sentinel dirent
is created to fix the discrepancy.
Signed-off-by: Andrew Price <anprice at redhat.com>
---
gfs2/libgfs2/fs_ops.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index ecd54ca..fe7fce6 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -953,6 +953,8 @@ static void dir_split_leaf(struct gfs2_inode *dip, uint32_t lindex,
if (dirent_alloc(dip, nbh, 0, &new))
die("dir_split_leaf (4)\n");
new->de_inum.no_formal_ino = 0;
+ /* Don't count the sentinel dirent as an entry */
+ dip->i_di.di_entries--;
}
oleaf->lf_depth = be16_to_cpu(oleaf->lf_depth) + 1;
More information about the cluster-commits
mailing list