From: Paolo Bonzini <pbonzini@redhat.com> Date: 2011-09-07 16:36:25
This patch series adds support for a DISCARD command in the nbd
protocol. qemu-nbd will be the first user of the feature.
Please consider this for 3.2.
Thanks!
Cc: Paul Clements <Paul.Clements-G8/ITkJZaeZWk0Htik3J/w@public.gmane.org>
Signed-off-by: Paolo Bonzini <redacted>
Paolo Bonzini (3):
nbd: remove unused flags fields
nbd: add support for feature negotiation
nbd: map DISCARD requests to a new nbd request type
drivers/block/nbd.c | 28 ++++++++++++++++++++--------
include/linux/nbd.h | 32 ++++++++++++++++++--------------
2 files changed, 38 insertions(+), 22 deletions(-)
--
1.7.6
From: Paolo Bonzini <pbonzini@redhat.com> Date: 2011-09-07 16:17:54
The flags field is never written right now. Before putting it
to new use in the next patches, clean up the uses.
Cc: Paul Clements <Paul.Clements-G8/ITkJZaeZWk0Htik3J/w@public.gmane.org>
Signed-off-by: Paolo Bonzini <redacted>
---
drivers/block/nbd.c | 11 +++--------
include/linux/nbd.h | 4 ----
2 files changed, 3 insertions(+), 12 deletions(-)
From: Paolo Bonzini <pbonzini@redhat.com> Date: 2011-09-07 16:19:39
When the feature is enabled, set QUEUE_FLAG_DISCARD and transmit those as
NBD_CMD_TRIM requests.
I used "trim" instead of "discard" to avoid confusion with the existing
NBD_CMD_DISC that is used for disconnect.
Cc: Paul Clements <redacted>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
drivers/block/nbd.c | 15 ++++++++++++---
include/linux/nbd.h | 4 +++-
2 files changed, 15 insertions(+), 4 deletions(-)
From: Paolo Bonzini <pbonzini@redhat.com> Date: 2011-09-07 16:27:49
Add a IOCTL to negotiate features between the server and the
kernel module (mediated by the usermode client). Features are
stored in the pre-existing flags field.
Also zero out the flags when NBD_DO_IT completes.
Cc: Paul Clements <Paul.Clements-G8/ITkJZaeZWk0Htik3J/w@public.gmane.org>
Signed-off-by: Paolo Bonzini <redacted>
---
drivers/block/nbd.c | 8 ++++++++
include/linux/nbd.h | 24 +++++++++++++++---------
2 files changed, 23 insertions(+), 9 deletions(-)
From: Paul Clements <hidden> Date: 2011-09-07 16:30:30
Paolo,
thanks for the patch...
On Wed, Sep 7, 2011 at 10:41 AM, Paolo Bonzini [off-list ref] wrote:
Add a IOCTL to negotiate features between the server and the
kernel module (mediated by the usermode client). Features are
stored in the pre-existing flags field.
I'm not crazy about another ioctl, but we need to get this flag
setting functionality in, and I just have not had the time...
quoted hunk
Also zero out the flags when NBD_DO_IT completes.
Cc: Paul Clements <Paul.Clements-G8/ITkJZaeZWk0Htik3J/w@public.gmane.org>
Signed-off-by: Paolo Bonzini <redacted>
---
drivers/block/nbd.c | 8 ++++++++
include/linux/nbd.h | 24 +++++++++++++++---------
2 files changed, 23 insertions(+), 9 deletions(-)
case NBD_PRINT_DEBUG: return "print-debug";
case NBD_SET_SIZE_BLOCKS: return "set-size-blocks";
case NBD_DISCONNECT: return "disconnect";
+ case NBD_SET_FEATURES: return "set-features";
Could you name this as NBD_SET_FLAGS, as that's more consistent with
what it's really doing?
Otherwise these look good for inclusion.
Thanks,
Paul
quoted hunk
case BLKROSET: return "set-read-only";
case BLKFLSBUF: return "flush-buffer-cache";
}
------------------------------------------------------------------------------
Using storage to extend the benefits of virtualization and iSCSI
Virtualization increases hardware utilization and delivers a new level of
agility. Learn what those decisions are and how to modernize your storage
and backup environments for virtualization.
http://www.accelacomm.com/jaw/sfnl/114/51434361/
From: Paolo Bonzini <pbonzini@redhat.com> Date: 2011-09-07 17:52:53
On 09/07/2011 06:30 PM, Paul Clements wrote:
Could you name this as NBD_SET_FLAGS, as that's more consistent with
what it's really doing?
I named it differently intentionally, actually, because it should not
use the flags field from the network protocol as is. Also, "features"
sounds more like something that is optional, while unrecognized "flags"
should probably cause a failure.
What about renaming the struct field and leaving this as
NBD_SET_FEATURES or NBD_ENABLE_FEATURES?
Paolo
------------------------------------------------------------------------------
Using storage to extend the benefits of virtualization and iSCSI
Virtualization increases hardware utilization and delivers a new level of
agility. Learn what those decisions are and how to modernize your storage
and backup environments for virtualization.
http://www.accelacomm.com/jaw/sfnl/114/51434361/
From: Paul Clements <hidden> Date: 2011-09-07 21:59:11
On Wed, Sep 7, 2011 at 1:52 PM, Paolo Bonzini [off-list ref] wrote:
On 09/07/2011 06:30 PM, Paul Clements wrote:
quoted
Could you name this as NBD_SET_FLAGS, as that's more consistent with
what it's really doing?
I named it differently intentionally, actually, because it should not use
the flags field from the network protocol as is. Also, "features" sounds
more like something that is optional, while unrecognized "flags" should
probably cause a failure.
Alright, I can buy that argument -- I don't feel that strongly about it...
This looks good to me, then.
--
Paul
------------------------------------------------------------------------------
Using storage to extend the benefits of virtualization and iSCSI
Virtualization increases hardware utilization and delivers a new level of
agility. Learn what those decisions are and how to modernize your storage
and backup environments for virtualization.
http://www.accelacomm.com/jaw/sfnl/114/51434361/
From: Paul Clements <hidden> Date: 2011-09-08 01:13:50
On Wed, Sep 7, 2011 at 10:41 AM, Paolo Bonzini [off-list ref] wrote:
When the feature is enabled, set QUEUE_FLAG_DISCARD and transmit those as
NBD_CMD_TRIM requests.
I used "trim" instead of "discard" to avoid confusion with the existing
NBD_CMD_DISC that is used for disconnect.
@@ -796,6 +805,9 @@ static int __init nbd_init(void)
* Tell the block layer that we are not a rotational device
*/
queue_flag_set_unlocked(QUEUE_FLAG_NONROT, disk->queue);
+ disk->queue->limits.discard_granularity = 512;
+ disk->queue->limits.max_discard_sectors = UINT_MAX;
+ disk->queue->limits.discard_zeroes_data = 0;
}
if (register_blkdev(NBD_MAJOR, "nbd")) {
From: Paolo Bonzini <pbonzini@redhat.com> Date: 2011-09-08 07:00:48
On 09/07/2011 11:54 PM, Paul Clements wrote:
quoted
quoted
I named it differently intentionally, actually, because it should not use
the flags field from the network protocol as is. Also, "features" sounds
more like something that is optional, while unrecognized "flags" should
probably cause a failure.
Alright, I can buy that argument -- I don't feel that strongly about it...
This looks good to me, then.
Actually no, I can do better. :)
Paolo
------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops? How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/