From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org, cem@kernel.org, axboe@kernel.dk
Cc: shinichiro.kawasaki@wdc.com, linux-mm@kvack.org,
mcgrof@kernel.org, linux-fsdevel@vger.kernel.org,
linux-xfs@vger.kernel.org, willy@infradead.org,
hch@infradead.org, linux-block@vger.kernel.org
Subject: [PATCH 3/3] xfs: stop using set_blocksize
Date: Mon, 21 Apr 2025 10:19:23 -0700 [thread overview]
Message-ID: <174525589090.2138337.6822381628832847466.stgit@frogsfrogsfrogs> (raw)
In-Reply-To: <174525589013.2138337.16473045486118778580.stgit@frogsfrogsfrogs>
From: Darrick J. Wong <djwong@kernel.org>
XFS has its own buffer cache for metadata that uses submit_bio, which
means that it no longer uses the block device pagecache for anything.
Create a more lightweight helper that runs the blocksize checks and
flushes dirty data and use that instead. No more truncating the
pagecache because XFS does not use it or care about it.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
fs/xfs/xfs_buf.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 1a2b3f06fa717e..5ae77ffdc947b1 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -1719,18 +1719,25 @@ xfs_setsize_buftarg(
struct xfs_buftarg *btp,
unsigned int sectorsize)
{
+ int error;
+
/* Set up metadata sector size info */
btp->bt_meta_sectorsize = sectorsize;
btp->bt_meta_sectormask = sectorsize - 1;
- if (set_blocksize(btp->bt_bdev_file, sectorsize)) {
+ error = bdev_validate_blocksize(btp->bt_bdev, sectorsize);
+ if (error) {
xfs_warn(btp->bt_mount,
- "Cannot set_blocksize to %u on device %pg",
- sectorsize, btp->bt_bdev);
+ "Cannot use blocksize %u on device %pg, err %d",
+ sectorsize, btp->bt_bdev, error);
return -EINVAL;
}
- return 0;
+ /*
+ * Flush the block device pagecache so our bios see anything dirtied
+ * before mount.
+ */
+ return sync_blockdev(btp->bt_bdev);
}
int
next prev parent reply other threads:[~2025-04-21 17:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-21 17:18 [PATCHSET V2] block/xfs: bdev page cache bug fixes for 6.15 Darrick J. Wong
2025-04-21 17:18 ` [PATCH 1/3] block: fix race between set_blocksize and read paths Darrick J. Wong
2025-04-21 17:19 ` [PATCH 2/3] block: hoist block size validation code to a separate function Darrick J. Wong
2025-04-21 17:19 ` Darrick J. Wong [this message]
2025-04-21 20:24 ` [PATCHSET V2] block/xfs: bdev page cache bug fixes for 6.15 Jens Axboe
2025-04-21 20:26 ` Jens Axboe
2025-04-21 20:51 ` Darrick J. Wong
2025-04-21 20:53 ` Jens Axboe
2025-04-22 1:19 ` Darrick J. Wong
2025-04-21 20:57 ` Luis Chamberlain
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=174525589090.2138337.6822381628832847466.stgit@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=axboe@kernel.dk \
--cc=cem@kernel.org \
--cc=hch@infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-xfs@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=shinichiro.kawasaki@wdc.com \
--cc=willy@infradead.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