mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jingbo Xu <jefflexu@linux.alibaba.com>
To: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] erofs: support SEEK_HOLE/SEEK_DATA in inode_share mode
Date: Thu, 20 Aug 2026 21:35:52 +0800	[thread overview]
Message-ID: <eb253f13-11a3-4728-b3d6-dc2c336c66cc@linux.alibaba.com> (raw)
In-Reply-To: <aocCPbxFolZd_VIk@XiangdeMacBook-Pro.local>



On 8/20/26 9:33 PM, Gao Xiang wrote:
> Hi Jingbo,
> 
> On Tue, Aug 18, 2026 at 07:37:13PM +0800, Jingbo Xu wrote:
>> When inode_share is enabled, erofs_ishare_fops.llseek falls back to
>> generic_file_llseek, which treats the whole file as data and always
>> returns i_size for SEEK_HOLE, hiding real holes in sparse files.
>>
>> Switch it to erofs_file_llseek instead.  For user files f_mapping->host
>> is always the real erofs inode, so SEEK_HOLE/SEEK_DATA resolve the
>> per-file on-disk layout via iomap_seek_hole()/iomap_seek_data().
>>
>> Reported-by: Yuanhe Shu <xiangzao@linux.alibaba.com>
>> Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
>> ---
>>  fs/erofs/data.c     | 2 +-
>>  fs/erofs/internal.h | 2 ++
>>  fs/erofs/ishare.c   | 2 +-
>>  3 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/erofs/data.c b/fs/erofs/data.c
>> index d2f01245ee79..09d668deb86d 100644
>> --- a/fs/erofs/data.c
>> +++ b/fs/erofs/data.c
>> @@ -509,7 +509,7 @@ static int erofs_file_mmap_prepare(struct vm_area_desc *desc)
>>  #define erofs_file_mmap_prepare	generic_file_readonly_mmap_prepare
>>  #endif
>>  
>> -static loff_t erofs_file_llseek(struct file *file, loff_t offset, int whence)
>> +loff_t erofs_file_llseek(struct file *file, loff_t offset, int whence)
>>  {
>>  	struct inode *inode = file->f_mapping->host;
>>  	const struct iomap_ops *ops = &erofs_iomap_ops;
>> diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
>> index 57bd21859c65..3263c11d714c 100644
>> --- a/fs/erofs/internal.h
>> +++ b/fs/erofs/internal.h
>> @@ -528,6 +528,8 @@ static inline struct inode *erofs_real_inode(struct inode *inode, bool *need_ipu
>>  }
>>  #endif
>>  
>> +loff_t erofs_file_llseek(struct file *file, loff_t offset, int whence);
>> +
> 
> Could you move this line below erofs_fiemap()? I hope all declarations
> in data.c are closer.

Sure.

> 
> Otherwise it looks good to me,
> Reviewed-by: Gao Xiang <xiang@kernel.org>
> 
> Also could you help write a test for this functionality too?

Will post the test later after posting v2.

-- 
Thanks,
Jingbo


      reply	other threads:[~2026-08-20 13:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18 11:37 Jingbo Xu
2026-08-20  3:10 ` Zhan Xusheng
2026-08-20  6:17   ` Jingbo Xu
2026-08-20 13:33 ` Gao Xiang
2026-08-20 13:35   ` Jingbo Xu [this message]

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=eb253f13-11a3-4728-b3d6-dc2c336c66cc@linux.alibaba.com \
    --to=jefflexu@linux.alibaba.com \
    --cc=chao@kernel.org \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiang@kernel.org \
    /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

all inboxes | Powered by JetHome®