From: Tim Shimmin Date: Fri, 6 Oct 2006 16:20:33 +0000 (+0000) Subject: Allow the requested sector size to be set for the ioctl setting the X-Git-Tag: v2.9.0~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=edd45774fcf31cb7a5acf650b5864aedff8de6c3;p=thirdparty%2Fxfsprogs-dev.git Allow the requested sector size to be set for the ioctl setting the blocksize on the device. Merge of master-melb:xfs-cmds:27144a by kenmcd. bump --- diff --git a/VERSION b/VERSION index 612208390..9461c90c6 100644 --- a/VERSION +++ b/VERSION @@ -3,5 +3,5 @@ # PKG_MAJOR=2 PKG_MINOR=8 -PKG_REVISION=13 +PKG_REVISION=14 PKG_BUILD=1 diff --git a/doc/CHANGES b/doc/CHANGES index 5c3907542..a45924b72 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,6 +1,11 @@ -xfsprogs-2.8.xx (??) +xfsprogs-2.8.14 (6 October 2006) - Fix up the ring command in xfs_db, thanks to Utako Kusaka + - Set the blocksize on the device to the given sector + size which is _not_ necessarily 512 bytes; + idea suggested by Shailendra Tripathi. + - Fix up xfs_copy and its variable argument handling + around vfprintf; xfs_copy was seg faulting on x86_64. xfsprogs-2.8.13 (21 September 2006) - Fix v2 directory checking with holes and unreadable blocks. diff --git a/libxfs/darwin.c b/libxfs/darwin.c index 3a1e83334..ee93c2cbf 100644 --- a/libxfs/darwin.c +++ b/libxfs/darwin.c @@ -51,9 +51,10 @@ platform_check_iswritable(char *name, char *block, struct stat64 *s, int fatal) return (writable == 0); } -void -platform_set_blocksize(int fd, char *path, dev_t device, int blocksize) +int +platform_set_blocksize(int fd, char *path, dev_t device, int blocksize, int fatal) { + return fatal; } void diff --git a/libxfs/freebsd.c b/libxfs/freebsd.c index 1cbf7aaa9..883d0d604 100644 --- a/libxfs/freebsd.c +++ b/libxfs/freebsd.c @@ -91,10 +91,10 @@ platform_check_iswritable(char *name, char *block, struct stat64 *s, int fatal) return 0; } -void -platform_set_blocksize(int fd, char *path, dev_t device, int blocksize) +int +platform_set_blocksize(int fd, char *path, dev_t device, int blocksize, int fatal) { - return; + return fatal; } void diff --git a/libxfs/init.c b/libxfs/init.c index 5bb9ecf89..38a51007d 100644 --- a/libxfs/init.c +++ b/libxfs/init.c @@ -116,8 +116,16 @@ retry: exit(1); } - if (!readonly && setblksize && (statb.st_mode & S_IFMT) == S_IFBLK) - platform_set_blocksize(fd, path, statb.st_rdev, 512); + if (!readonly && setblksize && (statb.st_mode & S_IFMT) == S_IFBLK) { + if (setblksize == 1) + /* use the default blocksize */ + (void)platform_set_blocksize(fd, path, statb.st_rdev, XFS_MIN_SECTORSIZE, 0); + else { + /* given an explicit blocksize to use */ + if (platform_set_blocksize(fd, path, statb.st_rdev, setblksize, 1)) + exit(1); + } + } /* * Get the device number from the stat buf - unless diff --git a/libxfs/init.h b/libxfs/init.h index 72249926d..e0cf92d84 100644 --- a/libxfs/init.h +++ b/libxfs/init.h @@ -25,7 +25,7 @@ extern int platform_check_ismounted (char *path, char *block, extern int platform_check_iswritable (char *path, char *block, struct stat64 *sptr, int fatal); extern void platform_findsizes (char *path, int fd, long long *sz, int *bsz); -extern void platform_set_blocksize (int fd, char *path, dev_t device, int bsz); +extern int platform_set_blocksize (int fd, char *path, dev_t device, int bsz, int fatal); extern void platform_flush_device (int fd, dev_t device); extern char *platform_findrawpath(char *path); extern char *platform_findrawpath (char *path); diff --git a/libxfs/irix.c b/libxfs/irix.c index a3cf647f9..081d636a4 100644 --- a/libxfs/irix.c +++ b/libxfs/irix.c @@ -36,10 +36,10 @@ platform_check_iswritable(char *name, char *block, struct stat64 *s, int fatal) return 1; } -void -platform_set_blocksize(int fd, char *path, dev_t device, int blocksize) +int +platform_set_blocksize(int fd, char *path, dev_t device, int blocksize, int fatal) { - return; + return fatal; } void diff --git a/libxfs/linux.c b/libxfs/linux.c index 1d0b196cf..de64d333d 100644 --- a/libxfs/linux.c +++ b/libxfs/linux.c @@ -102,16 +102,20 @@ platform_check_iswritable(char *name, char *block, struct stat64 *s, int fatal) return sts; } -void -platform_set_blocksize(int fd, char *path, dev_t device, int blocksize) +int +platform_set_blocksize(int fd, char *path, dev_t device, int blocksize, int fatal) { + int error = 0; + if (major(device) != RAMDISK_MAJOR) { - if (ioctl(fd, BLKBSZSET, &blocksize) < 0) { - fprintf(stderr, _("%s: warning - cannot set blocksize " + if ((error = ioctl(fd, BLKBSZSET, &blocksize)) < 0) { + fprintf(stderr, _("%s: %s - cannot set blocksize " "on block device %s: %s\n"), - progname, path, strerror(errno)); + progname, fatal ? "error": "warning", + path, strerror(errno)); } } + return error; } void diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 0042c344c..98fb1adab 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -634,7 +634,6 @@ main( bzero(&fsx, sizeof(fsx)); bzero(&xi, sizeof(xi)); - xi.setblksize = 1; xi.isdirect = LIBXFS_DIRECT; xi.isreadonly = LIBXFS_EXCLUSIVELY; @@ -1506,6 +1505,11 @@ main( calc_stripe_factors(dsu, dsw, sectorsize, lsu, lsectorsize, &dsunit, &dswidth, &lsunit); + if (slflag || ssflag) + xi.setblksize = sectorsize; + else + xi.setblksize = 1; + /* * Initialize. This will open the log and rt devices as well. */