public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: Christoph Hellwig <hch@infradead.org>
Cc: Eric Sandeen <sandeen@redhat.com>, xfs-oss <xfs@oss.sgi.com>
Subject: Re: [PATCH V2] mkfs: handle 4k sector devices more cleanly
Date: Fri, 08 Jan 2010 11:51:56 -0600	[thread overview]
Message-ID: <4B4770BC.4050306@sandeen.net> (raw)
In-Reply-To: <20100108174400.GA17634@infradead.org>

Christoph Hellwig wrote:
> On Fri, Jan 08, 2010 at 10:46:41AM -0600, Eric Sandeen wrote:
>> +extern void platform_findsizes (char *path, int fd, long long *sz, int *bsz);
> 
> Can you move the prototype from libxfs/init.h to include/libxfs.h
> instead of adding it to the .c file?

sure, heh, you know - I knew that was a bad idea ;)

>> +	/*
>> +	 * MD wants sector size set == block size to avoid switching.
>> +	 * Otherwise, if not specfied via command, use device sectorsize
>> +	 */
>> +	if (ft.sectoralign || !ssflag) {
>> +		if (ft.sectoralign)
>> +			sectorsize = blocksize;
>> +		else
>> +			sectorsize = ft.sectorsize;
> 
> This still confuses the heck out of me. What do you think about the
> incremental patch at the end of the mail?

yeah, that seems good.

>>  	if (slflag || ssflag)
>>  		xi.setblksize = sectorsize;
>> -	else
>> -		xi.setblksize = 1;
> 
> So for the defaul case we now never set the sector size in the libxfs
> init.  This seems safe to me, but why did we do it before?  Could
> a previous user have left it set to a wrong value?
> 
> Maye we should just do the xi.setblksize = sectorsize unconditionally?

ugh this stuff is messy.

let me see what sectorsize's default is...

If we take out the "1 is special" stuff I should probably chase it through
all the code.

Ok, will give this one more crack :)

Thanks,
-Eric

> 
> Index: xfsprogs-dev/mkfs/xfs_mkfs.c
> ===================================================================
> --- xfsprogs-dev.orig/mkfs/xfs_mkfs.c	2010-01-08 18:33:53.619277529 +0100
> +++ xfsprogs-dev/mkfs/xfs_mkfs.c	2010-01-08 18:39:37.758005711 +0100
> @@ -1561,21 +1561,32 @@ main(
>  	memset(&ft, 0, sizeof(ft));
>  	get_topology(&xi, &ft);
>  
> -	/*
> -	 * MD wants sector size set == block size to avoid switching.
> -	 * Otherwise, if not specfied via command, use device sectorsize
> -	 */
> +	if (ft.sectoralign) {
> +		/*
> +		 * Older Linux software RAID versions want the sector size
> +		 * to match the block size to avoid switching I/O sizes.
> +		 * For the legacy libdisk case we thus set the sector size to
> +		 * match the block size.  For systems using libblkid we assume
> +		 * that the kernel is recent enough to not require this and
> +		 * ft.sectoralign will never be set.
> +		 */
> +		sectorsize = blocksize;
> +	} else if (!ssflag) {
> +		/*
> +		 * Unless specified manually on the command line use the
> +		 * advertised sector size of the device.
> +		 */
> +		sectorsize = ft.sectorsize;
> +	}
> +
>  	if (ft.sectoralign || !ssflag) {
> -		if (ft.sectoralign)
> -			sectorsize = blocksize;
> -		else
> -			sectorsize = ft.sectorsize;
>  		sectorlog = libxfs_highbit32(sectorsize);
>  		if (loginternal) {
>  			lsectorsize = sectorsize;
>  			lsectorlog = sectorlog;
>  		}
>  	}
> +
>  	if (sectorsize < XFS_MIN_SECTORSIZE ||
>  	    sectorsize > XFS_MAX_SECTORSIZE || sectorsize > blocksize) {
>  		fprintf(stderr, _("illegal sector size %d\n"), sectorsize);
> 

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

  reply	other threads:[~2010-01-08 17:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-08 18:25 [PATCH] mkfs: handle 4k sector devices more cleanly Eric Sandeen
2009-12-10 22:40 ` Christoph Hellwig
2009-12-10 23:00   ` Eric Sandeen
2010-01-08 16:46 ` [PATCH V2] " Eric Sandeen
2010-01-08 17:44   ` Christoph Hellwig
2010-01-08 17:51     ` Eric Sandeen [this message]
2010-01-09  2:24     ` Eric Sandeen
2010-01-09 14:43       ` Christoph Hellwig
2010-01-11 18:10   ` [PATCH V3] " Eric Sandeen
2010-01-11 21:36     ` Christoph Hellwig

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=4B4770BC.4050306@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=hch@infradead.org \
    --cc=sandeen@redhat.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