Fix calculation of number of pages in a PRP List
authorNisheeth Bhat <nisheeth.bhat@intel.com>
Thu, 29 Sep 2011 14:10:10 +0000 (10:10 -0400)
committerMatthew Wilcox <matthew.r.wilcox@intel.com>
Fri, 4 Nov 2011 19:53:04 +0000 (15:53 -0400)
commit0d1bc9125890426b52ca2de6abedd32e31722e5c
treec62cff35187c87c8a2b1f6dafdfc577cba94c137
parentbc5fc7e4b22ca855902aba02b28c96f09b446407
Fix calculation of number of pages in a PRP List

The existing calculation underestimated the number of pages required
as it did not take into account the pointer at the end of each page.
The replacement calculation may overestimate the number of pages required
if the last page in the PRP List is entirely full.  By using ->npages
as a counter as we fill in the pages, we ensure that we don't try to
free a page that was never allocated.

Signed-off-by: Nisheeth Bhat <nisheeth.bhat@intel.com>
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
drivers/block/nvme.c