xfs
[Top] [All Lists]

Review: Don't use kmap() in xfs_iozero().

To: xfs-dev@xxxxxxx
Subject: Review: Don't use kmap() in xfs_iozero().
From: David Chinner <dgc@xxxxxxx>
Date: Fri, 2 Feb 2007 16:40:44 +1100
Cc: xfs@xxxxxxxxxxx
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.4.2.1i
kmap is inefficient and does scale well. kmap_atomic() is a better
choice. Use the generic wrapper function instead of open coding the
kmap-memset-dcache flush-kumap stuff.  Suggested by Andrew Morton.

Comments?

Cheers,

Dave.
-- 
Dave Chinner
Principal Engineer
SGI Australian Software Group

---
 fs/xfs/linux-2.6/xfs_lrw.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Index: 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_lrw.c
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/linux-2.6/xfs_lrw.c       2007-01-31 
13:56:12.000000000 +1100
+++ 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_lrw.c    2007-01-31 14:19:50.379179841 
+1100
@@ -138,7 +138,6 @@ xfs_iozero(
        unsigned                bytes;
        struct page             *page;
        struct address_space    *mapping;
-       char                    *kaddr;
        int                     status;
 
        mapping = ip->i_mapping;
@@ -156,15 +155,13 @@ xfs_iozero(
                if (!page)
                        break;
 
-               kaddr = kmap(page);
                status = mapping->a_ops->prepare_write(NULL, page, offset,
                                                        offset + bytes);
-               if (status) {
+               if (status)
                        goto unlock;
-               }
 
-               memset((void *) (kaddr + offset), 0, bytes);
-               flush_dcache_page(page);
+               memclear_highpage_flush(page, (unsigned int)offset, bytes);
+
                status = mapping->a_ops->commit_write(NULL, page, offset,
                                                        offset + bytes);
                if (!status) {
@@ -175,7 +172,6 @@ xfs_iozero(
                }
 
 unlock:
-               kunmap(page);
                unlock_page(page);
                page_cache_release(page);
                if (status)


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