public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* Review: Don't use kmap() in xfs_iozero().
@ 2007-02-02  5:40 David Chinner
  2007-02-02 11:48 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: David Chinner @ 2007-02-02  5:40 UTC (permalink / raw)
  To: xfs-dev; +Cc: xfs

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)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-02-02 18:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-02  5:40 Review: Don't use kmap() in xfs_iozero() David Chinner
2007-02-02 11:48 ` Christoph Hellwig
2007-02-02 13:39   ` David Chinner
2007-02-02 18:06     ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox