lkml.org 
[lkml]   [2003]   [Jun]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] nbd: maintain compatibility with existing nbd tools
On Wed, 25 Jun 2003, Lou Langholtz wrote:

> [ ... ] In the meantime, the nbd-client tool currently can't correctly set
> the size of the device and either that needs to be worked around in the
> driver (I'd done that in the original jumbo patch), or the nbd-client
> tool needs to be updated (the patch I'd mailed out for nbd-client works
> around the sizing issue by re-opening the nbd). To be clear, that's not
> something any of the changes that have gone in so far broke nor address.
> It's a consequence of how bd_set_size() is called in fs/block_dev.c
> do_open().

And here's the (tiny) patch for nbd to maintain compatibility with the
existing nbd-client tool. Compiled and tested on a couple machines.
Please apply.

Thanks,
Paul
--- nbd.c.ORIG 2003-06-26 10:35:43.000000000 -0400
+++ nbd.c 2003-06-26 17:03:08.000000000 -0400
@@ -465,15 +468,18 @@
lo->blksize_bits++;
temp >>= 1;
}
- lo->bytesize &= ~(lo->blksize-1);
+ lo->bytesize &= ~(lo->blksize-1);
+ inode->i_bdev->bd_inode->i_size = lo->bytesize;
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_capacity(lo->disk, lo->bytesize >> 9);
return 0;
case NBD_SET_SIZE_BLOCKS:
lo->bytesize = ((u64) arg) << lo->blksize_bits;
+ inode->i_bdev->bd_inode->i_size = lo->bytesize;
set_capacity(lo->disk, lo->bytesize >> 9);
return 0;
case NBD_DO_IT:
\
 
 \ /
  Last update: 2005-03-22 13:36    [W:0.103 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site