All of lore.kernel.org
 help / color / mirror / Atom feed
* LVM and XFS cannot set blocksize on block device
@ 2006-09-25 22:11 Rene Salmon
  2006-09-26  0:17 ` Chris Wedgwood
  0 siblings, 1 reply; 14+ messages in thread
From: Rene Salmon @ 2006-09-25 22:11 UTC (permalink / raw)
  To: xfs; +Cc: Rene Salmon

Hi,


I am trying to create an xfs file system on and LVM logical volume.
the actual physical drive has blocks or sectors of 4096.

when I try to make the xfs file system on top of LVM I get this message:

helix-priv:~ # mkfs.xfs -f /dev/vg_u00/lv_u00
mkfs.xfs: warning - cannot set blocksize on block device 
/dev/vg_u00/lv_u00: Invalid argument
Warning: the data subvolume sector size 512 is less than the sector size
reported by the device (4096).
meta-data=/dev/vg_u00/lv_u00     isize=256    agcount=32, 
agsize=11489280 blks
          =                       sectsz=512   attr=0
data     =                       bsize=4096   blocks=367656960, imaxpct=25
          =                       sunit=0      swidth=0 blks, unwritten=1
naming   =version 2              bsize=4096
log      =internal log           bsize=4096   blocks=32768, version=1
          =                       sectsz=512   sunit=0 blks
realtime =none                   extsz=65536  blocks=0, rtextents=0
helix-priv:~ #





any ideas?

Thanks
Rene



-- 
-
--
         Rene Salmon
         Tulane University
         Center for Computational Science
         http://www.ccs.tulane.edu
	rsalmon@tulane.edu
         Tel 504-862-8393
	Tel 504-988-8552
         Fax 504-862-8392

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: LVM and XFS cannot set blocksize on block device
  2006-09-25 22:11 LVM and XFS cannot set blocksize on block device Rene Salmon
@ 2006-09-26  0:17 ` Chris Wedgwood
  2006-09-26 13:58   ` Rene Salmon
  0 siblings, 1 reply; 14+ messages in thread
From: Chris Wedgwood @ 2006-09-26  0:17 UTC (permalink / raw)
  To: Rene Salmon; +Cc: xfs

On Mon, Sep 25, 2006 at 05:11:48PM -0500, Rene Salmon wrote:

> Warning: the data subvolume sector size 512 is less than the sector size
> reported by the device (4096).

does "-s size=4096" help?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: LVM and XFS cannot set blocksize on block device
  2006-09-26  0:17 ` Chris Wedgwood
@ 2006-09-26 13:58   ` Rene Salmon
  2006-09-26 22:40     ` Chris Wedgwood
  0 siblings, 1 reply; 14+ messages in thread
From: Rene Salmon @ 2006-09-26 13:58 UTC (permalink / raw)
  To: Chris Wedgwood; +Cc: xfs

Hi,

Thanks for the reply. The "-s size=4096" helped I was able to create
the file system, then mount it and use it.  I did however get a warning 
still about "cannot set blocksize on block device".  Everything seems to 
be working but I am a bit worried about the warning message.  Following 
is the message.  Any ideas if it is safe to ignore this or any way to 
get rid of it?




helix-priv:~ # mkfs.xfs -s size=4096 -f /dev/vg_u00/lv_u00
mkfs.xfs: warning - cannot set blocksize on block device 
/dev/vg_u00/lv_u00: Invalid argument
meta-data=/dev/vg_u00/lv_u00     isize=256    agcount=32, 
agsize=11489280 blks
          =                       sectsz=4096  attr=0
data     =                       bsize=4096   blocks=367656960, imaxpct=25
          =                       sunit=0      swidth=0 blks, unwritten=1
naming   =version 2              bsize=4096
log      =internal log           bsize=4096   blocks=32768, version=2
          =                       sectsz=4096  sunit=1 blks
realtime =none                   extsz=65536  blocks=0, rtextents=0


Thanks
Rene




