From: Ankur Arora Date: Wed, 29 Aug 2018 21:17:59 +0000 (-0700) Subject: xen-blkback: pull out blkif grant features from vbd X-Git-Tag: v4.1.12-124.31.3~512 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=b20ec638b95ec1947541d05bf09543bb258770ca;p=users%2Fjedix%2Flinux-maple.git xen-blkback: pull out blkif grant features from vbd grant related features don't have anything to do with the vbd. Move them to the blkif structure. Orabug: 28651655 Signed-off-by: Ankur Arora Reviewed-by: Boris Ostrovsky Reviewed-by: Darren Kenny Reviewed-by: Bhavesh Davda Signed-off-by: Brian Maly --- diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index 523769d7e2b9e..ab4ebac4b709d 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -216,8 +216,8 @@ static int add_persistent_gnt(struct xen_blkif_ring *ring, struct xen_blkif *blkif = ring->blkif; if (ring->persistent_gnt_c >= xen_blkif_max_pgrants) { - if (!blkif->vbd.overflow_max_grants) - blkif->vbd.overflow_max_grants = 1; + if (!blkif->overflow_max_grants) + blkif->overflow_max_grants = 1; return -EBUSY; } /* Figure out where to put new node */ @@ -376,7 +376,7 @@ static void purge_persistent_gnt(struct xen_blkif_ring *ring) if (ring->persistent_gnt_c < xen_blkif_max_pgrants || (ring->persistent_gnt_c == xen_blkif_max_pgrants && - !ring->blkif->vbd.overflow_max_grants)) { + !ring->blkif->overflow_max_grants)) { goto out; } @@ -447,7 +447,7 @@ finished: } ring->persistent_gnt_c -= (total - num_clean); - ring->blkif->vbd.overflow_max_grants = 0; + ring->blkif->overflow_max_grants = 0; /* We can defer this work */ schedule_work(&ring->persistent_purge_work); @@ -667,7 +667,7 @@ int xen_blkif_schedule(void *arg) kthread_should_stop()); purge_gnt_list: - if (blkif->vbd.feature_gnt_persistent && + if (blkif->feature_gnt_persistent && time_after(jiffies, ring->next_lru)) { purge_persistent_gnt(ring); ring->next_lru = jiffies + msecs_to_jiffies(LRU_INTERVAL); @@ -833,7 +833,7 @@ static int xen_blkbk_map(struct xen_blkif_ring *ring, int use_persistent_gnts; struct xen_blkif *blkif = ring->blkif; - use_persistent_gnts = (blkif->vbd.feature_gnt_persistent); + use_persistent_gnts = (blkif->feature_gnt_persistent); /* * Fill out preq.nr_sects with proper amount of sectors, and setup @@ -931,8 +931,8 @@ again: xen_blkif_max_pgrants); goto next; } - if (use_persistent_gnts && !blkif->vbd.overflow_max_grants) { - blkif->vbd.overflow_max_grants = 1; + if (use_persistent_gnts && !blkif->overflow_max_grants) { + blkif->overflow_max_grants = 1; pr_debug("domain %u, device %#x is using maximum number of persistent grants\n", blkif->domid, blkif->vbd.handle); } diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h index 8bb31d26cdf74..921b084f35d82 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h @@ -227,8 +227,6 @@ struct xen_vbd { sector_t size; unsigned int flush_support:1; unsigned int discard_secure:1; - unsigned int feature_gnt_persistent:1; - unsigned int overflow_max_grants:1; }; struct backend_info; @@ -331,6 +329,8 @@ struct xen_blkif { /* All rings for this device. */ struct xen_blkif_ring *rings; unsigned int nr_rings; + unsigned int feature_gnt_persistent:1; + unsigned int overflow_max_grants:1; }; struct seg_buf { diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 59dd6c606f30c..27a12f20acb26 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -1085,8 +1085,8 @@ static int connect_ring(struct backend_info *be) } pers_grants = xenbus_read_unsigned(dev->otherend, "feature-persistent", 0); - be->blkif->vbd.feature_gnt_persistent = pers_grants; - be->blkif->vbd.overflow_max_grants = 0; + be->blkif->feature_gnt_persistent = pers_grants; + be->blkif->overflow_max_grants = 0; /* * Read the number of hardware queues from frontend.