From mboxrd@z Thu Jan 1 00:00:00 1970 From: Li Dongyang Subject: Re: [PATCH V2 3/3] xen-blkback: handle trim request in backend driver Date: Mon, 22 Aug 2011 17:43:28 +0800 Message-ID: References: <1313660071-25230-1-git-send-email-lidongyang@novell.com> <1313660071-25230-4-git-send-email-lidongyang@novell.com> <20110818145611.GC23922@dumpdata.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20110818145611.GC23922@dumpdata.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Konrad Rzeszutek Wilk Cc: xen-devel@lists.xensource.com, owen.smith@citrix.com, JBeulich@novell.com List-Id: xen-devel@lists.xenproject.org On Thu, Aug 18, 2011 at 10:56 PM, Konrad Rzeszutek Wilk wrote: > On Thu, Aug 18, 2011 at 05:34:31PM +0800, Li Dongyang wrote: >> Now blkback driver can handle the trim request from guest, we will >> forward the request to phy device if it really has trim support, or we'l= l >> punch a hole on the image file. >> >> Signed-off-by: Li Dongyang >> --- >> =A0drivers/block/xen-blkback/blkback.c | =A0 85 ++++++++++++++++++++++++= +++++------ >> =A0drivers/block/xen-blkback/common.h =A0| =A0 =A04 +- >> =A0drivers/block/xen-blkback/xenbus.c =A0| =A0 61 ++++++++++++++++++++++= +++ >> =A03 files changed, 135 insertions(+), 15 deletions(-) >> >> diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blk= back/blkback.c >> index 2330a9a..5acc37a 100644 >> --- a/drivers/block/xen-blkback/blkback.c >> +++ b/drivers/block/xen-blkback/blkback.c >> @@ -39,6 +39,9 @@ >> =A0#include >> =A0#include >> =A0#include >> +#include >> +#include >> +#include >> >> =A0#include >> =A0#include >> @@ -258,13 +261,16 @@ irqreturn_t xen_blkif_be_int(int irq, void *dev_id= ) >> >> =A0static void print_stats(struct xen_blkif *blkif) >> =A0{ >> - =A0 =A0 pr_info("xen-blkback (%s): oo %3d =A0| =A0rd %4d =A0| =A0wr %4= d =A0| =A0f %4d\n", >> + =A0 =A0 pr_info("xen-blkback (%s): oo %3d =A0| =A0rd %4d =A0| =A0wr %4= d =A0| =A0f %4d" >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0" =A0| =A0tr %4d\n", >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0current->comm, blkif->st_oo_req, >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0blkif->st_rd_req, blkif->st_wr_req, blkif->= st_f_req); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0blkif->st_rd_req, blkif->st_wr_req, >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0blkif->st_f_req, blkif->st_tr_req); >> =A0 =A0 =A0 blkif->st_print =3D jiffies + msecs_to_jiffies(10 * 1000); >> =A0 =A0 =A0 blkif->st_rd_req =3D 0; >> =A0 =A0 =A0 blkif->st_wr_req =3D 0; >> =A0 =A0 =A0 blkif->st_oo_req =3D 0; >> + =A0 =A0 blkif->st_tr_req =3D 0; >> =A0} >> >> =A0int xen_blkif_schedule(void *arg) >> @@ -563,6 +569,10 @@ static int dispatch_rw_block_io(struct xen_blkif *b= lkif, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 blkif->st_f_req++; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 operation =3D WRITE_FLUSH; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; >> + =A0 =A0 case BLKIF_OP_TRIM: >> + =A0 =A0 =A0 =A0 =A0 =A0 blkif->st_tr_req++; >> + =A0 =A0 =A0 =A0 =A0 =A0 operation =3D REQ_DISCARD; >> + =A0 =A0 =A0 =A0 =A0 =A0 break; >> =A0 =A0 =A0 case BLKIF_OP_WRITE_BARRIER: >> =A0 =A0 =A0 default: >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 operation =3D 0; /* make gcc happy */ >> @@ -572,7 +582,7 @@ static int dispatch_rw_block_io(struct xen_blkif *bl= kif, >> >> =A0 =A0 =A0 /* Check that the number of segments is sane. */ >> =A0 =A0 =A0 nseg =3D req->nr_segments; >> - =A0 =A0 if (unlikely(nseg =3D=3D 0 && operation !=3D WRITE_FLUSH) || >> + =A0 =A0 if (unlikely(nseg =3D=3D 0 && operation !=3D (WRITE_FLUSH | RE= Q_DISCARD)) || >> =A0 =A0 =A0 =A0 =A0 unlikely(nseg > BLKIF_MAX_SEGMENTS_PER_REQUEST)) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 pr_debug(DRV_PFX "Bad number of segments in = request (%d)\n", >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0nseg); >> @@ -627,10 +637,13 @@ static int dispatch_rw_block_io(struct xen_blkif *= blkif, >> =A0 =A0 =A0 =A0* the hypercall to unmap the grants - that is all done in >> =A0 =A0 =A0 =A0* xen_blkbk_unmap. >> =A0 =A0 =A0 =A0*/ >> - =A0 =A0 if (xen_blkbk_map(req, pending_req, seg)) >> + =A0 =A0 if (operation !=3D BLKIF_OP_TRIM && xen_blkbk_map(req, pending= _req, seg)) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto fail_flush; >> >> - =A0 =A0 /* This corresponding xen_blkif_put is done in __end_block_io_= op */ >> + =A0 =A0 /* >> + =A0 =A0 =A0* This corresponding xen_blkif_put is done in __end_block_i= o_op, or >> + =A0 =A0 =A0* below if we are handling a BLKIF_OP_TRIM. >> + =A0 =A0 =A0*/ >> =A0 =A0 =A0 xen_blkif_get(blkif); >> >> =A0 =A0 =A0 for (i =3D 0; i < nseg; i++) { >> @@ -654,18 +667,62 @@ static int dispatch_rw_block_io(struct xen_blkif *= blkif, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 preq.sector_number +=3D seg[i].nsec; >> =A0 =A0 =A0 } >> >> - =A0 =A0 /* This will be hit if the operation was a flush. */ >> + =A0 =A0 /* This will be hit if the operation was a flush or trim. */ >> =A0 =A0 =A0 if (!bio) { >> - =A0 =A0 =A0 =A0 =A0 =A0 BUG_ON(operation !=3D WRITE_FLUSH); >> + =A0 =A0 =A0 =A0 =A0 =A0 BUG_ON(operation !=3D (WRITE_FLUSH | REQ_DISCA= RD)); >> >> - =A0 =A0 =A0 =A0 =A0 =A0 bio =3D bio_alloc(GFP_KERNEL, 0); >> - =A0 =A0 =A0 =A0 =A0 =A0 if (unlikely(bio =3D=3D NULL)) >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto fail_put_bio; >> + =A0 =A0 =A0 =A0 =A0 =A0 if (operation =3D=3D WRITE_FLUSH) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 bio =3D bio_alloc(GFP_KERNEL, = 0); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (unlikely(bio =3D=3D NULL)) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto fail_put_= bio; >> >> - =A0 =A0 =A0 =A0 =A0 =A0 biolist[nbio++] =3D bio; >> - =A0 =A0 =A0 =A0 =A0 =A0 bio->bi_bdev =A0 =A0=3D preq.bdev; >> - =A0 =A0 =A0 =A0 =A0 =A0 bio->bi_private =3D pending_req; >> - =A0 =A0 =A0 =A0 =A0 =A0 bio->bi_end_io =A0=3D end_block_io_op; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 biolist[nbio++] =3D bio; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 bio->bi_bdev =A0 =A0=3D preq.b= dev; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 bio->bi_private =3D pending_re= q; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 bio->bi_end_io =A0=3D end_bloc= k_io_op; >> + =A0 =A0 =A0 =A0 =A0 =A0 } else if (operation =3D=3D REQ_DISCARD) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int err =3D 0; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int status =3D BLKIF_RSP_OKAY; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct block_device *bdev =3D = blkif->vbd.bdev; >> + >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 preq.nr_sects =3D req->u.trim.= nr_sectors; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (blkif->vbd.type & VDISK_PH= Y_BACKEND) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* just forwar= d the trim request */ >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 err =3D blkdev= _issue_discard(bdev, >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 preq.sector_number, >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 preq.nr_sects, >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 GFP_KERNEL, 0); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 else if (blkif->vbd.type & VDI= SK_FILE_BACKEND) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* punch a hol= e in the backing file */ >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct loop_de= vice *lo =3D >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 bdev->bd_disk->private_data; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct file *f= ile =3D lo->lo_backing_file; >> + >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (file->f_op= ->fallocate) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 err =3D file->f_op->fallocate(file, >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 FALLOC_FL_KEEP_SIZE | >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 FALLOC_FL_PUNCH_HOLE, >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 preq.sector_number << 9, >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 preq.nr_sects << 9); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 else >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 err =3D -EOPNOTSUPP; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 status =3D BLK= IF_RSP_EOPNOTSUPP; >> + >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (err =3D=3D -EOPNOTSUPP) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 DPRINTK("blkba= ck: discard op failed, " >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 "not supported\n"); > > Use pr_debug like the rest of the file does. gonna fix > >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 status =3D BLK= IF_RSP_EOPNOTSUPP; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else if (err) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 status =3D BLK= IF_RSP_ERROR; >> + >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (status =3D=3D BLKIF_RSP_OK= AY) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 blkif->st_tr_s= ect +=3D preq.nr_sects; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 make_response(blkif, req->id, = req->operation, status); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 xen_blkif_put(blkif); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 free_req(pending_req); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 0; >> + =A0 =A0 =A0 =A0 =A0 =A0 } > > All of this should really be moved to its own function. not quite clear about this, do you mean we should make sth like dispatch_trim_block_io only for OP_TRIM? I added the trim handling stuff to dispatch_rw_block_io because it also handles flush stuff. > >> =A0 =A0 =A0 } >> >> =A0 =A0 =A0 /* >> diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkb= ack/common.h >> index 9e40b28..1fef727 100644 >> --- a/drivers/block/xen-blkback/common.h >> +++ b/drivers/block/xen-blkback/common.h >> @@ -159,8 +159,10 @@ struct xen_blkif { >> =A0 =A0 =A0 int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 st_wr_req; >> =A0 =A0 =A0 int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 st_oo_req; >> =A0 =A0 =A0 int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 st_f_req; >> + =A0 =A0 int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 st_tr_req; >> =A0 =A0 =A0 int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 st_rd_sect; >> =A0 =A0 =A0 int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 st_wr_sect; >> + =A0 =A0 int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 st_tr_sect; >> >> =A0 =A0 =A0 wait_queue_head_t =A0 =A0 =A0 waiting_to_free; >> >> @@ -182,7 +184,7 @@ struct xen_blkif { >> >> =A0struct phys_req { >> =A0 =A0 =A0 unsigned short =A0 =A0 =A0 =A0 =A0dev; >> - =A0 =A0 unsigned short =A0 =A0 =A0 =A0 =A0nr_sects; >> + =A0 =A0 blkif_sector_t =A0 =A0 =A0 =A0 =A0nr_sects; >> =A0 =A0 =A0 struct block_device =A0 =A0 *bdev; >> =A0 =A0 =A0 blkif_sector_t =A0 =A0 =A0 =A0 =A0sector_number; >> =A0}; >> diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkb= ack/xenbus.c >> index 3f129b4..05ea8e0 100644 >> --- a/drivers/block/xen-blkback/xenbus.c >> +++ b/drivers/block/xen-blkback/xenbus.c >> @@ -272,16 +272,20 @@ VBD_SHOW(oo_req, =A0"%d\n", be->blkif->st_oo_req); >> =A0VBD_SHOW(rd_req, =A0"%d\n", be->blkif->st_rd_req); >> =A0VBD_SHOW(wr_req, =A0"%d\n", be->blkif->st_wr_req); >> =A0VBD_SHOW(f_req, =A0"%d\n", be->blkif->st_f_req); >> +VBD_SHOW(tr_req, "%d\n", be->blkif->st_tr_req); >> =A0VBD_SHOW(rd_sect, "%d\n", be->blkif->st_rd_sect); >> =A0VBD_SHOW(wr_sect, "%d\n", be->blkif->st_wr_sect); >> +VBD_SHOW(tr_sect, "%d\n", be->blkif->st_tr_sect); >> >> =A0static struct attribute *xen_vbdstat_attrs[] =3D { >> =A0 =A0 =A0 &dev_attr_oo_req.attr, >> =A0 =A0 =A0 &dev_attr_rd_req.attr, >> =A0 =A0 =A0 &dev_attr_wr_req.attr, >> =A0 =A0 =A0 &dev_attr_f_req.attr, >> + =A0 =A0 &dev_attr_tr_req.attr, >> =A0 =A0 =A0 &dev_attr_rd_sect.attr, >> =A0 =A0 =A0 &dev_attr_wr_sect.attr, >> + =A0 =A0 &dev_attr_tr_sect.attr, >> =A0 =A0 =A0 NULL >> =A0}; >> >> @@ -419,6 +423,59 @@ int xen_blkbk_flush_diskcache(struct xenbus_transac= tion xbt, >> =A0 =A0 =A0 return err; >> =A0} >> >> +int xen_blkbk_trim(struct xenbus_transaction xbt, struct backend_info *= be) >> +{ >> + =A0 =A0 struct xenbus_device *dev =3D be->dev; >> + =A0 =A0 struct xen_vbd *vbd =3D &be->blkif->vbd; >> + =A0 =A0 char *type; >> + =A0 =A0 int err; >> + =A0 =A0 int state =3D 0; >> + >> + =A0 =A0 type =3D xenbus_read(XBT_NIL, dev->nodename, "type", NULL); >> + =A0 =A0 if (!IS_ERR(type)) { >> + =A0 =A0 =A0 =A0 =A0 =A0 if (strcmp(type, "file") =3D=3D 0) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 state =3D 1; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 vbd->type |=3D VDISK_FILE_BACK= END; >> + =A0 =A0 =A0 =A0 =A0 =A0 if (strcmp(type, "phy") =3D=3D 0) { > > Use 'strncmp' please. gonna fix > >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct block_device *bdev =3D = be->blkif->vbd.bdev; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct request_queue *q =3D bd= ev_get_queue(bdev); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (blk_queue_discard(q)) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 err =3D xenbus= _printf(xbt, dev->nodename, >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 "discard_granularity", "%u", > > Hm, most of the items written to the Xenbus use '-', not '_'. > Any particular reason for using '_'? they are taken from struct queue_limits so I used the underscore, no problem to change them to '-' > >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 q->limits.discard_granularity); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (err) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 xenbus_dev_fatal(dev, err, >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 "writing discard_granularity"); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 goto kfree; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 err =3D xenbus= _printf(xbt, dev->nodename, >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 "discard_alignment", "%u", > > Ditto here. >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 q->limits.discard_alignment); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (err) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 xenbus_dev_fatal(dev, err, >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 "writing discard_alignment"); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 goto kfree; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 state =3D 1; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 vbd->type |=3D= VDISK_PHY_BACKEND; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> + =A0 =A0 =A0 =A0 =A0 =A0 } >> + =A0 =A0 } else { >> + =A0 =A0 =A0 =A0 =A0 =A0 err =3D PTR_ERR(type); >> + =A0 =A0 =A0 =A0 =A0 =A0 xenbus_dev_fatal(dev, err, "reading type"); >> + =A0 =A0 =A0 =A0 =A0 =A0 goto out; >> + =A0 =A0 } >> + >> + =A0 =A0 err =3D xenbus_printf(xbt, dev->nodename, "feature-trim", >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "%d", state); >> + =A0 =A0 if (err) >> + =A0 =A0 =A0 =A0 =A0 =A0 xenbus_dev_fatal(dev, err, "writing feature-tr= im"); >> +kfree: >> + =A0 =A0 kfree(type); >> +out: >> + =A0 =A0 return err; >> +} >> + >> =A0/* >> =A0 * Entry point to this code when a new device is created. =A0Allocate= the basic >> =A0 * structures, and watch the store waiting for the hotplug scripts to= tell us >> @@ -650,6 +707,10 @@ again: >> =A0 =A0 =A0 if (err) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto abort; >> >> + =A0 =A0 err =3D xen_blkbk_trim(xbt, be); >> + =A0 =A0 if (err) >> + =A0 =A0 =A0 =A0 =A0 =A0 goto abort; >> + >> =A0 =A0 =A0 err =3D xenbus_printf(xbt, dev->nodename, "sectors", "%llu", >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (unsigned long long)= vbd_sz(&be->blkif->vbd)); >> =A0 =A0 =A0 if (err) { >> -- >> 1.7.6 >> >> >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xensource.com >> http://lists.xensource.com/xen-devel >