Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff... Commit: 5b2c8e2e8bd72d54da60f84bfc3e119826e0e610 Parent: b9236511fd2d579f89cb6eca3f8a556d86c739ae Author: Andrew Price anprice@redhat.com AuthorDate: Wed Oct 5 00:18:17 2011 +0100 Committer: Andrew Price anprice@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@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;
cluster-commits@lists.stg.fedorahosted.org