xfs
[Top] [All Lists]

[PATCH 10/10] xfs: simplify xfs_map_at_offset

To: xfs@xxxxxxxxxxx
Subject: [PATCH 10/10] xfs: simplify xfs_map_at_offset
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Mon, 22 Nov 2010 08:05:16 -0500
References: <20101122130506.868076797@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: quilt/0.48-1
Move the buffer locking into the callers as they need to do it wether they
call xfs_map_at_offset or not.  Remove the b_bdev assignment, which is
already done by get_blocks.  Remove the duplicate extent type asserts in
xfs_convert_page just before calling xfs_map_at_offset.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Index: xfs/fs/xfs/linux-2.6/xfs_aops.c
===================================================================
--- xfs.orig/fs/xfs/linux-2.6/xfs_aops.c        2010-11-19 16:55:59.276019838 
+0100
+++ xfs/fs/xfs/linux-2.6/xfs_aops.c     2010-11-19 16:58:45.791254577 +0100
@@ -626,9 +626,7 @@ xfs_map_at_offset(
        ASSERT(imap->br_startblock != HOLESTARTBLOCK);
        ASSERT(imap->br_startblock != DELAYSTARTBLOCK);
 
-       lock_buffer(bh);
        xfs_map_buffer(inode, bh, imap, offset);
-       bh->b_bdev = xfs_find_bdev_for_inode(inode);
        set_buffer_mapped(bh);
        clear_buffer_delay(bh);
        clear_buffer_unwritten(bh);
@@ -751,12 +749,8 @@ xfs_convert_page(
                                continue;
                        }
 
-                       ASSERT(imap->br_startblock != HOLESTARTBLOCK);
-                       ASSERT(imap->br_startblock != DELAYSTARTBLOCK);
-
-                       if (type == IO_OVERWRITE)
-                               lock_buffer(bh);
-                       else
+                       lock_buffer(bh);
+                       if (type != IO_OVERWRITE)
                                xfs_map_at_offset(inode, bh, imap, offset);
                        xfs_add_to_ioend(inode, bh, offset, type,
                                         ioendp, done);
@@ -1086,9 +1080,8 @@ xfs_vm_writepage(
                        imap_valid = xfs_imap_valid(inode, &imap, offset);
                }
                if (imap_valid) {
-                       if (type == IO_OVERWRITE)
-                               lock_buffer(bh);
-                       else
+                       lock_buffer(bh);
+                       if (type != IO_OVERWRITE)
                                xfs_map_at_offset(inode, bh, &imap, offset);
                        xfs_add_to_ioend(inode, bh, offset, type, &ioend,
                                         new_ioend);

<Prev in Thread] Current Thread [Next in Thread>