diff options
author | Darrick J. Wong <djwong@kernel.org> | 2023-09-25 14:59:10 -0700 |
---|---|---|
committer | Carlos Maiolino <cem@kernel.org> | 2023-10-05 14:57:19 +0200 |
commit | 244199cd9ae1d136cec985885e4c336145e74a26 (patch) | |
tree | 139790561d9b3f643e9919f819da205baac7ce4f | |
parent | 1e8897d53374026aa4fc76e7d70d73bac85fe668 (diff) | |
download | xfsprogs-dev-244199cd9ae1d136cec985885e4c336145e74a26.tar.gz |
libxfs: make platform_set_blocksize optional with directio
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>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
-rw-r--r-- | libxfs/init.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libxfs/init.c b/libxfs/init.c index fda36ba0f7..ce6e62cde9 100644 --- a/libxfs/init.c +++ b/libxfs/init.c @@ -125,10 +125,14 @@ retry: } 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); |