From: Christoph Hellwig <hch@infradead.org>
To: Brian Foster <bfoster@redhat.com>
Cc: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH RFCv2 4/4] xfs: fill dirty folios on zero range of unwritten mappings
Date: Wed, 8 Jan 2025 23:26:08 -0800 [thread overview]
Message-ID: <Z396EO-6XNK9SAdW@infradead.org> (raw)
In-Reply-To: <20241213150528.1003662-5-bfoster@redhat.com>
> + struct iomap_iter *iter = container_of(iomap, struct iomap_iter, iomap);
Overly long line.
> struct xfs_inode *ip = XFS_I(inode);
> struct xfs_mount *mp = ip->i_mount;
> xfs_fileoff_t offset_fsb = XFS_B_TO_FSBT(mp, offset);
> @@ -1065,12 +1066,21 @@ xfs_buffered_write_iomap_begin(
> */
> if (flags & IOMAP_ZERO) {
> xfs_fileoff_t eof_fsb = XFS_B_TO_FSB(mp, XFS_ISIZE(ip));
> + u64 end;
>
> if (isnullstartblock(imap.br_startblock) &&
> offset_fsb >= eof_fsb)
> goto convert_delay;
> if (offset_fsb < eof_fsb && end_fsb > eof_fsb)
> end_fsb = eof_fsb;
> + if (imap.br_state == XFS_EXT_UNWRITTEN &&
> + offset_fsb < eof_fsb) {
> + xfs_trim_extent(&imap, offset_fsb, end_fsb - offset_fsb);
> + end = iomap_fill_dirty_folios(iter,
> + XFS_FSB_TO_B(mp, imap.br_startoff),
> + XFS_FSB_TO_B(mp, imap.br_blockcount));
> + end_fsb = min_t(xfs_fileoff_t, end_fsb, XFS_B_TO_FSB(mp, end));
A few more here.
But most importantly please add a comment desribing the logic behind
this in the function. It's hairy logic and not obvious from reading
the code, so explaining it will be helpful.
Splitting it into a separate helper might be useful for that, but due
to the amount of state shared with the caller that might not look all
that pretty in the end, so I'm not entirely sure about it.
prev parent reply other threads:[~2025-01-09 7:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-13 15:05 [PATCH RFCv2 0/4] iomap: zero range folio batch processing prototype Brian Foster
2024-12-13 15:05 ` [PATCH RFCv2 1/4] iomap: prep work for folio_batch support Brian Foster
2024-12-13 15:05 ` [PATCH RFCv2 2/4] iomap: optional zero range dirty folio processing Brian Foster
2025-01-09 7:20 ` Christoph Hellwig
2025-01-10 17:53 ` Brian Foster
2025-01-13 4:51 ` Christoph Hellwig
2025-01-13 14:32 ` Brian Foster
2025-01-15 5:47 ` Christoph Hellwig
2025-01-16 14:14 ` Brian Foster
2024-12-13 15:05 ` [PATCH RFCv2 3/4] xfs: always trim mapping to requested range for zero range Brian Foster
2025-01-09 7:22 ` Christoph Hellwig
2024-12-13 15:05 ` [PATCH RFCv2 4/4] xfs: fill dirty folios on zero range of unwritten mappings Brian Foster
2025-01-09 7:26 ` Christoph Hellwig [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=Z396EO-6XNK9SAdW@infradead.org \
--to=hch@infradead.org \
--cc=bfoster@redhat.com \
--cc=linux-fsdevel@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