aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/ops_export.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-03-20 12:30:04 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2006-03-20 12:30:04 -0500
commitc752666c17f870fa8ae9f16804dd457e9e6daaec (patch)
treec3c48383f386a24edbdf3c6292f25b587e6d9368 /fs/gfs2/ops_export.c
parent419c93e0b6b9eef0bf26b8ad415f2a5bf4300119 (diff)
[GFS2] Fix bug in directory code and tidy up
Due to a typo, the dir leaf split operation was (for the first split in a directory) writing the new hash vaules at the wrong offset. This is now fixed. Also some other tidy ups are included: - We use GFS2's hash function for dentries (see ops_dentry.c) so that we don't have to keep recalculating the hash values. - A lot of common code is eliminated between the various directory lookup routines. - Better error checking on directory lookup (previously different routines checked for different errors) - The leaf split operation has a couple of redundant operations removed from it, so it should be faster. There is still further scope for further clean ups in the directory code, and readdir in particular could do with slimming down a bit. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_export.c')
-rw-r--r--fs/gfs2/ops_export.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/gfs2/ops_export.c b/fs/gfs2/ops_export.c
index a346943363c..b27bce74a79 100644
--- a/fs/gfs2/ops_export.c
+++ b/fs/gfs2/ops_export.c
@@ -24,6 +24,7 @@
24#include "inode.h" 24#include "inode.h"
25#include "ops_export.h" 25#include "ops_export.h"
26#include "rgrp.h" 26#include "rgrp.h"
27#include "util.h"
27 28
28static struct dentry *gfs2_decode_fh(struct super_block *sb, 29static struct dentry *gfs2_decode_fh(struct super_block *sb,
29 __u32 *fh, 30 __u32 *fh,
@@ -167,11 +168,15 @@ static struct dentry *gfs2_get_parent(struct dentry *child)
167 struct qstr dotdot = { .name = "..", .len = 2 }; 168 struct qstr dotdot = { .name = "..", .len = 2 };
168 struct inode *inode; 169 struct inode *inode;
169 struct dentry *dentry; 170 struct dentry *dentry;
170 int error;
171 171
172 error = gfs2_lookupi(child->d_inode, &dotdot, 1, &inode); 172 dotdot.hash = gfs2_disk_hash(dotdot.name, dotdot.len);
173 if (error) 173
174 return ERR_PTR(error); 174 inode = gfs2_lookupi(child->d_inode, &dotdot, 1, NULL);
175
176 if (!inode)
177 return ERR_PTR(-ENOENT);
178 if (IS_ERR(inode))
179 return ERR_PTR(PTR_ERR(inode));
175 180
176 dentry = d_alloc_anon(inode); 181 dentry = d_alloc_anon(inode);
177 if (!dentry) { 182 if (!dentry) {