diff options
author | Yan, Zheng <zheng.z.yan@linux.intel.com> | 2011-01-18 13:34:40 +0800 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-02-07 14:13:51 -0500 |
commit | 3a90983dbdcb2f4f48c0d771d8e5b4d88f27fae6 (patch) | |
tree | 3179f5e834e482cc3f782e709a53b08591416c76 /fs | |
parent | 8e4eef7a60eeca0fe7503e5cbd3b24ff4941c732 (diff) | |
download | kernel-common-3a90983dbdcb2f4f48c0d771d8e5b4d88f27fae6.tar.gz kernel-common-3a90983dbdcb2f4f48c0d771d8e5b4d88f27fae6.tar.bz2 kernel-common-3a90983dbdcb2f4f48c0d771d8e5b4d88f27fae6.zip |
Btrfs: Fix page count calculation
take offset of start position into account when calculating page count.
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/file.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 9e097fbfc78d..b0ff34b96607 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -991,8 +991,8 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, size_t write_bytes = min(iov_iter_count(&i), nrptrs * (size_t)PAGE_CACHE_SIZE - offset); - size_t num_pages = (write_bytes + PAGE_CACHE_SIZE - 1) >> - PAGE_CACHE_SHIFT; + size_t num_pages = (write_bytes + offset + + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; WARN_ON(num_pages > nrptrs); memset(pages, 0, sizeof(struct page *) * nrptrs); @@ -1022,8 +1022,8 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, copied = btrfs_copy_from_user(pos, num_pages, write_bytes, pages, &i); - dirty_pages = (copied + PAGE_CACHE_SIZE - 1) >> - PAGE_CACHE_SHIFT; + dirty_pages = (copied + offset + PAGE_CACHE_SIZE - 1) >> + PAGE_CACHE_SHIFT; if (num_pages > dirty_pages) { if (copied > 0) |