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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs


[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux