mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 05:48:40 +00:00
xen/blkback: simplify free_persistent_gnts() interface
The interface of free_persistent_gnts() can be simplified, as there is only a single caller of free_persistent_gnts() and the 2nd and 3rd parameters are easily obtainable via the ring pointer, which is passed as the first parameter anyway. Signed-off-by: Juergen Gross <jgross@suse.com> Acked-by: Roger Pau Monné <roger.pau@citrix.com> Signed-off-by: Juergen Gross <jgross@suse.com>
This commit is contained in:
parent
656f3c1d79
commit
e7b4c07d4b
1 changed files with 10 additions and 10 deletions
|
@ -239,9 +239,9 @@ static void put_persistent_gnt(struct xen_blkif_ring *ring,
|
|||
atomic_dec(&ring->persistent_gnt_in_use);
|
||||
}
|
||||
|
||||
static void free_persistent_gnts(struct xen_blkif_ring *ring, struct rb_root *root,
|
||||
unsigned int num)
|
||||
static void free_persistent_gnts(struct xen_blkif_ring *ring)
|
||||
{
|
||||
struct rb_root *root = &ring->persistent_gnts;
|
||||
struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST];
|
||||
struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST];
|
||||
struct persistent_gnt *persistent_gnt;
|
||||
|
@ -249,6 +249,9 @@ static void free_persistent_gnts(struct xen_blkif_ring *ring, struct rb_root *ro
|
|||
int segs_to_unmap = 0;
|
||||
struct gntab_unmap_queue_data unmap_data;
|
||||
|
||||
if (RB_EMPTY_ROOT(root))
|
||||
return;
|
||||
|
||||
unmap_data.pages = pages;
|
||||
unmap_data.unmap_ops = unmap;
|
||||
unmap_data.kunmap_ops = NULL;
|
||||
|
@ -277,9 +280,11 @@ static void free_persistent_gnts(struct xen_blkif_ring *ring, struct rb_root *ro
|
|||
|
||||
rb_erase(&persistent_gnt->node, root);
|
||||
kfree(persistent_gnt);
|
||||
num--;
|
||||
ring->persistent_gnt_c--;
|
||||
}
|
||||
BUG_ON(num != 0);
|
||||
|
||||
BUG_ON(!RB_EMPTY_ROOT(&ring->persistent_gnts));
|
||||
BUG_ON(ring->persistent_gnt_c != 0);
|
||||
}
|
||||
|
||||
void xen_blkbk_unmap_purged_grants(struct work_struct *work)
|
||||
|
@ -631,12 +636,7 @@ int xen_blkif_schedule(void *arg)
|
|||
void xen_blkbk_free_caches(struct xen_blkif_ring *ring)
|
||||
{
|
||||
/* Free all persistent grant pages */
|
||||
if (!RB_EMPTY_ROOT(&ring->persistent_gnts))
|
||||
free_persistent_gnts(ring, &ring->persistent_gnts,
|
||||
ring->persistent_gnt_c);
|
||||
|
||||
BUG_ON(!RB_EMPTY_ROOT(&ring->persistent_gnts));
|
||||
ring->persistent_gnt_c = 0;
|
||||
free_persistent_gnts(ring);
|
||||
|
||||
/* Since we are shutting down remove all pages from the buffer */
|
||||
gnttab_page_cache_shrink(&ring->free_pages, 0 /* All */);
|
||||
|
|
Loading…
Reference in a new issue