From: Paul Clements <Paul.Clements@SteelEye.com>
To: akpm@digeo.com, linux-kernel@vger.kernel.org
Subject: [PATCH 2.5.74-mm2] nbd: make nbd and block layer agree about device and block sizes
Date: Sun, 06 Jul 2003 17:20:01 -0400 [thread overview]
Message-ID: <3F089281.5BED1A25@SteelEye.com> (raw)
In-Reply-To: 3F089177.1A58BFE0@SteelEye.com
[-- Attachment #1: Type: text/plain, Size: 122 bytes --]
Andrew,
here's the revised patch for block and device size changes, using
set_blocksize() as Jeff suggested
Thanks,
Paul
[-- Attachment #2: nbd-block_layer_compat-2.diff --]
[-- Type: text/x-diff, Size: 1124 bytes --]
--- 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:
next prev parent reply other threads:[~2003-07-06 21:06 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 ` Paul Clements [this message]
2003-07-06 21:38 ` [PATCH 2.5.74-mm2] nbd: make nbd and block layer agree about device and block sizes Jeff Garzik
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=3F089281.5BED1A25@SteelEye.com \
--to=paul.clements@steeleye.com \
--cc=akpm@digeo.com \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).