Chris Wedgwood wrote:
> On Mon, Sep 25, 2006 at 05:11:48PM -0500, Rene Salmon wrote:
> 
>> Warning: the data subvolume sector size 512 is less than the sector size
>> reported by the device (4096).
> 
> does "-s size=4096" help?

-- 
-
--
         Rene Salmon
         Tulane University
         Center for Computational Science
         http://www.ccs.tulane.edu
	rsalmon@tulane.edu
         Tel 504-862-8393
	Tel 504-988-8552
         Fax 504-862-8392

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: LVM and XFS cannot set blocksize on block device
  2006-09-26 13:58   ` Rene Salmon
@ 2006-09-26 22:40     ` Chris Wedgwood
  2006-09-27 11:55       ` Shailendra Tripathi
  0 siblings, 1 reply; 14+ messages in thread
From: Chris Wedgwood @ 2006-09-26 22:40 UTC (permalink / raw)
  To: Rene Salmon; +Cc: xfs

On Tue, Sep 26, 2006 at 08:58:28AM -0500, Rene Salmon wrote:

> Thanks for the reply. The "-s size=4096" helped I was able to create
> the file system, then mount it and use it.  I did however get a
> warning still about "cannot set blocksize on block device".

I don't know much about the LVM code, my guess is that
ioctl(... ,BLKBSZSET, ...) is failing, strace would confirm this.

> Everything seems to be working but I am a bit worried about the
> warning message.  Following is the message.  Any ideas if it is safe
> to ignore this or any way to get rid of it?

What does:

  blockdev --getbsz /dev/vg_u00/lv_u00

say?


If mkfs.xfs is trying to set a blocksize that already matches the
underlying device, it woudn't be hard to silence the warning by doing
a check before unconditionally setting it, though I don't know that
it's worth it.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: LVM and XFS cannot set blocksize on block device
  2006-09-26 22:40     ` Chris Wedgwood
@ 2006-09-27 11:55       ` Shailendra Tripathi
  2006-09-27 13:16         ` Rene Salmon
                           ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Shailendra Tripathi @ 2006-09-27 11:55 UTC (permalink / raw)
  To: Chris Wedgwood; +Cc: Rene Salmon, xfs

>>Thanks for the reply. The "-s size=4096" helped I was able to create
>>the file system, then mount it and use it.  I did however get a
>>warning still about "cannot set blocksize on block device".

> 
> I don't know much about the LVM code, my guess is that
> ioctl(... ,BLKBSZSET, ...) is failing, strace would confirm this.


libxfs_device_open () seems to be working with the pre-conceived notion 
of assuming block devices of only 512 bytes in size.

if (!readonly && setblksize && (statb.st_mode & S_IFMT) == S_IFBLK)
    platform_set_blocksize(fd, path, statb.st_rdev, 512);

This eventually calls to set the blk sz to 512. Since, your volume does 
not support less than 4k, it returns EINVAL. I think, libxfs_init should 
be modified to take pass on the -s size option to this call so that it 
does not happen.
      However, I don't see any problem despite this failure. Everything 
else should work fine.




