pnfs/blocklayout: fix end calculation in pnfs_num_cont_bytes
authorChristoph Hellwig <hch@lst.de>
Mon, 24 Nov 2014 21:47:02 +0000 (16:47 -0500)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Mon, 24 Nov 2014 22:00:41 +0000 (17:00 -0500)
Use the number of pages in the pagecache mapping instead of the
number of pnfs requests which is only slightly related.

Reported-by: Weston Andros Adamson <dros@primarydata.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/blocklayout/blocklayout.c

index 4f46f7a05289ba957e219df793b68dfa2f037bb5..77fec6a55f5795b5aa0cc6142de72f1b10dbf0f3 100644 (file)
@@ -812,7 +812,7 @@ static u64 pnfs_num_cont_bytes(struct inode *inode, pgoff_t idx)
 
        /* Optimize common case that writes from 0 to end of file */
        end = DIV_ROUND_UP(i_size_read(inode), PAGE_CACHE_SIZE);
-       if (end != NFS_I(inode)->npages) {
+       if (end != inode->i_mapping->nrpages) {
                rcu_read_lock();
                end = page_cache_next_hole(mapping, idx + 1, ULONG_MAX);
                rcu_read_unlock();