[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1331155362-11132-22-git-send-email-miklos@szeredi.hu>
Date: Wed, 7 Mar 2012 22:22:38 +0100
From: Miklos Szeredi <miklos@...redi.hu>
To: viro@...IV.linux.org.uk
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
hch@...radead.org, Trond.Myklebust@...app.com, sfrench@...ba.org,
sage@...dream.net, ericvh@...il.com, mszeredi@...e.cz
Subject: [PATCH 21/25] gfs2: use i_op->atomic_create()
From: Miklos Szeredi <mszeredi@...e.cz>
GFS2 doesn't open the file in ->create, but it does check the LOOKUP_EXCL flag
in it's create function. Convert to using ->atomic_create and checking O_EXCL
so that the nameidata argument is no longer necessary.
Signed-off-by: Miklos Szeredi <mszeredi@...e.cz>
---
fs/gfs2/inode.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 5698746..203ec3c 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -754,13 +754,21 @@ fail:
* Returns: errno
*/
-static int gfs2_create(struct inode *dir, struct dentry *dentry,
- umode_t mode, struct nameidata *nd)
+static struct file *gfs2_create(struct inode *dir, struct dentry *dentry,
+ struct opendata *od, unsigned open_flag,
+ umode_t mode)
{
- int excl = 0;
- if (nd && (nd->flags & LOOKUP_EXCL))
+ int err;
+ int excl = 0; /* Why is excl not the default? */
+
+ if (od && (open_flag & O_EXCL))
excl = 1;
- return gfs2_create_inode(dir, dentry, S_IFREG | mode, 0, NULL, 0, excl);
+
+ err = gfs2_create_inode(dir, dentry, S_IFREG | mode, 0, NULL, 0, excl);
+ if (err)
+ return ERR_PTR(err);
+
+ return NULL;
}
/**
@@ -1809,7 +1817,7 @@ const struct inode_operations gfs2_file_iops = {
};
const struct inode_operations gfs2_dir_iops = {
- .create = gfs2_create,
+ .atomic_create = gfs2_create,
.lookup = gfs2_lookup,
.link = gfs2_link,
.unlink = gfs2_unlink,
--
1.7.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists