NTFS: Optimize fs/ntfs/aops.c::ntfs_write_block() by extending the page
lock protection over the buffer submission for i/o which allows the removal of the get_bh()/put_bh() pairs for each buffer. Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
This commit is contained in:
parent
bd45fdd209
commit
54b02eb01c
|
@ -81,6 +81,9 @@ ToDo/Notes:
|
||||||
only zeroes.
|
only zeroes.
|
||||||
- Fixup handling of sparse, compressed, and encrypted attributes in
|
- Fixup handling of sparse, compressed, and encrypted attributes in
|
||||||
fs/ntfs/aops.c::ntfs_writepage().
|
fs/ntfs/aops.c::ntfs_writepage().
|
||||||
|
- Optimize fs/ntfs/aops.c::ntfs_write_block() by extending the page
|
||||||
|
lock protection over the buffer submission for i/o which allows the
|
||||||
|
removal of the get_bh()/put_bh() pairs for each buffer.
|
||||||
|
|
||||||
2.1.23 - Implement extension of resident files and make writing safe as well as
|
2.1.23 - Implement extension of resident files and make writing safe as well as
|
||||||
many bug fixes, cleanups, and enhancements...
|
many bug fixes, cleanups, and enhancements...
|
||||||
|
|
|
@ -735,7 +735,7 @@ static int ntfs_write_block(struct page *page, struct writeback_control *wbc)
|
||||||
/* For the error case, need to reset bh to the beginning. */
|
/* For the error case, need to reset bh to the beginning. */
|
||||||
bh = head;
|
bh = head;
|
||||||
|
|
||||||
/* Just an optimization, so ->readpage() isn't called later. */
|
/* Just an optimization, so ->readpage() is not called later. */
|
||||||
if (unlikely(!PageUptodate(page))) {
|
if (unlikely(!PageUptodate(page))) {
|
||||||
int uptodate = 1;
|
int uptodate = 1;
|
||||||
do {
|
do {
|
||||||
|
@ -751,7 +751,6 @@ static int ntfs_write_block(struct page *page, struct writeback_control *wbc)
|
||||||
|
|
||||||
/* Setup all mapped, dirty buffers for async write i/o. */
|
/* Setup all mapped, dirty buffers for async write i/o. */
|
||||||
do {
|
do {
|
||||||
get_bh(bh);
|
|
||||||
if (buffer_mapped(bh) && buffer_dirty(bh)) {
|
if (buffer_mapped(bh) && buffer_dirty(bh)) {
|
||||||
lock_buffer(bh);
|
lock_buffer(bh);
|
||||||
if (test_clear_buffer_dirty(bh)) {
|
if (test_clear_buffer_dirty(bh)) {
|
||||||
|
@ -789,14 +788,8 @@ static int ntfs_write_block(struct page *page, struct writeback_control *wbc)
|
||||||
|
|
||||||
BUG_ON(PageWriteback(page));
|
BUG_ON(PageWriteback(page));
|
||||||
set_page_writeback(page); /* Keeps try_to_free_buffers() away. */
|
set_page_writeback(page); /* Keeps try_to_free_buffers() away. */
|
||||||
unlock_page(page);
|
|
||||||
|
|
||||||
/*
|
/* Submit the prepared buffers for i/o. */
|
||||||
* Submit the prepared buffers for i/o. Note the page is unlocked,
|
|
||||||
* and the async write i/o completion handler can end_page_writeback()
|
|
||||||
* at any time after the *first* submit_bh(). So the buffers can then
|
|
||||||
* disappear...
|
|
||||||
*/
|
|
||||||
need_end_writeback = TRUE;
|
need_end_writeback = TRUE;
|
||||||
do {
|
do {
|
||||||
struct buffer_head *next = bh->b_this_page;
|
struct buffer_head *next = bh->b_this_page;
|
||||||
|
@ -804,9 +797,9 @@ static int ntfs_write_block(struct page *page, struct writeback_control *wbc)
|
||||||
submit_bh(WRITE, bh);
|
submit_bh(WRITE, bh);
|
||||||
need_end_writeback = FALSE;
|
need_end_writeback = FALSE;
|
||||||
}
|
}
|
||||||
put_bh(bh);
|
|
||||||
bh = next;
|
bh = next;
|
||||||
} while (bh != head);
|
} while (bh != head);
|
||||||
|
unlock_page(page);
|
||||||
|
|
||||||
/* If no i/o was started, need to end_page_writeback(). */
|
/* If no i/o was started, need to end_page_writeback(). */
|
||||||
if (unlikely(need_end_writeback))
|
if (unlikely(need_end_writeback))
|
||||||
|
|
Loading…
Reference in New Issue