>>Everything seems to be working but I am a bit worried about the
>>warning message.  Following is the message.  Any ideas if it is safe
>>to ignore this or any way to get rid of it?
> 
> 
> What does:
> 
>   blockdev --getbsz /dev/vg_u00/lv_u00
> 
> say?
> 
> 
> If mkfs.xfs is trying to set a blocksize that already matches the
> underlying device, it woudn't be hard to silence the warning by doing
> a check before unconditionally setting it, though I don't know that
> it's worth it.
> 
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: LVM and XFS cannot set blocksize on block device
  2006-09-27 11:55       ` Shailendra Tripathi
@ 2006-09-27 13:16         ` Rene Salmon
  2006-09-28 10:33           ` Tim Shimmin
  2006-09-27 15:48         ` Eric Sandeen
                           ` (2 subsequent siblings)
  3 siblings, 1 reply; 14+ messages in thread
From: Rene Salmon @ 2006-09-27 13:16 UTC (permalink / raw)
  To: Shailendra Tripathi, Chris Wedgwood; +Cc: xfs

Hi,


Thanks for the replies.  The block size of my LV is indeed 4096

helix-priv:~ # blockdev --getbsz /dev/vg_u00/lv_u00
4096

I can mount and use the xfs file system no problems.  I have even tested
extending the LV and doing an xfs_grow and that seemed to work no 
problems.  So I take it I can safely ignore the warning.

Should I report this as a bug?  If so Can someone point me to the 
bugzilla page or something of the sorts?

Thanks
Rene



Shailendra Tripathi wrote:
>>> Thanks for the reply. The "-s size=4096" helped I was able to create
>>> the file system, then mount it and use it.  I did however get a
>>> warning still about "cannot set blocksize on block device".
> 
>>
>> I don't know much about the LVM code, my guess is that
>> ioctl(... ,BLKBSZSET, ...) is failing, strace would confirm this.
> 
> 
> libxfs_device_open () seems to be working with the pre-conceived notion 
> of assuming block devices of only 512 bytes in size.
> 
> if (!readonly && setblksize && (statb.st_mode & S_IFMT) == S_IFBLK)
>    platform_set_blocksize(fd, path, statb.st_rdev, 512);
> 
> This eventually calls to set the blk sz to 512. Since, your volume does 
> not support less than 4k, it returns EINVAL. I think, libxfs_init should 
> be modified to take pass on the -s size option to this call so that it 
> does not happen.
>      However, I don't see any problem despite this failure. Everything 
> else should work fine.
> 
> 
> 
> 
>>> Everything seems to be working but I am a bit worried about the
>>> warning message.  Following is the message.  Any ideas if it is safe
>>> to ignore this or any way to get rid of it?
>>
>>
>> What does:
>>
>>   blockdev --getbsz /dev/vg_u00/lv_u00
>>
>> say?
>>
>>
>> If mkfs.xfs is trying to set a blocksize that already matches the
>> underlying device, it woudn't be hard to silence the warning by doing
>> a check before unconditionally setting it, though I don't know that
>> it's worth it.
>>
>>

-- 
-
--
         Rene Salmon
         Tulane University
         Center for Computational Science
         http://www.ccs.tulane.edu
	rsalmon@tulane.edu
         Tel 504-862-8393
	Tel 504-988-8552
         Fax 504-862-8392

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: LVM and XFS cannot set blocksize on block device
  2006-09-27 11:55       ` Shailendra Tripathi
  2006-09-27 13:16         ` Rene Salmon
@ 2006-09-27 15:48         ` Eric Sandeen
  2006-09-28 10:23         ` Tim Shimmin
  2006-10-03  7:35         ` Timothy Shimmin
  3 siblings, 0 replies; 14+ messages in thread
From: Eric Sandeen @ 2006-09-27 15:48 UTC (permalink / raw)
  To: Shailendra Tripathi; +Cc: Chris Wedgwood, Rene Salmon, xfs

Shailendra Tripathi wrote:

> libxfs_device_open () seems to be working with the pre-conceived notion 
> of assuming block devices of only 512 bytes in size.
> 
> if (!readonly && setblksize && (statb.st_mode & S_IFMT) == S_IFBLK)
>     platform_set_blocksize(fd, path, statb.st_rdev, 512);
> 
> This eventually calls to set the blk sz to 512. Since, your volume does 
> not support less than 4k, it returns EINVAL. I think, libxfs_init should 
> be modified to take pass on the -s size option to this call so that it 
> does not happen.
>       However, I don't see any problem despite this failure. Everything 
> else should work fine.
> 

Yep, this looks to me like an oversight when the larger-sector-size
support was added.  Seems like if the device can't be set to a smaller
sector size than X, then the tools should run as if a sector size of X
had been specified?

-Eric

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: LVM and XFS cannot set blocksize on block device
  2006-09-27 11:55       ` Shailendra Tripathi
  2006-09-27 13:16         ` Rene Salmon
  2006-09-27 15:48         ` Eric Sandeen
@ 2006-09-28 10:23         ` Tim Shimmin
  2006-09-28 15:32           ` Chris Wedgwood
  2006-10-03  7:35         ` Timothy Shimmin
  3 siblings, 1 reply; 14+ messages in thread
