* [PATCH] iomap: Rename iomap_last_written_block to iomap_first_unchanged_block
@ 2025-03-27 5:57 Chi Zhiling
2025-03-27 10:35 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Chi Zhiling @ 2025-03-27 5:57 UTC (permalink / raw)
To: cem, djwong, brauner; +Cc: linux-xfs, linux-kernel, linux-fsdevel, Chi Zhiling
From: Chi Zhiling <chizhiling@kylinos.cn>
This renames iomap_last_written_block() to iomap_first_unchanged_block()
to better reflect its actual behavior of finding the first unmodified
block after partial writes, improving code readability.
Signed-off-by: Chi Zhiling <chizhiling@kylinos.cn>
---
fs/xfs/xfs_iomap.c | 2 +-
include/linux/iomap.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 5dd0922fe2d1..d4b0358015ab 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -1277,7 +1277,7 @@ xfs_buffered_write_iomap_end(
return 0;
/* Nothing to do if we've written the entire delalloc extent */
- start_byte = iomap_last_written_block(inode, offset, written);
+ start_byte = iomap_first_unchanged_block(inode, offset, written);
end_byte = round_up(offset + length, i_blocksize(inode));
if (start_byte >= end_byte)
return 0;
diff --git a/include/linux/iomap.h b/include/linux/iomap.h
index 2de7a5e7d67d..88d0da23426c 100644
--- a/include/linux/iomap.h
+++ b/include/linux/iomap.h
@@ -308,7 +308,7 @@ static inline const struct iomap *iomap_iter_srcmap(const struct iomap_iter *i)
* If nothing was written, round @pos down to point at the first block in
* the range, else round up to include the partially written block.
*/
-static inline loff_t iomap_last_written_block(struct inode *inode, loff_t pos,
+static inline loff_t iomap_first_unchanged_block(struct inode *inode, loff_t pos,
ssize_t written)
{
if (unlikely(!written))
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iomap: Rename iomap_last_written_block to iomap_first_unchanged_block
2025-03-27 5:57 [PATCH] iomap: Rename iomap_last_written_block to iomap_first_unchanged_block Chi Zhiling
@ 2025-03-27 10:35 ` Christoph Hellwig
2025-03-27 11:46 ` Chi Zhiling
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2025-03-27 10:35 UTC (permalink / raw)
To: Chi Zhiling
Cc: cem, djwong, brauner, linux-xfs, linux-kernel, linux-fsdevel,
Chi Zhiling
On Thu, Mar 27, 2025 at 01:57:06PM +0800, Chi Zhiling wrote:
> From: Chi Zhiling <chizhiling@kylinos.cn>
>
> This renames iomap_last_written_block() to iomap_first_unchanged_block()
> to better reflect its actual behavior of finding the first unmodified
> block after partial writes, improving code readability.
Does it? I it used in the context of a write operation where uncached
is not exactly well define. I'm not a native speaker, but I don't see
an improvement here (then again I picked the current name, so I might be
biassed).
> +static inline loff_t iomap_first_unchanged_block(struct inode *inode, loff_t pos,
Either way please avoid the overly long line.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iomap: Rename iomap_last_written_block to iomap_first_unchanged_block
2025-03-27 10:35 ` Christoph Hellwig
@ 2025-03-27 11:46 ` Chi Zhiling
0 siblings, 0 replies; 3+ messages in thread
From: Chi Zhiling @ 2025-03-27 11:46 UTC (permalink / raw)
To: Christoph Hellwig
Cc: cem, djwong, brauner, linux-xfs, linux-kernel, linux-fsdevel,
Chi Zhiling
On 2025/3/27 18:35, Christoph Hellwig wrote:
> On Thu, Mar 27, 2025 at 01:57:06PM +0800, Chi Zhiling wrote:
>> From: Chi Zhiling <chizhiling@kylinos.cn>
>>
>> This renames iomap_last_written_block() to iomap_first_unchanged_block()
>> to better reflect its actual behavior of finding the first unmodified
>> block after partial writes, improving code readability.
>
> Does it? I it used in the context of a write operation where uncached
> is not exactly well define. I'm not a native speaker, but I don't see
> an improvement here (then again I picked the current name, so I might be
> biassed).
Okay, actually 'last_written_block' also makes sense, it's just that it
returns the end of the last written block, not the beginning
thanks,
Chi Zhiling
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-27 11:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-27 5:57 [PATCH] iomap: Rename iomap_last_written_block to iomap_first_unchanged_block Chi Zhiling
2025-03-27 10:35 ` Christoph Hellwig
2025-03-27 11:46 ` Chi Zhiling
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).