All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: alexjlzheng@gmail.com
Cc: brauner@kernel.org, djwong@kernel.org, hch@infradead.org,
	kernel@pankajraghav.com, linux-xfs@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	yi.zhang@huawei.com, Jinliang Zheng <alexjlzheng@tencent.com>
Subject: Re: [PATCH v5 1/4] iomap: make sure iomap_adjust_read_range() are aligned with block_size
Date: Thu, 25 Sep 2025 14:59:42 -0400	[thread overview]
Message-ID: <aNWRHkLos9bM8a_8@bfoster> (raw)
In-Reply-To: <20250923042158.1196568-2-alexjlzheng@tencent.com>

On Tue, Sep 23, 2025 at 12:21:55PM +0800, alexjlzheng@gmail.com wrote:
> From: Jinliang Zheng <alexjlzheng@tencent.com>
> 
> iomap_folio_state marks the uptodate state in units of block_size, so
> it is better to check that pos and length are aligned with block_size.
> 
> Signed-off-by: Jinliang Zheng <alexjlzheng@tencent.com>
> ---
>  fs/iomap/buffered-io.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
> index fd827398afd2..ee1b2cd8a4b4 100644
> --- a/fs/iomap/buffered-io.c
> +++ b/fs/iomap/buffered-io.c
> @@ -234,6 +234,9 @@ static void iomap_adjust_read_range(struct inode *inode, struct folio *folio,
>  	unsigned first = poff >> block_bits;
>  	unsigned last = (poff + plen - 1) >> block_bits;
>  
> +	WARN_ON_ONCE(*pos & (block_size - 1));
> +	WARN_ON_ONCE(length & (block_size - 1));
> +

I thought Joanne's patch [1] enhanced this function to deal with this
sort of corner case. Is this necessary if we go that route or am I
missing something?

Brian

[1] https://lore.kernel.org/linux-fsdevel/20250922180042.1775241-1-joannelkoong@gmail.com/

>  	/*
>  	 * If the block size is smaller than the page size, we need to check the
>  	 * per-block uptodate status and adjust the offset and length if needed
> -- 
> 2.49.0
> 
> 


  reply	other threads:[~2025-09-25 18:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-23  4:21 [PATCH v5 0/4] allow partial folio write with iomap_folio_state alexjlzheng
2025-09-23  4:21 ` [PATCH v5 1/4] iomap: make sure iomap_adjust_read_range() are aligned with block_size alexjlzheng
2025-09-25 18:59   ` Brian Foster [this message]
2025-09-23  4:21 ` [PATCH v5 2/4] iomap: move iter revert case out of the unwritten branch alexjlzheng
2025-09-25 18:59   ` Brian Foster
2025-09-23  4:21 ` [PATCH v5 3/4] iomap: make iomap_write_end() return the number of written length again alexjlzheng
2025-09-25 19:00   ` Brian Foster
2025-09-23  4:21 ` [PATCH v5 4/4] iomap: don't abandon the whole copy when we have iomap_folio_state alexjlzheng
2025-09-25 19:01   ` Brian Foster

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=aNWRHkLos9bM8a_8@bfoster \
    --to=bfoster@redhat.com \
    --cc=alexjlzheng@gmail.com \
    --cc=alexjlzheng@tencent.com \
    --cc=brauner@kernel.org \
    --cc=djwong@kernel.org \
    --cc=hch@infradead.org \
    --cc=kernel@pankajraghav.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=yi.zhang@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.