From: Tim Shimmin @ 2006-09-28 10:23 UTC (permalink / raw)
  To: Shailendra Tripathi; +Cc: Chris Wedgwood, Rene Salmon, xfs

Shailendra Tripathi wrote:
>>> Thanks for the reply. The "-s size=4096" helped I was able to create
>>> the file system, then mount it and use it.  I did however get a
>>> warning still about "cannot set blocksize on block device".
> 
>>
>> I don't know much about the LVM code, my guess is that
>> ioctl(... ,BLKBSZSET, ...) is failing, strace would confirm this.
> 
> 
> libxfs_device_open () seems to be working with the pre-conceived notion 
> of assuming block devices of only 512 bytes in size.
> 
> if (!readonly && setblksize && (statb.st_mode & S_IFMT) == S_IFBLK)
>    platform_set_blocksize(fd, path, statb.st_rdev, 512);
> 
> This eventually calls to set the blk sz to 512. Since, your volume does 
> not support less than 4k, it returns EINVAL. I think, libxfs_init should 
> be modified to take pass on the -s size option to this call so that it 
> does not happen.
>      However, I don't see any problem despite this failure. Everything 
> else should work fine.
> 
> 
Sounds reasonable.
I'll have a look soon at passing the mkfs.xfs -s option thru to libxfs
which is consistent with the existing code.

--Tim

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: LVM and XFS cannot set blocksize on block device
  2006-09-27 13:16         ` Rene Salmon
@ 2006-09-28 10:33           ` Tim Shimmin
  0 siblings, 0 replies; 14+ messages in thread
From: Tim Shimmin @ 2006-09-28 10:33 UTC (permalink / raw)
  To: Rene Salmon; +Cc: Shailendra Tripathi, Chris Wedgwood, xfs

Hi Rene,

Rene Salmon wrote:
>
> Should I report this as a bug?

Well I know it now :)
but it is good to have a record of it.

> If so Can someone point me to the 
> bugzilla page or something of the sorts?
>

http://oss.sgi.com/bugzilla/
Product: Linux XFS.

Thanks,
--Tim

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: LVM and XFS cannot set blocksize on block device
  2006-09-28 10:23         ` Tim Shimmin
@ 2006-09-28 15:32           ` Chris Wedgwood
  2006-10-02  7:28             ` Timothy Shimmin
  0 siblings, 1 reply; 14+ messages in thread
From: Chris Wedgwood @ 2006-09-28 15:32 UTC (permalink / raw)
  To: Tim Shimmin; +Cc: Shailendra Tripathi, Rene Salmon, xfs, Eric Sandeen

On Thu, Sep 28, 2006 at 08:23:43PM +1000, Tim Shimmin wrote:

> I'll have a look soon at passing the mkfs.xfs -s option thru to
> libxfs which is consistent with the existing code.

(following up on something mentioned off the list)

When you do this change please consider *not* making the code fallback
to a different blocksize if the ioctl fails when "-s size=" is given.

The logic here is that if someone clearly wants a specific value and
if that cannot be met it should error out with a suitable message, not
silently do something else.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: LVM and XFS cannot set blocksize on block device
  2006-09-28 15:32           ` Chris Wedgwood
@ 2006-10-02  7:28             ` Timothy Shimmin
  0 siblings, 0 replies; 14+ messages in thread
From: Timothy Shimmin @ 2006-10-02  7:28 UTC (permalink / raw)
  To: Chris Wedgwood; +Cc: Shailendra Tripathi, Rene Salmon, xfs, Eric Sandeen

Chris Wedgwood wrote:
> On Thu, Sep 28, 2006 at 08:23:43PM +1000, Tim Shimmin wrote:
> 
>> I'll have a look soon at passing the mkfs.xfs -s option thru to
>> libxfs which is consistent with the existing code.
> 
> (following up on something mentioned off the list)
> 
> When you do this change please consider *not* making the code fallback
> to a different blocksize if the ioctl fails when "-s size=" is given.
> 
> The logic here is that if someone clearly wants a specific value and
> if that cannot be met it should error out with a suitable message, not
> silently do something else.

I agree.
I prefer default behaviour to happen when we are using the defaults -
so we can do fallback behaviour under the assumption the user
doesn't mind.
But when we ask for something explicitly, then do it or error out.
:)

I'd be tempted to reuse libxfs_init_t's setblksize to be 1 as it currently
is if one wants the device blksize to be set and
 >1 (really > 512 etc...) if one wants to set it to a particular value.

--Tim

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: LVM and XFS cannot set blocksize on block device
  2006-09-27 11:55       ` Shailendra Tripathi
                           ` (2 preceding siblings ...)
  2006-09-28 10:23         ` Tim Shimmin
