public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Rene Salmon <rsalmon@tulane.edu>
To: Timothy Shimmin <tes@sgi.com>
Cc: Shailendra Tripathi <stripathi@agami.com>,
	Chris Wedgwood <cw@f00f.org>,
	xfs@oss.sgi.com
Subject: Re: LVM and XFS cannot set blocksize on block device
Date: Fri, 06 Oct 2006 15:36:49 -0500	[thread overview]
Message-ID: <4526BE61.8020305@tulane.edu> (raw)
In-Reply-To: <452212CB.60103@sgi.com>

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);

  reply	other threads:[~2006-10-06 21:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2006-10-11  9:59             ` Timothy Shimmin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4526BE61.8020305@tulane.edu \
    --to=rsalmon@tulane.edu \
    --cc=cw@f00f.org \
    --cc=stripathi@agami.com \
    --cc=tes@sgi.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox