All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hongbo Li via Linux-erofs <linux-erofs@lists.ozlabs.org>
To: <linux-erofs@lists.ozlabs.org>
Subject: Re: [PATCH v3] erofs: support STATX_DIOALIGN
Date: Thu, 18 Jul 2024 16:43:26 +0800	[thread overview]
Message-ID: <9cfae641-4b87-4017-8ca4-4c46a91fce34@huawei.com> (raw)
In-Reply-To: <f91c15d1-cdd9-4b12-9143-fba6c7bf6565@linux.alibaba.com>



On 2024/7/18 16:35, Gao Xiang wrote:
> 
> 
> On 2024/7/18 16:32, Gao Xiang wrote:
>> From: Hongbo Li via Linux-erofs <linux-erofs@lists.ozlabs.org>
> 
> Also I will fix the email address issue
> (Hongbo Li <lihongbo22@huawei.com>) when applying too.
> 
>>
>> Add support for STATX_DIOALIGN to erofs, so that direct I/O
>> alignment restrictions are exposed to userspace in a generic
>> way.
>>
>> [Before]
>> ```
>> ./statx_test /mnt/erofs/testfile
>> statx(/mnt/erofs/testfile) = 0
>> dio mem align:0
>> dio offset align:0
>> ```
>>
>> [After]
>> ```
>> ./statx_test /mnt/erofs/testfile
>> statx(/mnt/erofs/testfile) = 0
>> dio mem align:512
>> dio offset align:512
>> ```
>>
>> Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
>> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
>> ---
>> Hi Hongbo,
>>
>> I tidy up the patch a bit according to the current codebase,
>> I will apply this later for this cycle.
it's ok, and thank you!

Thanks,
Hongbo
>>
>> Also r-v-bs are always welcome...
>>
>> Thanks,
>> Gao Xiang
>>
>>   fs/erofs/inode.c | 19 +++++++++++++++++--
>>   1 file changed, 17 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
>> index 5f6439a63af7..43c09aae2afc 100644
>> --- a/fs/erofs/inode.c
>> +++ b/fs/erofs/inode.c
>> @@ -334,14 +334,29 @@ int erofs_getattr(struct mnt_idmap *idmap, const 
>> struct path *path,
>>             unsigned int query_flags)
>>   {
>>       struct inode *const inode = d_inode(path->dentry);
>> +    bool compressed =
>> +        erofs_inode_is_data_compressed(EROFS_I(inode)->datalayout);
>> -    if (erofs_inode_is_data_compressed(EROFS_I(inode)->datalayout))
>> +    if (compressed)
>>           stat->attributes |= STATX_ATTR_COMPRESSED;
>> -
>>       stat->attributes |= STATX_ATTR_IMMUTABLE;
>>       stat->attributes_mask |= (STATX_ATTR_COMPRESSED |
>>                     STATX_ATTR_IMMUTABLE);
>> +    /*
>> +     * Return the DIO alignment restrictions if requested.
>> +     *
>> +     * In EROFS, STATX_DIOALIGN is not supported in ondemand mode and
>> +     * compressed files, so in these cases we report no DIO support.
>> +     */
>> +    if ((request_mask & STATX_DIOALIGN) && S_ISREG(inode->i_mode)) {
>> +        stat->result_mask |= STATX_DIOALIGN;
>> +        if (!erofs_is_fscache_mode(inode->i_sb) && !compressed) {
>> +            stat->dio_mem_align =
>> +                bdev_logical_block_size(inode->i_sb->s_bdev);
>> +            stat->dio_offset_align = stat->dio_mem_align;
>> +        }
>> +    }
>>       generic_fillattr(idmap, request_mask, inode, stat);
>>       return 0;
>>   }

  reply	other threads:[~2024-07-18  8:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-18  6:37 [PATCH v2] erofs: support STATX_DIOALIGN Hongbo Li via Linux-erofs
2024-07-18  6:37 ` Hongbo Li
2024-07-18  8:32 ` [PATCH v3] " Gao Xiang
2024-07-18  8:32   ` Gao Xiang
2024-07-18  8:35   ` Gao Xiang
2024-07-18  8:43     ` Hongbo Li via Linux-erofs [this message]
2024-07-26  9:50     ` Chao Yu

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=9cfae641-4b87-4017-8ca4-4c46a91fce34@huawei.com \
    --to=linux-erofs@lists.ozlabs.org \
    --cc=lihongbo22@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.