@ 2006-10-03  7:35         ` Timothy Shimmin
  2006-10-06 20:36           ` Rene Salmon
  3 siblings, 1 reply; 14+ messages in thread
From: Timothy Shimmin @ 2006-10-03  7:35 UTC (permalink / raw)
  To: Shailendra Tripathi; +Cc: Chris Wedgwood, Rene Salmon, xfs

[-- Attachment #1: Type: text/plain, Size: 954 bytes --]

Shailendra Tripathi wrote:
>>> Thanks for the reply. The "-s size=4096" helped I was able to create
>>> the file system, then mount it and use it.  I did however get a
>>> warning still about "cannot set blocksize on block device".
> 
>>
>> I don't know much about the LVM code, my guess is that
>> ioctl(... ,BLKBSZSET, ...) is failing, strace would confirm this.
> 
> 
> libxfs_device_open () seems to be working with the pre-conceived notion 
> of assuming block devices of only 512 bytes in size.
> 
> if (!readonly && setblksize && (statb.st_mode & S_IFMT) == S_IFBLK)
>    platform_set_blocksize(fd, path, statb.st_rdev, 512);
> 
> This eventually calls to set the blk sz to 512. Since, your volume does 
> not support less than 4k, it returns EINVAL. I think, libxfs_init should 
> be modified to take pass on the -s size option to this call so that it 
> does not happen.


I've attached a patch.
Is this the sort of thing you were after?

--Tim

[-- Attachment #2: blksize.patch --]
[-- Type: text/plain, Size: 5008 bytes --]

Subject: Re: LVM and XFS cannot set blocksize on block device

Shailendra wrote:
    libxfs_device_open () seems to be working with the pre-conceived notion
    of assuming block devices of only 512 bytes in size.
    This eventually calls to set the blk sz to 512. Since, your volume does
    not support less than 4k, it returns EINVAL. I think, libxfs_init should
    be modified to pass on the -s size option to this call so that it
    does not happen.
    ...

Index: xfsprogs/libxfs/darwin.c
===================================================================
--- xfsprogs/libxfs/darwin.c.orig	2006-10-03 16:10:41.000000000 +1000
+++ xfsprogs/libxfs/darwin.c	2006-10-03 16:03:48.000000000 +1000
@@ -51,8 +51,8 @@
 	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)
 {
 }
 
Index: xfsprogs/libxfs/freebsd.c
===================================================================
--- xfsprogs/libxfs/freebsd.c.orig	2006-10-03 16:10:41.000000000 +1000
+++ xfsprogs/libxfs/freebsd.c	2006-10-03 16:03:48.000000000 +1000
@@ -91,8 +91,8 @@
 	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;
 }
Index: xfsprogs/libxfs/init.c
===================================================================
--- xfsprogs/libxfs/init.c.orig	2006-10-03 16:10:41.000000000 +1000
+++ xfsprogs/libxfs/init.c	2006-10-03 16:34:41.000000000 +1000
@@ -116,8 +116,16 @@
 		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: xfsprogs/libxfs/irix.c
===================================================================
--- xfsprogs/libxfs/irix.c.orig	2006-10-03 16:10:41.000000000 +1000
+++ xfsprogs/libxfs/irix.c	2006-10-03 16:03:48.000000000 +1000
@@ -36,8 +36,8 @@
 	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;
 }
