diff options
Diffstat (limited to 'xen-mapcache.c')
-rw-r--r-- | xen-mapcache.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/xen-mapcache.c b/xen-mapcache.c index a456479363..75ac313f28 100644 --- a/xen-mapcache.c +++ b/xen-mapcache.c @@ -216,12 +216,14 @@ tryagain: } /* size is always a multiple of MCACHE_BUCKET_SIZE */ - if ((address_offset + (__size % MCACHE_BUCKET_SIZE)) > MCACHE_BUCKET_SIZE) - __size += MCACHE_BUCKET_SIZE; - if (__size % MCACHE_BUCKET_SIZE) - __size += MCACHE_BUCKET_SIZE - (__size % MCACHE_BUCKET_SIZE); - if (!__size) + if (size) { + __size = size + address_offset; + if (__size % MCACHE_BUCKET_SIZE) { + __size += MCACHE_BUCKET_SIZE - (__size % MCACHE_BUCKET_SIZE); + } + } else { __size = MCACHE_BUCKET_SIZE; + } entry = &mapcache->entry[address_index % mapcache->nr_buckets]; |