diff options
author | Anton Altaparmakov <aia21@cantab.net> | 2005-09-08 16:43:47 -0400 |
---|---|---|
committer | Anton Altaparmakov <aia21@cantab.net> | 2005-09-08 16:43:47 -0400 |
commit | 54b02eb01c0172294e43e2b54d6815f65637c111 (patch) | |
tree | 0dec3c7f9553f96e3edeab769077723d1ab922e1 /fs | |
parent | bd45fdd209ca49c5010ac9af469c41ae6dd3f145 (diff) |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ntfs/ChangeLog | 3 | ||||
-rw-r--r-- | fs/ntfs/aops.c | 13 |
2 files changed, 6 insertions, 10 deletions
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog index 4b8666d7e7fe..10fc2385efa7 100644 --- a/fs/ntfs/ChangeLog +++ b/fs/ntfs/ChangeLog | |||
@@ -81,6 +81,9 @@ ToDo/Notes: | |||
81 | only zeroes. | 81 | only zeroes. |
82 | - Fixup handling of sparse, compressed, and encrypted attributes in | 82 | - Fixup handling of sparse, compressed, and encrypted attributes in |
83 | fs/ntfs/aops.c::ntfs_writepage(). | 83 | fs/ntfs/aops.c::ntfs_writepage(). |
84 | - Optimize fs/ntfs/aops.c::ntfs_write_block() by extending the page | ||
85 | lock protection over the buffer submission for i/o which allows the | ||
86 | removal of the get_bh()/put_bh() pairs for each buffer. | ||
84 | 87 | ||
85 | 2.1.23 - Implement extension of resident files and make writing safe as well as | 88 | 2.1.23 - Implement extension of resident files and make writing safe as well as |
86 | many bug fixes, cleanups, and enhancements... | 89 | many bug fixes, cleanups, and enhancements... |
diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c index 6f2954aac5a2..821dad7d14c8 100644 --- a/fs/ntfs/aops.c +++ b/fs/ntfs/aops.c | |||
@@ -735,7 +735,7 @@ lock_retry_remap: | |||
735 | /* For the error case, need to reset bh to the beginning. */ | 735 | /* For the error case, need to reset bh to the beginning. */ |
736 | bh = head; | 736 | bh = head; |
737 | 737 | ||
738 | /* Just an optimization, so ->readpage() isn't called later. */ | 738 | /* Just an optimization, so ->readpage() is not called later. */ |
739 | if (unlikely(!PageUptodate(page))) { | 739 | if (unlikely(!PageUptodate(page))) { |
740 | int uptodate = 1; | 740 | int uptodate = 1; |
741 | do { | 741 | do { |
@@ -751,7 +751,6 @@ lock_retry_remap: | |||
751 | 751 | ||
752 | /* Setup all mapped, dirty buffers for async write i/o. */ | 752 | /* Setup all mapped, dirty buffers for async write i/o. */ |
753 | do { | 753 | do { |
754 | get_bh(bh); | ||
755 | if (buffer_mapped(bh) && buffer_dirty(bh)) { | 754 | if (buffer_mapped(bh) && buffer_dirty(bh)) { |
756 | lock_buffer(bh); | 755 | lock_buffer(bh); |
757 | if (test_clear_buffer_dirty(bh)) { | 756 | if (test_clear_buffer_dirty(bh)) { |
@@ -789,14 +788,8 @@ lock_retry_remap: | |||
789 | 788 | ||
790 | BUG_ON(PageWriteback(page)); | 789 | BUG_ON(PageWriteback(page)); |
791 | set_page_writeback(page); /* Keeps try_to_free_buffers() away. */ | 790 | set_page_writeback(page); /* Keeps try_to_free_buffers() away. */ |
792 | unlock_page(page); | ||
793 | 791 | ||
794 | /* | 792 | /* Submit the prepared buffers for i/o. */ |
795 | * Submit the prepared buffers for i/o. Note the page is unlocked, | ||
796 | * and the async write i/o completion handler can end_page_writeback() | ||
797 | * at any time after the *first* submit_bh(). So the buffers can then | ||
798 | * disappear... | ||
799 | */ | ||
800 | need_end_writeback = TRUE; | 793 | need_end_writeback = TRUE; |
801 | do { | 794 | do { |
802 | struct buffer_head *next = bh->b_this_page; | 795 | struct buffer_head *next = bh->b_this_page; |
@@ -804,9 +797,9 @@ lock_retry_remap: | |||
804 | submit_bh(WRITE, bh); | 797 | submit_bh(WRITE, bh); |
805 | need_end_writeback = FALSE; | 798 | need_end_writeback = FALSE; |
806 | } | 799 | } |
807 | put_bh(bh); | ||
808 | bh = next; | 800 | bh = next; |
809 | } while (bh != head); | 801 | } while (bh != head); |
802 | unlock_page(page); | ||
810 | 803 | ||
811 | /* If no i/o was started, need to end_page_writeback(). */ | 804 | /* If no i/o was started, need to end_page_writeback(). */ |
812 | if (unlikely(need_end_writeback)) | 805 | if (unlikely(need_end_writeback)) |