Index: xfsprogs/libxfs/linux.c
===================================================================
--- xfsprogs/libxfs/linux.c.orig	2006-10-03 16:10:41.000000000 +1000
+++ xfsprogs/libxfs/linux.c	2006-10-03 16:03:48.000000000 +1000
@@ -102,16 +102,20 @@
 	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: xfsprogs/mkfs/xfs_mkfs.c
===================================================================
--- xfsprogs/mkfs/xfs_mkfs.c.orig	2006-10-03 16:10:41.000000000 +1000
+++ xfsprogs/mkfs/xfs_mkfs.c	2006-10-03 16:03:48.000000000 +1000
@@ -634,7 +634,6 @@
 	bzero(&fsx, sizeof(fsx));
 
 	bzero(&xi, sizeof(xi));
-	xi.setblksize = 1;
 	xi.isdirect = LIBXFS_DIRECT;
 	xi.isreadonly = LIBXFS_EXCLUSIVELY;
 
@@ -1506,6 +1505,11 @@
 	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.
 	 */
Index: xfsprogs/libxfs/init.h
===================================================================
--- xfsprogs/libxfs/init.h.orig	2006-10-03 16:10:41.000000000 +1000
+++ xfsprogs/libxfs/init.h	2006-10-03 16:03:48.000000000 +1000
@@ -25,7 +25,7 @@
 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);

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: LVM and XFS cannot set blocksize on block device
  2006-10-03  7:35         ` Timothy Shimmin
@ 2006-10-06 20:36           ` Rene Salmon
  2006-10-11  9:59             ` Timothy Shimmin
  0 siblings, 1 reply; 14+ messages in thread
From: Rene Salmon @ 2006-10-06 20:36 UTC (permalink / raw)
  To: Timothy Shimmin; +Cc: Shailendra Tripathi, Chris Wedgwood, xfs

We are currently running SLES 10 on this box.  I have called IBM and 
they submitted a bug report to Novell and LTC Bugzilla 28003.

Is this all we need to do to get the patch into maybe SLES 10 SP1?

thanks

Rene



Timothy Shimmin wrote:
> Shailendra Tripathi wrote:
>>>> Thanks for the reply. The "-s size=4096" helped I was able to create
>>>> the file system, then mount it and use it.  I did however get a
>>>> warning still about "cannot set blocksize on block device".
>>
>>>
>>> I don't know much about the LVM code, my guess is that
>>> ioctl(... ,BLKBSZSET, ...) is failing, strace would confirm this.
>>
>>
>> libxfs_device_open () seems to be working with the pre-conceived 
>> notion of assuming block devices of only 512 bytes in size.
>>
>> if (!readonly && setblksize && (statb.st_mode & S_IFMT) == S_IFBLK)
>>    platform_set_blocksize(fd, path, statb.st_rdev, 512);
>>
>> This eventually calls to set the blk sz to 512. Since, your volume 
>> does not support less than 4k, it returns EINVAL. I think, libxfs_init 
>> should be modified to take pass on the -s size option to this call so 
>> that it does not happen.
> 
> 
> I've attached a patch.
> Is this the sort of thing you were after?
> 
> --Tim
> 
> 
> ------------------------------------------------------------------------
> 
> Subject: Re: LVM and XFS cannot set blocksize on block device
> 
> Shailendra wrote:
>     libxfs_device_open () seems to be working with the pre-conceived notion
>     of assuming block devices of only 512 bytes in size.
>     This eventually calls to set the blk sz to 512. Since, your volume does
>     not support less than 4k, it returns EINVAL. I think, libxfs_init should
>     be modified to pass on the -s size option to this call so that it
>     does not happen.
>     ...
> 
> Index: xfsprogs/libxfs/darwin.c
> ===================================================================
> --- xfsprogs/libxfs/darwin.c.orig	2006-10-03 16:10:41.000000000 +1000
> +++ xfsprogs/libxfs/darwin.c	2006-10-03 16:03:48.000000000 +1000
> @@ -51,8 +51,8 @@
>  	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)
>  {
>  }
>  
> Index: xfsprogs/libxfs/freebsd.c
> ===================================================================
> --- xfsprogs/libxfs/freebsd.c.orig	2006-10-03 16:10:41.000000000 +1000
> +++ xfsprogs/libxfs/freebsd.c	2006-10-03 16:03:48.000000000 +1000
> @@ -91,8 +91,8 @@
>  	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;
>  }
> Index: xfsprogs/libxfs/init.c
> ===================================================================
> --- xfsprogs/libxfs/init.c.orig	2006-10-03 16:10:41.000000000 +1000
> +++ xfsprogs/libxfs/init.c	2006-10-03 16:34:41.000000000 +1000
> @@ -116,8 +116,16 @@
>  		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: xfsprogs/libxfs/irix.c
> ===================================================================
> --- xfsprogs/libxfs/irix.c.orig	2006-10-03 16:10:41.000000000 +1000
> +++ xfsprogs/libxfs/irix.c	2006-10-03 16:03:48.000000000 +1000
> @@ -36,8 +36,8 @@
>  	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;
>  }
> Index: xfsprogs/libxfs/linux.c
> ===================================================================
> --- xfsprogs/libxfs/linux.c.orig	2006-10-03 16:10:41.000000000 +1000
> +++ xfsprogs/libxfs/linux.c	2006-10-03 16:03:48.000000000 +1000
> @@ -102,16 +102,20 @@
>  	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: xfsprogs/mkfs/xfs_mkfs.c
> ===================================================================
> --- xfsprogs/mkfs/xfs_mkfs.c.orig	2006-10-03 16:10:41.000000000 +1000
> +++ xfsprogs/mkfs/xfs_mkfs.c	2006-10-03 16:03:48.000000000 +1000
> @@ -634,7 +634,6 @@
>  	bzero(&fsx, sizeof(fsx));
>  
>  	bzero(&xi, sizeof(xi));
> -	xi.setblksize = 1;
>  	xi.isdirect = LIBXFS_DIRECT;
>  	xi.isreadonly = LIBXFS_EXCLUSIVELY;
>  
> @@ -1506,6 +1505,11 @@
>  	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.
>  	 */
> Index: xfsprogs/libxfs/init.h
> ===================================================================
> --- xfsprogs/libxfs/init.h.orig	2006-10-03 16:10:41.000000000 +1000
> +++ xfsprogs/libxfs/init.h	2006-10-03 16:03:48.000000000 +1000
> @@ -25,7 +25,7 @@
>  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);

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: LVM and XFS cannot set blocksize on block device
  2006-10-06 20:36           ` Rene Salmon
