diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2013-06-11 08:45:29 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2013-06-11 08:45:29 -0400 |
commit | 5a00f3cc978be45b9d2597851bedaa40630bc597 (patch) | |
tree | 716a1b29594e352c4c793b699331d4d57578cce9 /fs/gfs2/dir.h | |
parent | a9aefd707c65aa5a7945b3f16bd39f314aa8414d (diff) |
GFS2: Only do one directory search on create
Creation of a new inode requires a directory search in order to ensure
that we are not trying to create an inode with the same name as an
existing one. This was hidden away inside the create_ok() function.
In the case that there was an existing inode, and a lookup can be
substituted for a create (which is the case with regular files
when the O_EXCL flag is not in use) then we were doing a second
lookup in order to return the inode.
This patch merges these two lookups into one. This can be done by
passing a flag to gfs2_dir_search() to tell it to just return -EEXIST
in the cases where we don't actually want to look up the inode.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/dir.h')
-rw-r--r-- | fs/gfs2/dir.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/gfs2/dir.h b/fs/gfs2/dir.h index 98c960beab35..d3f273870b49 100644 --- a/fs/gfs2/dir.h +++ b/fs/gfs2/dir.h | |||
@@ -18,7 +18,8 @@ struct gfs2_inode; | |||
18 | struct gfs2_inum; | 18 | struct gfs2_inum; |
19 | 19 | ||
20 | extern struct inode *gfs2_dir_search(struct inode *dir, | 20 | extern struct inode *gfs2_dir_search(struct inode *dir, |
21 | const struct qstr *filename); | 21 | const struct qstr *filename, |
22 | bool fail_on_exist); | ||
22 | extern int gfs2_dir_check(struct inode *dir, const struct qstr *filename, | 23 | extern int gfs2_dir_check(struct inode *dir, const struct qstr *filename, |
23 | const struct gfs2_inode *ip); | 24 | const struct gfs2_inode *ip); |
24 | extern int gfs2_dir_add(struct inode *inode, const struct qstr *filename, | 25 | extern int gfs2_dir_add(struct inode *inode, const struct qstr *filename, |