Is this correct?

Fixes to the use of page_cache_xx functions in xfs

Signed-off-by: Christoph Lameter <[EMAIL PROTECTED]>

---
 fs/xfs/linux-2.6/xfs_aops.c |   18 ++++++++----------
 fs/xfs/linux-2.6/xfs_lrw.c  |    2 +-
 2 files changed, 9 insertions(+), 11 deletions(-)

Index: mm/fs/xfs/linux-2.6/xfs_aops.c
===================================================================
--- mm.orig/fs/xfs/linux-2.6/xfs_aops.c 2007-11-28 19:13:13.323382722 -0800
+++ mm/fs/xfs/linux-2.6/xfs_aops.c      2007-11-28 20:04:24.230882714 -0800
@@ -75,7 +75,7 @@ xfs_page_trace(
        xfs_inode_t     *ip;
        bhv_vnode_t     *vp = vn_from_inode(inode);
        loff_t          isize = i_size_read(inode);
-       loff_t          offset = page_cache_offset(page->mapping);
+       loff_t          offset = page_cache_pos(page->mapping, page->index, 0);
        int             delalloc = -1, unmapped = -1, unwritten = -1;
 
        if (page_has_buffers(page))
@@ -780,12 +780,11 @@ xfs_convert_page(
         * count of buffers on the page.
         */
        end_offset = min_t(unsigned long long,
-                       (xfs_off_t)(page->index + 1) << page_cache_shift(map),
+                       (xfs_off_t)page_cache_pos(map, page->index + 1, 0),
                        i_size_read(inode));
 
        len = 1 << inode->i_blkbits;
-       p_offset = min_t(unsigned long, page_cache_offset(map, end_offset),
-                                       page_cache_size(map));
+       p_offset = page_cache_offset(map, end_offset);
        p_offset = p_offset ? roundup(p_offset, len) : page_cache_size(map);
        page_dirty = p_offset / len;
 
@@ -943,7 +942,6 @@ xfs_page_state_convert(
        int                     trylock = 0;
        int                     all_bh = unmapped;
        struct address_space    *map = inode->i_mapping;
-       int                     pagesize = page_cache_size(map);
 
        if (startio) {
                if (wbc->sync_mode == WB_SYNC_NONE && wbc->nonblocking)
@@ -979,9 +977,9 @@ xfs_page_state_convert(
        end_offset = min_t(unsigned long long,
                        (xfs_off_t)page_cache_pos(map, page->index + 1, 0), 
offset);
        len = 1 << inode->i_blkbits;
-       p_offset = min_t(unsigned long, page_cache_offset(map, end_offset),
-                                       pagesize);
-       p_offset = p_offset ? roundup(p_offset, len) : pagesize;
+       p_offset = page_cache_offset(map, end_offset);
+       p_offset = p_offset ? roundup(p_offset, len) : page_cache_size(map);
+
        page_dirty = p_offset / len;
 
        bh = head = page_buffers(page);
@@ -1132,8 +1130,8 @@ xfs_page_state_convert(
                xfs_start_page_writeback(page, wbc, 1, count);
 
        if (ioend && iomap_valid) {
-               offset = (iomap.iomap_offset + iomap.iomap_bsize - 1) >>
-                                       page_cache_shift(map);
+               offset = page_cache_index(map,
+                       (iomap.iomap_offset + iomap.iomap_bsize - 1));
                tlast = min_t(pgoff_t, offset, last_index);
                xfs_cluster_write(inode, page->index + 1, &iomap, &ioend,
                                        wbc, startio, all_bh, tlast);
Index: mm/fs/xfs/linux-2.6/xfs_lrw.c
===================================================================
--- mm.orig/fs/xfs/linux-2.6/xfs_lrw.c  2007-11-28 19:22:35.454383115 -0800
+++ mm/fs/xfs/linux-2.6/xfs_lrw.c       2007-11-28 19:22:59.222132796 -0800
@@ -142,7 +142,7 @@ xfs_iozero(
                unsigned offset, bytes;
                void *fsdata;
 
-               offset = page_cache_offset(mapping, pos); /* Within page */
+               offset = page_cache_offset(mapping, pos);
                bytes = page_cache_size(mapping) - offset;
                if (bytes > count)
                        bytes = count;
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to