@ 2006-10-11  9:59             ` Timothy Shimmin
  0 siblings, 0 replies; 14+ messages in thread
From: Timothy Shimmin @ 2006-10-11  9:59 UTC (permalink / raw)
  To: Rene Salmon; +Cc: Shailendra Tripathi, Chris Wedgwood, xfs

Hi Rene,

--On 6 October 2006 3:36:49 PM -0500 Rene Salmon <rsalmon@tulane.edu> wrote:
> We are currently running SLES 10 on this box.  I have called IBM and they
> submitted a bug report to Novell and LTC Bugzilla 28003.
Ok.

>
> Is this all we need to do to get the patch into maybe SLES 10 SP1?
>
We will have an xfsprogs update (which will include this fix
amongst others) for sles10 sp1.

Cheers,
Tim.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2006-10-11 10:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-25 22:11 LVM and XFS cannot set blocksize on block device Rene Salmon
2006-09-26  0:17 ` Chris Wedgwood
2006-09-26 13:58   ` Rene Salmon
2006-09-26 22:40     ` Chris Wedgwood
2006-09-27 11:55       ` Shailendra Tripathi
2006-09-27 13:16         ` Rene Salmon
2006-09-28 10:33           ` Tim Shimmin
2006-09-27 15:48         ` Eric Sandeen
2006-09-28 10:23         ` Tim Shimmin
2006-09-28 15:32           ` Chris Wedgwood
2006-10-02  7:28             ` Timothy Shimmin
2006-10-03  7:35         ` Timothy Shimmin
2006-10-06 20:36           ` Rene Salmon
2006-10-11  9:59             ` Timothy Shimmin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.