public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Paul Clements <Paul.Clements@SteelEye.com>
Cc: akpm@digeo.com, linux-kernel@vger.kernel.org,
	viro@parcelfarce.linux.theplanet.co.uk
Subject: Re: [PATCH 2.5.74-mm2] nbd: make nbd and block layer agree about device and  block sizes
Date: Sun, 06 Jul 2003 17:38:44 -0400	[thread overview]
Message-ID: <3F0896E4.4070003@pobox.com> (raw)
In-Reply-To: <3F089281.5BED1A25@SteelEye.com>

Paul Clements wrote:
>  	case NBD_SET_BLKSIZE:
> -		if ((arg & (arg-1)) || (arg < 512) || (arg > PAGE_SIZE))
> -			return -EINVAL;
>  		lo->blksize = arg;
> -		lo->bytesize &= ~(lo->blksize-1); 
> +		lo->bytesize &= ~(lo->blksize-1);
> +		inode->i_bdev->bd_inode->i_size = lo->bytesize;
> +		set_blocksize(inode->i_bdev, lo->blksize);
>  		set_capacity(lo->disk, lo->bytesize >> 9);
>  		return 0;
>  	case NBD_SET_SIZE:
> -		lo->bytesize = arg & ~(lo->blksize-1); 
> +		lo->bytesize = arg & ~(lo->blksize-1);
> +		inode->i_bdev->bd_inode->i_size = lo->bytesize;
> +		set_blocksize(inode->i_bdev, lo->blksize);
>  		set_capacity(lo->disk, lo->bytesize >> 9);
>  		return 0;
>  	case NBD_SET_SIZE_BLOCKS:
>  		lo->bytesize = ((u64) arg) * lo->blksize;
> +		inode->i_bdev->bd_inode->i_size = lo->bytesize;
> +		set_blocksize(inode->i_bdev, lo->blksize);
>  		set_capacity(lo->disk, lo->bytesize >> 9);
>  		return 0;
>  	case NBD_DO_IT:


Thanks.  You forgot to check set_blocksize's return value for errors, 
though.

Also, I wonder if you found a bug/oversight in set_blocksize -- it sets 
bd_inode->i_blkbits but not bd_inode->i_size.  I think it should set 
i_size also.  Maybe Andrew or Al can confirm/refute this assertion.

	Jeff




  reply	other threads:[~2003-07-06 21:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-06 21:15 [PATCH 2.5.74-mm2] nbd: remove unneeded nbd_open/nbd_release and refcnt Paul Clements
2003-07-06 21:20 ` [PATCH 2.5.74-mm2] nbd: make nbd and block layer agree about device and block sizes Paul Clements
2003-07-06 21:38   ` Jeff Garzik [this message]
2003-07-06 21:55     ` Paul Clements
2003-07-06 22:02       ` Jeff Garzik
2003-07-06 22:03     ` Andrew Morton

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=3F0896E4.4070003@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=Paul.Clements@SteelEye.com \
    --cc=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@parcelfarce.linux.theplanet.co.uk \
    /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