aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/dir.h
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2014-01-06 12:49:43 +0000
committerSteven Whitehouse <swhiteho@redhat.com>2014-01-06 12:49:43 +0000
commit2b47dad866d04f14c328f888ba5406057b8c7d33 (patch)
tree9eb66c086c2e49080234e0a9a1014624354ebea3 /fs/gfs2/dir.h
parentGFS2: Consolidate transaction blocks calculation for dir add (diff)
downloadlinux-dev-2b47dad866d04f14c328f888ba5406057b8c7d33.tar.xz
linux-dev-2b47dad866d04f14c328f888ba5406057b8c7d33.zip
GFS2: Remember directory insert point
When we look to see if there is enough space to add a dir entry without allocation, we have then been repeating the same search later when we do the actual insertion. This patch caches the details of the location in the gfs2_diradd structure, so that we do not have to repeat the search. This will provide a performance improvement which will be greater as the size of the directory increases. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/dir.h')
-rw-r--r--fs/gfs2/dir.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/gfs2/dir.h b/fs/gfs2/dir.h
index c5573e703a7a..126c65dda028 100644
--- a/fs/gfs2/dir.h
+++ b/fs/gfs2/dir.h
@@ -16,9 +16,13 @@
struct inode;
struct gfs2_inode;
struct gfs2_inum;
+struct buffer_head;
+struct gfs2_dirent;
struct gfs2_diradd {
unsigned nr_blocks;
+ struct gfs2_dirent *dent;
+ struct buffer_head *bh;
};
extern struct inode *gfs2_dir_search(struct inode *dir,
@@ -27,7 +31,13 @@ extern struct inode *gfs2_dir_search(struct inode *dir,
extern int gfs2_dir_check(struct inode *dir, const struct qstr *filename,
const struct gfs2_inode *ip);
extern int gfs2_dir_add(struct inode *inode, const struct qstr *filename,
- const struct gfs2_inode *ip);
+ const struct gfs2_inode *ip, struct gfs2_diradd *da);
+static inline void gfs2_dir_no_add(struct gfs2_diradd *da)
+{
+ if (da->bh)
+ brelse(da->bh);
+ da->bh = NULL;
+}
extern int gfs2_dir_del(struct gfs2_inode *dip, const struct dentry *dentry);
extern int gfs2_dir_read(struct inode *inode, struct dir_context *ctx,
struct file_ra_state *f_ra);