[patch 7/19] mark_buffer_dirty_inode() speedup

From: Andrew Morton (akpm@zip.com.au)
Date: Mon Jun 17 2002 - 01:52:00 EST


buffer_insert_list() is showing up on Anton's graphs. It'll be via
ext2's mark_buffer_dirty_inode() against indirect blocks. If the
buffer is already on an inode queue, we know that it is on the correct
inode's queue so we don't need to re-add it.

--- 2.5.22/fs/buffer.c~mark_buffer_dirty_inode-speedup Sun Jun 16 22:50:18 2002
+++ 2.5.22-akpm/fs/buffer.c Sun Jun 16 23:22:47 2002
@@ -856,8 +856,9 @@ void mark_buffer_dirty_inode(struct buff
                 if (mapping->assoc_mapping != buffer_mapping)
                         BUG();
         }
- buffer_insert_list(&buffer_mapping->private_lock,
- bh, &mapping->private_list);
+ if (list_empty(&bh->b_assoc_buffers))
+ buffer_insert_list(&buffer_mapping->private_lock,
+ bh, &mapping->private_list);
 }
 EXPORT_SYMBOL(mark_buffer_dirty_inode);
 
@@ -1243,10 +1244,17 @@ void __brelse(struct buffer_head * buf)
  * bforget() is like brelse(), except it discards any
  * potentially dirty data.
  */
-void __bforget(struct buffer_head * buf)
+void __bforget(struct buffer_head *bh)
 {
- clear_buffer_dirty(buf);
- __brelse(buf);
+ clear_buffer_dirty(bh);
+ if (!list_empty(&bh->b_assoc_buffers)) {
+ struct address_space *buffer_mapping = bh->b_page->mapping;
+
+ spin_lock(&buffer_mapping->private_lock);
+ list_del_init(&bh->b_assoc_buffers);
+ spin_unlock(&buffer_mapping->private_lock);
+ }
+ __brelse(bh);
 }
 
 /**

-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jun 23 2002 - 22:00:12 EST