mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-09 23:00:21 +00:00
xen/blkfront: switch blkfront to use INVALID_GRANT_REF
Instead of using a private macro for an invalid grant reference use the common one. Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Acked-by: Roger Pau Monné <roger.pau@citrix.com> Signed-off-by: Juergen Gross <jgross@suse.com>
This commit is contained in:
parent
8c9eb0e373
commit
21b539711a
@ -229,8 +229,6 @@ static unsigned int nr_minors;
|
||||
static unsigned long *minors;
|
||||
static DEFINE_SPINLOCK(minor_lock);
|
||||
|
||||
#define GRANT_INVALID_REF 0
|
||||
|
||||
#define PARTS_PER_DISK 16
|
||||
#define PARTS_PER_EXT_DISK 256
|
||||
|
||||
@ -321,7 +319,7 @@ static int fill_grant_buffer(struct blkfront_ring_info *rinfo, int num)
|
||||
gnt_list_entry->page = granted_page;
|
||||
}
|
||||
|
||||
gnt_list_entry->gref = GRANT_INVALID_REF;
|
||||
gnt_list_entry->gref = INVALID_GRANT_REF;
|
||||
list_add(&gnt_list_entry->node, &rinfo->grants);
|
||||
i++;
|
||||
}
|
||||
@ -350,7 +348,7 @@ static struct grant *get_free_grant(struct blkfront_ring_info *rinfo)
|
||||
node);
|
||||
list_del(&gnt_list_entry->node);
|
||||
|
||||
if (gnt_list_entry->gref != GRANT_INVALID_REF)
|
||||
if (gnt_list_entry->gref != INVALID_GRANT_REF)
|
||||
rinfo->persistent_gnts_c--;
|
||||
|
||||
return gnt_list_entry;
|
||||
@ -372,7 +370,7 @@ static struct grant *get_grant(grant_ref_t *gref_head,
|
||||
struct grant *gnt_list_entry = get_free_grant(rinfo);
|
||||
struct blkfront_info *info = rinfo->dev_info;
|
||||
|
||||
if (gnt_list_entry->gref != GRANT_INVALID_REF)
|
||||
if (gnt_list_entry->gref != INVALID_GRANT_REF)
|
||||
return gnt_list_entry;
|
||||
|
||||
/* Assign a gref to this page */
|
||||
@ -396,7 +394,7 @@ static struct grant *get_indirect_grant(grant_ref_t *gref_head,
|
||||
struct grant *gnt_list_entry = get_free_grant(rinfo);
|
||||
struct blkfront_info *info = rinfo->dev_info;
|
||||
|
||||
if (gnt_list_entry->gref != GRANT_INVALID_REF)
|
||||
if (gnt_list_entry->gref != INVALID_GRANT_REF)
|
||||
return gnt_list_entry;
|
||||
|
||||
/* Assign a gref to this page */
|
||||
@ -1221,7 +1219,7 @@ static void blkif_free_ring(struct blkfront_ring_info *rinfo)
|
||||
list_for_each_entry_safe(persistent_gnt, n,
|
||||
&rinfo->grants, node) {
|
||||
list_del(&persistent_gnt->node);
|
||||
if (persistent_gnt->gref != GRANT_INVALID_REF) {
|
||||
if (persistent_gnt->gref != INVALID_GRANT_REF) {
|
||||
gnttab_end_foreign_access(persistent_gnt->gref,
|
||||
0UL);
|
||||
rinfo->persistent_gnts_c--;
|
||||
@ -1283,9 +1281,9 @@ free_shadow:
|
||||
|
||||
/* Free resources associated with old device channel. */
|
||||
for (i = 0; i < info->nr_ring_pages; i++) {
|
||||
if (rinfo->ring_ref[i] != GRANT_INVALID_REF) {
|
||||
if (rinfo->ring_ref[i] != INVALID_GRANT_REF) {
|
||||
gnttab_end_foreign_access(rinfo->ring_ref[i], 0);
|
||||
rinfo->ring_ref[i] = GRANT_INVALID_REF;
|
||||
rinfo->ring_ref[i] = INVALID_GRANT_REF;
|
||||
}
|
||||
}
|
||||
free_pages_exact(rinfo->ring.sring,
|
||||
@ -1475,7 +1473,7 @@ static int blkif_completion(unsigned long *id,
|
||||
* to the tail of the list, so it will not be picked
|
||||
* again unless we run out of persistent grants.
|
||||
*/
|
||||
s->grants_used[i]->gref = GRANT_INVALID_REF;
|
||||
s->grants_used[i]->gref = INVALID_GRANT_REF;
|
||||
list_add_tail(&s->grants_used[i]->node, &rinfo->grants);
|
||||
}
|
||||
}
|
||||
@ -1500,7 +1498,7 @@ static int blkif_completion(unsigned long *id,
|
||||
indirect_page = s->indirect_grants[i]->page;
|
||||
list_add(&indirect_page->lru, &rinfo->indirect_pages);
|
||||
}
|
||||
s->indirect_grants[i]->gref = GRANT_INVALID_REF;
|
||||
s->indirect_grants[i]->gref = INVALID_GRANT_REF;
|
||||
list_add_tail(&s->indirect_grants[i]->node, &rinfo->grants);
|
||||
}
|
||||
}
|
||||
@ -1687,7 +1685,7 @@ static int setup_blkring(struct xenbus_device *dev,
|
||||
grant_ref_t gref[XENBUS_MAX_RING_GRANTS];
|
||||
|
||||
for (i = 0; i < info->nr_ring_pages; i++)
|
||||
rinfo->ring_ref[i] = GRANT_INVALID_REF;
|
||||
rinfo->ring_ref[i] = INVALID_GRANT_REF;
|
||||
|
||||
sring = alloc_pages_exact(ring_size, GFP_NOIO);
|
||||
if (!sring) {
|
||||
@ -2544,13 +2542,13 @@ static void purge_persistent_grants(struct blkfront_info *info)
|
||||
|
||||
list_for_each_entry_safe(gnt_list_entry, tmp, &rinfo->grants,
|
||||
node) {
|
||||
if (gnt_list_entry->gref == GRANT_INVALID_REF ||
|
||||
if (gnt_list_entry->gref == INVALID_GRANT_REF ||
|
||||
!gnttab_try_end_foreign_access(gnt_list_entry->gref))
|
||||
continue;
|
||||
|
||||
list_del(&gnt_list_entry->node);
|
||||
rinfo->persistent_gnts_c--;
|
||||
gnt_list_entry->gref = GRANT_INVALID_REF;
|
||||
gnt_list_entry->gref = INVALID_GRANT_REF;
|
||||
list_add_tail(&gnt_list_entry->node, &grants);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user