Re: [Qemu-devel] [PATCH] block/raw-posix.c: add BLKDISCARD support

2011-11-14 Thread Stefan Hajnoczi
On Fri, Nov 11, 2011 at 8:56 PM, e-t172 wrote: > +static int hdev_co_discard(BlockDriverState *bs, int64_t sector_num, > +                        int nb_sectors) > +{ > +    BDRVRawState *s = bs->opaque; > +    int fd = s->fd; > +    uint64_t range[2]; > + > +    range[0] = sector_num << 9; > +  

[Qemu-devel] [PATCH] block/raw-posix.c: add BLKDISCARD support

2011-11-11 Thread e-t172
This adds ioctl(BLKDISCARD) (a.k.a "discard", "TRIM", "UNMAP", "hole punching") support for host devices. This is especially useful if the raw device is a SSD or some kind of thin-provisioned device. Cc: Kevin Wolf Signed-off-by: Etienne Dechamps --- block/raw-posix.c | 20 ++