The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Chao Yu <yuchao0@huawei.com>
To: Gao Xiang <gaoxiang25@huawei.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	<devel@driverdev.osuosl.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	<linux-erofs@lists.ozlabs.org>, "Chao Yu" <chao@kernel.org>,
	Miao Xie <miaoxie@huawei.com>, <weidu.du@huawei.com>,
	Fang Wei <fangwei1@huawei.com>
Subject: Re: [PATCH 1/2] staging: erofs: support statx
Date: Tue, 28 May 2019 10:44:55 +0800	[thread overview]
Message-ID: <2f6e75f8-ff82-7472-54ff-8c0648e8f075@huawei.com> (raw)
In-Reply-To: <20190528023147.94117-1-gaoxiang25@huawei.com>

On 2019/5/28 10:31, Gao Xiang wrote:
> statx() has already been supported in commit a528d35e8bfc
> ("statx: Add a system call to make enhanced file info available"),
> user programs can get more useful attributes.
> 
> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
> ---
>  drivers/staging/erofs/inode.c    | 18 ++++++++++++++++++
>  drivers/staging/erofs/internal.h |  2 ++
>  drivers/staging/erofs/namei.c    |  1 +
>  3 files changed, 21 insertions(+)
> 
> diff --git a/drivers/staging/erofs/inode.c b/drivers/staging/erofs/inode.c
> index c7d3b815a798..8da144943ed6 100644
> --- a/drivers/staging/erofs/inode.c
> +++ b/drivers/staging/erofs/inode.c
> @@ -285,7 +285,23 @@ struct inode *erofs_iget(struct super_block *sb,
>  	return inode;
>  }
>  
> +int erofs_getattr(const struct path *path, struct kstat *stat,
> +		  u32 request_mask, unsigned int query_flags)
> +{
> +	struct inode *const inode = d_inode(path->dentry);
> +	struct erofs_vnode *const vi = EROFS_V(inode);
> +
> +	if (vi->data_mapping_mode == EROFS_INODE_LAYOUT_COMPRESSION)
> +		stat->attributes |= STATX_ATTR_COMPRESSED;
> +
> +	stat->attributes |= STATX_ATTR_IMMUTABLE;

Xiang,

Should update stat->attributes_mask as well to indicate all erofs supported
attributes bits.

Thanks,

> +
> +	generic_fillattr(inode, stat);
> +	return 0;
> +}
> +
>  const struct inode_operations erofs_generic_iops = {
> +	.getattr = erofs_getattr,
>  #ifdef CONFIG_EROFS_FS_XATTR
>  	.listxattr = erofs_listxattr,
>  #endif
> @@ -294,6 +310,7 @@ const struct inode_operations erofs_generic_iops = {
>  
>  const struct inode_operations erofs_symlink_iops = {
>  	.get_link = page_get_link,
> +	.getattr = erofs_getattr,
>  #ifdef CONFIG_EROFS_FS_XATTR
>  	.listxattr = erofs_listxattr,
>  #endif
> @@ -302,6 +319,7 @@ const struct inode_operations erofs_symlink_iops = {
>  
>  const struct inode_operations erofs_fast_symlink_iops = {
>  	.get_link = simple_get_link,
> +	.getattr = erofs_getattr,
>  #ifdef CONFIG_EROFS_FS_XATTR
>  	.listxattr = erofs_listxattr,
>  #endif
> diff --git a/drivers/staging/erofs/internal.h b/drivers/staging/erofs/internal.h
> index c47778b3fabd..911333cdeef4 100644
> --- a/drivers/staging/erofs/internal.h
> +++ b/drivers/staging/erofs/internal.h
> @@ -556,6 +556,8 @@ static inline bool is_inode_fast_symlink(struct inode *inode)
>  }
>  
>  struct inode *erofs_iget(struct super_block *sb, erofs_nid_t nid, bool dir);
> +int erofs_getattr(const struct path *path, struct kstat *stat,
> +		  u32 request_mask, unsigned int query_flags);
>  
>  /* namei.c */
>  extern const struct inode_operations erofs_dir_iops;
> diff --git a/drivers/staging/erofs/namei.c b/drivers/staging/erofs/namei.c
> index d8d9dc9dab43..fd3ae78d0ba5 100644
> --- a/drivers/staging/erofs/namei.c
> +++ b/drivers/staging/erofs/namei.c
> @@ -247,6 +247,7 @@ static struct dentry *erofs_lookup(struct inode *dir,
>  
>  const struct inode_operations erofs_dir_iops = {
>  	.lookup = erofs_lookup,
> +	.getattr = erofs_getattr,
>  #ifdef CONFIG_EROFS_FS_XATTR
>  	.listxattr = erofs_listxattr,
>  #endif
> 

  parent reply	other threads:[~2019-05-28  2:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-28  2:31 [PATCH 1/2] staging: erofs: support statx Gao Xiang
2019-05-28  2:31 ` [PATCH 2/2] staging: erofs: fix i_blocks calculation Gao Xiang
2019-05-28  2:36   ` [PATCH v2 " Gao Xiang
2019-05-28  3:02     ` Chao Yu
2019-05-28  3:23       ` Gao Xiang
2019-05-28  6:57       ` Dan Carpenter
2019-05-28  7:16         ` Gao Xiang
2019-05-28  9:45         ` Chao Yu
2019-05-28  3:19   ` [PATCH v3 1/2] staging: erofs: support statx Gao Xiang
2019-05-28  3:19     ` [PATCH v3 2/2] staging: erofs: fix i_blocks calculation Gao Xiang
2019-05-28  3:28       ` Chao Yu
2019-05-28  3:28     ` [PATCH v3 1/2] staging: erofs: support statx Chao Yu
2019-05-28  2:44 ` Chao Yu [this message]
2019-05-28  2:49   ` [PATCH " Gao Xiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2f6e75f8-ff82-7472-54ff-8c0648e8f075@huawei.com \
    --to=yuchao0@huawei.com \
    --cc=chao@kernel.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=fangwei1@huawei.com \
    --cc=gaoxiang25@huawei.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miaoxie@huawei.com \
    --cc=weidu.du@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox