xfs
[Top] [All Lists]

[PATCH] libxfs: Get Physical Sector Size instead of Logical Sector size

To: xfs@xxxxxxxxxxx
Subject: [PATCH] libxfs: Get Physical Sector Size instead of Logical Sector size
From: Carlos Maiolino <cmaiolino@xxxxxxxxxx>
Date: Thu, 24 Nov 2011 17:20:51 -0200
Cc: Carlos Maiolino <cmaiolino@xxxxxxxxxx>
xfsprogs (mainly mkfs) is using the logical sector size of a volume to 
initialize
the filesystem, which, even in devices using Advanced Format, it can get a 512
bytes sector size if it is set as the logical sector size.
This patch changes the ioctl to get the physical sector size, independent of the
logical size.

Signed-off-by: Carlos Maiolino <cmaiolino@xxxxxxxxxx>
---
 libxfs/linux.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libxfs/linux.c b/libxfs/linux.c
index 2e07d54..0bc49dd 100644
--- a/libxfs/linux.c
+++ b/libxfs/linux.c
@@ -39,6 +39,9 @@ static int max_block_alignment;
 #ifndef BLKSSZGET
 # define BLKSSZGET     _IO(0x12,104)
 #endif
+#ifndef BLKPBSZGET
+# define BLKPBSZGET _IO(0x12,123)
+#endif
 
 #ifndef RAMDISK_MAJOR
 #define RAMDISK_MAJOR  1       /* ramdisk major number */
@@ -165,7 +168,7 @@ platform_findsizes(char *path, int fd, long long *sz, int 
*bsz)
                *sz = (long long)tmpsize;
        }
 
-       if (ioctl(fd, BLKSSZGET, bsz) < 0) {
+       if (ioctl(fd, BLKPBSZGET, bsz) < 0) {
                fprintf(stderr, _("%s: warning - cannot get sector size "
                                "from block device %s: %s\n"),
                        progname, path, strerror(errno));
-- 
1.7.6.4

<Prev in Thread] Current Thread [Next in Thread>