]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: Fix overallocation in xfs_buf_allocate_memory()
authorJan Kara <jack@suse.cz>
Tue, 5 Jun 2012 22:32:26 +0000 (00:32 +0200)
committerBen Myers <bpm@sgi.com>
Thu, 21 Jun 2012 19:20:36 +0000 (14:20 -0500)
commit1b38b1b5330c8cd3b204f02eb5581f9a7f048797
tree32d64523ae5c46b4959876a3d6b498adb6452dbc
parentb66d1466e931e0651d13a684f5afc335eb0c4e43
xfs: Fix overallocation in xfs_buf_allocate_memory()

Commit eb6642f which removed b_file_offset in favor of b_bn introduced a bug
causing xfs_buf_allocate_memory() to overestimate the number of necessary
pages. The problem is that xfs_buf_alloc() sets b_bn to -1 and thus effectively
every buffer is straddling a page boundary which causes
xfs_buf_allocate_memory() to allocate two pages and use vmalloc() for access
which is unnecessary.

Dave says xfs_buf_alloc() doesn't need to set b_bn to -1 anymore since the
buffer is inserted into the cache only after being fully initialized now.
So just make xfs_buf_alloc() fill in proper block number from the beginning.

CC: David Chinner <dchinner@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
fs/xfs/xfs_buf.c