xfs
[Top] [All Lists]

Re: [PATCH 4/5] xfs: add a new method xfs_vn_tmpfile()

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 4/5] xfs: add a new method xfs_vn_tmpfile()
From: Zhi Yong Wu <zwu.kernel@xxxxxxxxx>
Date: Sat, 14 Dec 2013 01:32:08 +0800
Cc: xfstests <xfs@xxxxxxxxxxx>, "linux-fsdevel@xxxxxxxxxxxxxxx" <linux-fsdevel@xxxxxxxxxxxxxxx>, Zhi Yong Wu <wuzhy@xxxxxxxxxxxxxxxxxx>, linux-kernel mlist <linux-kernel@xxxxxxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=16LsZ9iw0ncRoDNONsz18+eteDyX+V7CwqsASIyNSLY=; b=i2jL0QSLufauom5MYuZNkKGJYdvhVOgj6Pm4KsPuEdCYDN6L06fbJBXw9ZOPv4LaKv MXqO79mLRyi61v9k98lMvVCPlk81mZ6wSBhOYU7bxhX54/3YCC4908ojz+c/Wu1bfdIO q08kUL6CRKlUh3uYjDIt++T/maxnZaqZ1X7scSQ/1zzvMXv8ki+U9d6CTfJSZHKkQygU AmZnJkbOgLybYUgK8wWvhaNlxIdrtDo/K4UD3e/J7/HS8AUwPanxSghu6q1q+8+ENvGW +iBZ8CHt7UQajtiMSLiRR6ESsP3pMJkBexk3jNW4A4SIU9/GMfjSaCHWrprA6tmC+K2v 7hdg==
In-reply-to: <20131213163916.GG20803@xxxxxxxxxxxxx>
References: <1386944873-16796-1-git-send-email-zwu.kernel@xxxxxxxxx> <1386944873-16796-5-git-send-email-zwu.kernel@xxxxxxxxx> <20131213163916.GG20803@xxxxxxxxxxxxx>
On Sat, Dec 14, 2013 at 12:39 AM, Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
> On Fri, Dec 13, 2013 at 10:27:52PM +0800, Zhi Yong Wu wrote:
>> From: Zhi Yong Wu <wuzhy@xxxxxxxxxxxxxxxxxx>
>>
>> Add a new O_TMPFILE method to VFS inteface.
>> For more info, please refer to:
>>   http://oss.sgi.com/archives/xfs/2013-08/msg00336.html
>>
>> Signed-off-by: Zhi Yong Wu <wuzhy@xxxxxxxxxxxxxxxxxx>
>> ---
>>  fs/xfs/xfs_iops.c |   22 ++++++++++++++++++++++
>>  1 files changed, 22 insertions(+), 0 deletions(-)
>>
>> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
>> index eb55be5..b57cd89 100644
>> --- a/fs/xfs/xfs_iops.c
>> +++ b/fs/xfs/xfs_iops.c
>> @@ -39,6 +39,7 @@
>>  #include "xfs_da_btree.h"
>>  #include "xfs_dir2_priv.h"
>>  #include "xfs_dinode.h"
>> +#include "xfs_trans_space.h"
>>
>>  #include <linux/capability.h>
>>  #include <linux/xattr.h>
>> @@ -1051,6 +1052,25 @@ xfs_vn_fiemap(
>>       return 0;
>>  }
>>
>> +STATIC int
>> +xfs_vn_tmpfile(
>> +     struct inode    *dir,
>> +     struct dentry   *dentry,
>> +     umode_t         mode)
>> +{
>> +     struct xfs_inode *ip = NULL;
>> +     int             error;
>> +
>> +     error = xfs_create_tmpfile(XFS_I(dir), XFS_I(dir)->i_mount,
>
> No need to pass in the mount point here, the client can get it easily.
>
>> +                             mode, 0, &ip);
>
> Also no need for an always-zero argument.
Fixed, thanks.
>
>> +     if (error)
>> +             return -error;
>> +
>> +     d_instantiate(dentry, VFS_I(ip));
>
> Shouldn't this be a call to d_tmpfile() instead?
Yes, then it need to be called in xfs_create_tmpfile() just before
xfs_iunlink() is called.
>
> Also I'd suggest mergin this into the previous patch, so that we have
> one that actually adds O_TMPFILE support, and once place to write a nice
Merged them, thanks.
> good changelog.



-- 
Regards,

Zhi Yong Wu

<Prev in Thread] Current Thread [Next in Thread>