]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Merge branch 'stable/for-jens-4.2' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorJens Axboe <axboe@fb.com>
Sat, 27 Jun 2015 17:47:07 +0000 (11:47 -0600)
committerJens Axboe <axboe@fb.com>
Sat, 27 Jun 2015 17:47:07 +0000 (11:47 -0600)
1  2 
drivers/block/xen-blkback/blkback.c

index 713fc9ff11492766efcb7a4795b4a1750ceb9707,9121a2c3e26f266c7277fe4efe18626ff6d08061..2126842fb6e8a862a36b733b8eb709cf785b0591
@@@ -83,6 -83,13 +83,13 @@@ module_param_named(max_persistent_grant
  MODULE_PARM_DESC(max_persistent_grants,
                   "Maximum number of grants to map persistently");
  
+ /*
+  * Maximum order of pages to be used for the shared ring between front and
+  * backend, 4KB page granularity is used.
+  */
+ unsigned int xen_blkif_max_ring_order = XENBUS_MAX_RING_PAGE_ORDER;
+ module_param_named(max_ring_page_order, xen_blkif_max_ring_order, int, S_IRUGO);
+ MODULE_PARM_DESC(max_ring_page_order, "Maximum order of pages to be used for the shared ring");
  /*
   * The LRU mechanism to clean the lists of persistent grants needs to
   * be executed periodically. The time interval between consecutive executions
@@@ -265,6 -272,17 +272,6 @@@ static void put_persistent_gnt(struct x
        atomic_dec(&blkif->persistent_gnt_in_use);
  }
  
 -static void free_persistent_gnts_unmap_callback(int result,
 -                                              struct gntab_unmap_queue_data *data)
 -{
 -      struct completion *c = data->data;
 -
 -      /* BUG_ON used to reproduce existing behaviour,
 -         but is this the best way to deal with this? */
 -      BUG_ON(result);
 -      complete(c);
 -}
 -
  static void free_persistent_gnts(struct xen_blkif *blkif, struct rb_root *root,
                                   unsigned int num)
  {
        struct rb_node *n;
        int segs_to_unmap = 0;
        struct gntab_unmap_queue_data unmap_data;
 -      struct completion unmap_completion;
 -
 -      init_completion(&unmap_completion);
  
 -      unmap_data.data = &unmap_completion;
 -      unmap_data.done = &free_persistent_gnts_unmap_callback;
        unmap_data.pages = pages;
        unmap_data.unmap_ops = unmap;
        unmap_data.kunmap_ops = NULL;
                        !rb_next(&persistent_gnt->node)) {
  
                        unmap_data.count = segs_to_unmap;
 -                      gnttab_unmap_refs_async(&unmap_data);
 -                      wait_for_completion(&unmap_completion);
 +                      BUG_ON(gnttab_unmap_refs_sync(&unmap_data));
  
                        put_free_pages(blkif, pages, segs_to_unmap);
                        segs_to_unmap = 0;
@@@ -312,13 -336,8 +319,13 @@@ void xen_blkbk_unmap_purged_grants(stru
        struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST];
        struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST];
        struct persistent_gnt *persistent_gnt;
 -      int ret, segs_to_unmap = 0;
 +      int segs_to_unmap = 0;
        struct xen_blkif *blkif = container_of(work, typeof(*blkif), persistent_purge_work);
 +      struct gntab_unmap_queue_data unmap_data;
 +
 +      unmap_data.pages = pages;
 +      unmap_data.unmap_ops = unmap;
 +      unmap_data.kunmap_ops = NULL;
  
        while(!list_empty(&blkif->persistent_purge_list)) {
                persistent_gnt = list_first_entry(&blkif->persistent_purge_list,
                pages[segs_to_unmap] = persistent_gnt->page;
  
                if (++segs_to_unmap == BLKIF_MAX_SEGMENTS_PER_REQUEST) {
 -                      ret = gnttab_unmap_refs(unmap, NULL, pages,
 -                              segs_to_unmap);
 -                      BUG_ON(ret);
 +                      unmap_data.count = segs_to_unmap;
 +                      BUG_ON(gnttab_unmap_refs_sync(&unmap_data));
                        put_free_pages(blkif, pages, segs_to_unmap);
                        segs_to_unmap = 0;
                }
                kfree(persistent_gnt);
        }
        if (segs_to_unmap > 0) {
 -              ret = gnttab_unmap_refs(unmap, NULL, pages, segs_to_unmap);
 -              BUG_ON(ret);
 +              unmap_data.count = segs_to_unmap;
 +              BUG_ON(gnttab_unmap_refs_sync(&unmap_data));
                put_free_pages(blkif, pages, segs_to_unmap);
        }
  }
@@@ -1438,6 -1458,12 +1445,12 @@@ static int __init xen_blkif_init(void
        if (!xen_domain())
                return -ENODEV;
  
+       if (xen_blkif_max_ring_order > XENBUS_MAX_RING_PAGE_ORDER) {
+               pr_info("Invalid max_ring_order (%d), will use default max: %d.\n",
+                       xen_blkif_max_ring_order, XENBUS_MAX_RING_PAGE_ORDER);
+               xen_blkif_max_ring_order = XENBUS_MAX_RING_PAGE_ORDER;
+       }
        rc = xen_blkif_interface_init();
        if (rc)
                goto failed_init;