[PATCH 2.5.74-mm2] nbd: make nbd and block layer agree about device and

Paul Clements (Paul.Clements@SteelEye.com)
Sun, 06 Jul 2003 17:20:01 -0400


This is a multi-part message in MIME format.
--------------66749B18BC819F9043735563
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Andrew,

here's the revised patch for block and device size changes, using
set_blocksize() as Jeff suggested

Thanks,
Paul
--------------66749B18BC819F9043735563
Content-Type: text/x-diff; charset=us-ascii;
name="nbd-block_layer_compat-2.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="nbd-block_layer_compat-2.diff"

--- linux-2.5.74-mm2/drivers/block/nbd.c.MINUS_OPEN_RELEASE 2003-07-06 16:55:22.224389840 -0400
+++ linux-2.5.74-mm2/drivers/block/nbd.c 2003-07-06 16:50:46.287338648 -0400
@@ -588,18 +588,22 @@ static int nbd_ioctl(struct inode *inode
}
return error;
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:

--------------66749B18BC819F9043735563--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/