diff options
author | Richard Weinberger <richard@nod.at> | 2015-03-04 14:58:39 -0500 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2015-03-26 18:27:53 -0400 |
commit | af6aa1b9cad7350d675fe3523ab062e0e4c829cb (patch) | |
tree | 75bb30ea47d2d222b50d7bf5b458ecd3b127a326 /fs/hostfs | |
parent | b86b413a321105cb75373b48fd7ba53fcbc7ec4c (diff) |
hostfs: Use page_offset()
The kernel offers a helper function for that, use it.
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/hostfs')
-rw-r--r-- | fs/hostfs/hostfs_kern.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index f1547479e62e..f82f98a517f7 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -410,7 +410,7 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc) | |||
410 | struct address_space *mapping = page->mapping; | 410 | struct address_space *mapping = page->mapping; |
411 | struct inode *inode = mapping->host; | 411 | struct inode *inode = mapping->host; |
412 | char *buffer; | 412 | char *buffer; |
413 | unsigned long long base; | 413 | loff_t base = page_offset(page); |
414 | int count = PAGE_CACHE_SIZE; | 414 | int count = PAGE_CACHE_SIZE; |
415 | int end_index = inode->i_size >> PAGE_CACHE_SHIFT; | 415 | int end_index = inode->i_size >> PAGE_CACHE_SHIFT; |
416 | int err; | 416 | int err; |
@@ -419,7 +419,6 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc) | |||
419 | count = inode->i_size & (PAGE_CACHE_SIZE-1); | 419 | count = inode->i_size & (PAGE_CACHE_SIZE-1); |
420 | 420 | ||
421 | buffer = kmap(page); | 421 | buffer = kmap(page); |
422 | base = ((unsigned long long) page->index) << PAGE_CACHE_SHIFT; | ||
423 | 422 | ||
424 | err = write_file(HOSTFS_I(inode)->fd, &base, buffer, count); | 423 | err = write_file(HOSTFS_I(inode)->fd, &base, buffer, count); |
425 | if (err != count) { | 424 | if (err != count) { |
@@ -444,10 +443,9 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc) | |||
444 | static int hostfs_readpage(struct file *file, struct page *page) | 443 | static int hostfs_readpage(struct file *file, struct page *page) |
445 | { | 444 | { |
446 | char *buffer; | 445 | char *buffer; |
447 | long long start; | 446 | loff_t start = page_offset(page); |
448 | int bytes_read, ret = 0; | 447 | int bytes_read, ret = 0; |
449 | 448 | ||
450 | start = (long long) page->index << PAGE_CACHE_SHIFT; | ||
451 | buffer = kmap(page); | 449 | buffer = kmap(page); |
452 | bytes_read = read_file(FILE_HOSTFS_I(file)->fd, &start, buffer, | 450 | bytes_read = read_file(FILE_HOSTFS_I(file)->fd, &start, buffer, |
453 | PAGE_CACHE_SIZE); | 451 | PAGE_CACHE_SIZE); |