cluster: RHEL58 - libgfs2: Don't count sentinel dirent as an entry

Andrew Price andyp at fedoraproject.org
Wed Dec 7 13:52:38 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=30f9e21706028056af6bc65555783d794a71c07f
Commit:        30f9e21706028056af6bc65555783d794a71c07f
Parent:        0f070b75b0864ed4b46c361916f822b4a57a1a3f
Author:        Andrew Price <anprice at redhat.com>
AuthorDate:    Wed Oct 5 00:18:17 2011 +0100
Committer:     Andrew Price <anprice at redhat.com>
CommitterDate: Tue Dec 6 14:42:18 2011 +0000

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.

rhbz#745126

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 e2b4f54..6579d6f 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -926,6 +926,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