]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Allow the requested sector size to be set for the ioctl setting the
authorTim Shimmin <tes@sgi.com>
Fri, 6 Oct 2006 16:20:33 +0000 (16:20 +0000)
committerTim Shimmin <tes@sgi.com>
Fri, 6 Oct 2006 16:20:33 +0000 (16:20 +0000)
blocksize on the device.
Merge of master-melb:xfs-cmds:27144a by kenmcd.

  bump

VERSION
doc/CHANGES
libxfs/darwin.c
libxfs/freebsd.c
libxfs/init.c
libxfs/init.h
libxfs/irix.c
libxfs/linux.c
mkfs/xfs_mkfs.c

diff --git a/VERSION b/VERSION
index 612208390932b6e00cc388f303beb6279cc7fabc..9461c90c6a85d13ea8f7bb08809982a3ef25834f 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -3,5 +3,5 @@
 #
 PKG_MAJOR=2
 PKG_MINOR=8
-PKG_REVISION=13
+PKG_REVISION=14
 PKG_BUILD=1
index 5c390754243a110fc05cce7c559d24e751ae2e6f..a45924b72b6e1aa999e7abff7d10b761ba2c26e7 100644 (file)
@@ -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.
index 3a1e833341f799c1512321d561c26d3d29d03b18..ee93c2cbf99d9c2da4e335a7a845d2ff6adb724c 100644 (file)
@@ -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
index 1cbf7aaa9a2f59f5c87b51af02f80fc83cd606ff..883d0d604ec6d33af840df5f6f2978771f1bbf34 100644 (file)
@@ -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
index 5bb9ecf892d6c34c02247050ce3f699a195fd038..38a51007d456a6b1237dc2681f8a1e72891ef928 100644 (file)
@@ -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
index 72249926dca3f03036498e543dd77c512240d841..e0cf92d84bbece0acfeef2f32de9e33e9a4a0673 100644 (file)
@@ -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);
index a3cf647f9976fe4dcb99637240945194208d794c..081d636a4156236b948289fa0eb6403fa351ebef 100644 (file)
@@ -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
index 1d0b196cf402a5f8c6f040ff5021de45aee2b57d..de64d333db3ab98536ff705688145b6644e7c59d 100644 (file)
@@ -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
index 0042c344c6e7981a949c9c48cd2c54b6761fd2a4..98fb1adab1bcf45559b951bca90d9a328d0a97a2 100644 (file)
@@ -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.
         */