All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org, cem@kernel.org
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 1/2] libxfs: make platform_set_blocksize optional with directio
Date: Mon, 25 Sep 2023 14:59:10 -0700	[thread overview]
Message-ID: <169567915037.2320255.8793397462845978368.stgit@frogsfrogsfrogs> (raw)
In-Reply-To: <169567914468.2320255.9161174588218371786.stgit@frogsfrogsfrogs>

From: Darrick J. Wong <djwong@kernel.org>

If we're accessing the block device with directio (and hence bypassing
the page cache), then don't fail on BLKBSZSET not working.  We don't
care what happens to the pagecache bufferheads.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 libxfs/init.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)


diff --git a/libxfs/init.c b/libxfs/init.c
index fda36ba0f7d..ce6e62cde94 100644
--- a/libxfs/init.c
+++ b/libxfs/init.c
@@ -125,10 +125,14 @@ libxfs_device_open(char *path, int creat, int xflags, int setblksize)
 	}
 
 	if (!readonly && setblksize && (statb.st_mode & S_IFMT) == S_IFBLK) {
-		if (setblksize == 1)
+		if (setblksize == 1) {
 			/* use the default blocksize */
 			(void)platform_set_blocksize(fd, path, statb.st_rdev, XFS_MIN_SECTORSIZE, 0);
-		else {
+		} else if (dio) {
+			/* try to use the given explicit blocksize */
+			(void)platform_set_blocksize(fd, path, statb.st_rdev,
+					setblksize, 0);
+		} else {
 			/* given an explicit blocksize to use */
 			if (platform_set_blocksize(fd, path, statb.st_rdev, setblksize, 1))
 			    exit(1);


  reply	other threads:[~2023-09-25 21:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <KT7JxvGZnq9-QNN8kBpbKekDJ2BKLQOGCjpSETPSGhPryNhXo_L71VZTCaXaI2AY3cjBINdJO97ZbUCOOYZSeg==@protonmail.internalid>
2023-09-25 21:59 ` [PATCHSET 0/2] xfs_db: use directio for filesystem access Darrick J. Wong
2023-09-25 21:59   ` Darrick J. Wong [this message]
2023-09-25 21:59   ` [PATCH 2/2] xfs_db: use directio for device access Darrick J. Wong
2024-01-17 18:30     ` Christoph Hellwig
2024-01-18  1:32       ` Darrick J. Wong
2024-01-18  4:21         ` Christoph Hellwig
2024-01-19  0:52           ` Darrick J. Wong
2023-10-03 11:47   ` [PATCHSET 0/2] xfs_db: use directio for filesystem access Carlos Maiolino

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=169567915037.2320255.8793397462845978368.stgit@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=cem@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 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.