linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jinliang Zheng <alexjlzheng@gmail.com>
To: hch@infradead.org
Cc: alexjlzheng@gmail.com, alexjlzheng@tencent.com,
	brauner@kernel.org, djwong@kernel.org,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-xfs@vger.kernel.org
Subject: Re: [PATCH v2 4/4] iomap: don't abandon the whole thing with iomap_folio_state
Date: Mon, 11 Aug 2025 20:18:03 +0800	[thread overview]
Message-ID: <20250811121803.1026731-1-alexjlzheng@tencent.com> (raw)
In-Reply-To: <aJnI49GCSfILx8eE@infradead.org>

On Mon, 11 Aug 2025 03:41:39 -0700, Christoph Hellwig wrote:
> Where "the whole thing" is the current iteration in the write loop.
> Can you spell this out a bit better?

Hahaha, I was also confused about "the whole thing". I guess it refers to a
partial write in a folio. It appears in the comments of __iomap_write_end().

static bool __iomap_write_end(struct inode *inode, loff_t pos, size_t len,
		size_t copied, struct folio *folio)
{
	flush_dcache_folio(folio);

	/*
	 * The blocks that were entirely written will now be uptodate, so we
	 * don't have to worry about a read_folio reading them and overwriting a
	 * partial write.  However, if we've encountered a short write and only
	 * partially written into a block, it will not be marked uptodate, so a
	 * read_folio might come in and destroy our partial write.
	 *
	 * Do the simplest thing and just treat any short write to a
	 * non-uptodate page as a zero-length write, and force the caller to
	 * redo the whole thing.
                ^^^^^^^^^^^^^^^ <------------------ look look look, it's here :)
	 */
	if (unlikely(copied < len && !folio_test_uptodate(folio)))
		return false;
	iomap_set_range_uptodate(folio, offset_in_folio(folio, pos), len);
	iomap_set_range_dirty(folio, offset_in_folio(folio, pos), copied);
	filemap_dirty_folio(inode->i_mapping, folio);
	return true;
}

> 
> Also please include the rationale why you are changing the logic
> here in the commit log.

Hahaha, what I want to express is that we no longer need to define partial write
based on folio granularity, it is more appropriate to use block granularity.

Please forgive my poor English. :-<

thanks,
Jinliang Zheng :)


  reply	other threads:[~2025-08-11 12:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-10 10:15 [PATCH v2 0/4] iomap: allow partial folio write with iomap_folio_state alexjlzheng
2025-08-10 10:15 ` [PATCH v2 1/4] iomap: make sure iomap_adjust_read_range() are aligned with block_size alexjlzheng
2025-08-11 10:39   ` Christoph Hellwig
2025-08-12  7:24   ` Geert Uytterhoeven
2025-08-10 10:15 ` [PATCH v2 2/4] iomap: move iter revert case out of the unwritten branch alexjlzheng
2025-08-11 10:40   ` Christoph Hellwig
2025-08-10 10:15 ` [PATCH v2 3/4] iomap: make iomap_write_end() return the number of written length again alexjlzheng
2025-08-10 10:15 ` [PATCH v2 4/4] iomap: don't abandon the whole thing with iomap_folio_state alexjlzheng
2025-08-11 10:41   ` Christoph Hellwig
2025-08-11 12:18     ` Jinliang Zheng [this message]
2025-08-11 10:38 ` [PATCH v2 0/4] iomap: allow partial folio write " Christoph Hellwig
2025-08-11 12:08   ` Jinliang Zheng

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=20250811121803.1026731-1-alexjlzheng@tencent.com \
    --to=alexjlzheng@gmail.com \
    --cc=alexjlzheng@tencent.com \
    --cc=brauner@kernel.org \
    --cc=djwong@kernel.org \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.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;
as well as URLs for NNTP newsgroup(s).