WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] xen-blkback: convert hole punching to discard re

To: Jan Beulich <JBeulich@xxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] xen-blkback: convert hole punching to discard request on loop devices
From: Li Dongyang <lidongyang@xxxxxxxxxx>
Date: Wed, 9 Nov 2011 17:16:43 +0800
Cc: lczerner@xxxxxxxxxx, Dong Yang Li <lidongyang@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx, konrad.wilk@xxxxxxxxxx
Delivery-date: Wed, 09 Nov 2011 01:17:35 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4EB9606B020000780005FA5B@xxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1320654866-12457-1-git-send-email-lidongyang@xxxxxxxxxx> <4EB9606B020000780005FA5B@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Wed, Nov 9, 2011 at 12:01 AM, Jan Beulich <JBeulich@xxxxxxxx> wrote:
>>>> On 07.11.11 at 09:34, Li Dongyang <lidongyang@xxxxxxxxxx> wrote:
>> As of dfaa2ef68e80c378e610e3c8c536f1c239e8d3ef, loop devices support
>> discard request now. We could just issue a discard request, and
>> the loop driver will punch the hole for us, so we don't need to touch
>> the internals of loop device and punch the hole ourselves, Thanks.
>
> Looking at what the loop driver now does - doesn't the original code
> here lack support for lo_offset being non-zero then? If so, should we
> fix this in pre-3.2 kernels?
yes, you are right, but will we ever setup the loop device with
lo_offset non-zero?
I don't think so but I'm not sure.
>
> Jan
>
>> Signed-off-by: Li Dongyang <lidongyang@xxxxxxxxxx>
>> ---
>>  drivers/block/xen-blkback/blkback.c |   21 +++------------------
>>  1 files changed, 3 insertions(+), 18 deletions(-)
>>
>> diff --git a/drivers/block/xen-blkback/blkback.c
>> b/drivers/block/xen-blkback/blkback.c
>> index 15ec4db..ad365a7 100644
>> --- a/drivers/block/xen-blkback/blkback.c
>> +++ b/drivers/block/xen-blkback/blkback.c
>> @@ -39,9 +39,6 @@
>>  #include <linux/list.h>
>>  #include <linux/delay.h>
>>  #include <linux/freezer.h>
>> -#include <linux/loop.h>
>> -#include <linux/falloc.h>
>> -#include <linux/fs.h>
>>
>>  #include <xen/events.h>
>>  #include <xen/page.h>
>> @@ -422,25 +419,13 @@ static void xen_blk_discard(struct xen_blkif *blkif,
>> struct blkif_request *req)
>>       int status = BLKIF_RSP_OKAY;
>>       struct block_device *bdev = blkif->vbd.bdev;
>>
>> -     if (blkif->blk_backend_type == BLKIF_BACKEND_PHY)
>> -             /* just forward the discard request */
>> +     if (blkif->blk_backend_type == BLKIF_BACKEND_PHY ||
>> +         blkif->blk_backend_type == BLKIF_BACKEND_FILE)
>>               err = blkdev_issue_discard(bdev,
>>                               req->u.discard.sector_number,
>>                               req->u.discard.nr_sectors,
>>                               GFP_KERNEL, 0);
>> -     else if (blkif->blk_backend_type == BLKIF_BACKEND_FILE) {
>> -             /* punch a hole in the backing file */
>> -             struct loop_device *lo = bdev->bd_disk->private_data;
>> -             struct file *file = lo->lo_backing_file;
>> -
>> -             if (file->f_op->fallocate)
>> -                     err = file->f_op->fallocate(file,
>> -                             FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE,
>> -                             req->u.discard.sector_number << 9,
>> -                             req->u.discard.nr_sectors << 9);
>> -             else
>> -                     err = -EOPNOTSUPP;
>> -     } else
>> +     else
>>               err = -EOPNOTSUPP;
>>
>>       if (err == -EOPNOTSUPP) {
>
>
>
>

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel