]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
hostfs: Use page_offset()
authorRichard Weinberger <richard@nod.at>
Wed, 4 Mar 2015 19:58:39 +0000 (20:58 +0100)
committerRichard Weinberger <richard@nod.at>
Thu, 26 Mar 2015 22:27:53 +0000 (23:27 +0100)
The kernel offers a helper function for that, use it.

Signed-off-by: Richard Weinberger <richard@nod.at>
fs/hostfs/hostfs_kern.c

index f1547479e62e133ae2436e0c942644b955170d1a..f82f98a517f77984b6f9e42e5b88dadf4f7aa06b 100644 (file)
@@ -410,7 +410,7 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc)
        struct address_space *mapping = page->mapping;
        struct inode *inode = mapping->host;
        char *buffer;
-       unsigned long long base;
+       loff_t base = page_offset(page);
        int count = PAGE_CACHE_SIZE;
        int end_index = inode->i_size >> PAGE_CACHE_SHIFT;
        int err;
@@ -419,7 +419,6 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc)
                count = inode->i_size & (PAGE_CACHE_SIZE-1);
 
        buffer = kmap(page);
-       base = ((unsigned long long) page->index) << PAGE_CACHE_SHIFT;
 
        err = write_file(HOSTFS_I(inode)->fd, &base, buffer, count);
        if (err != count) {
@@ -444,10 +443,9 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc)
 static int hostfs_readpage(struct file *file, struct page *page)
 {
        char *buffer;
-       long long start;
+       loff_t start = page_offset(page);
        int bytes_read, ret = 0;
 
-       start = (long long) page->index << PAGE_CACHE_SHIFT;
        buffer = kmap(page);
        bytes_read = read_file(FILE_HOSTFS_I(file)->fd, &start, buffer,
                        PAGE_CACHE_SIZE);