Commit 43967af3 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] mark_buffer_dirty_inode() speedup

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.
parent 374cac7a
...@@ -856,8 +856,9 @@ void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode) ...@@ -856,8 +856,9 @@ void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode)
if (mapping->assoc_mapping != buffer_mapping) if (mapping->assoc_mapping != buffer_mapping)
BUG(); BUG();
} }
buffer_insert_list(&buffer_mapping->private_lock, if (list_empty(&bh->b_assoc_buffers))
bh, &mapping->private_list); buffer_insert_list(&buffer_mapping->private_lock,
bh, &mapping->private_list);
} }
EXPORT_SYMBOL(mark_buffer_dirty_inode); EXPORT_SYMBOL(mark_buffer_dirty_inode);
...@@ -1243,10 +1244,17 @@ void __brelse(struct buffer_head * buf) ...@@ -1243,10 +1244,17 @@ void __brelse(struct buffer_head * buf)
* bforget() is like brelse(), except it discards any * bforget() is like brelse(), except it discards any
* potentially dirty data. * potentially dirty data.
*/ */
void __bforget(struct buffer_head * buf) void __bforget(struct buffer_head *bh)
{ {
clear_buffer_dirty(buf); clear_buffer_dirty(bh);
__brelse(buf); 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);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment