diff options
Diffstat (limited to 'fs/buffer.c')
-rw-r--r-- | fs/buffer.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index ec0aca8ba6bf..7a75c3e0fd58 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -46,8 +46,7 @@ static int fsync_buffers_list(spinlock_t *lock, struct list_head *list); | |||
46 | 46 | ||
47 | #define BH_ENTRY(list) list_entry((list), struct buffer_head, b_assoc_buffers) | 47 | #define BH_ENTRY(list) list_entry((list), struct buffer_head, b_assoc_buffers) |
48 | 48 | ||
49 | inline void | 49 | void init_buffer(struct buffer_head *bh, bh_end_io_t *handler, void *private) |
50 | init_buffer(struct buffer_head *bh, bh_end_io_t *handler, void *private) | ||
51 | { | 50 | { |
52 | bh->b_end_io = handler; | 51 | bh->b_end_io = handler; |
53 | bh->b_private = private; | 52 | bh->b_private = private; |
@@ -555,7 +554,7 @@ void emergency_thaw_all(void) | |||
555 | */ | 554 | */ |
556 | int sync_mapping_buffers(struct address_space *mapping) | 555 | int sync_mapping_buffers(struct address_space *mapping) |
557 | { | 556 | { |
558 | struct address_space *buffer_mapping = mapping->assoc_mapping; | 557 | struct address_space *buffer_mapping = mapping->private_data; |
559 | 558 | ||
560 | if (buffer_mapping == NULL || list_empty(&mapping->private_list)) | 559 | if (buffer_mapping == NULL || list_empty(&mapping->private_list)) |
561 | return 0; | 560 | return 0; |
@@ -588,10 +587,10 @@ void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode) | |||
588 | struct address_space *buffer_mapping = bh->b_page->mapping; | 587 | struct address_space *buffer_mapping = bh->b_page->mapping; |
589 | 588 | ||
590 | mark_buffer_dirty(bh); | 589 | mark_buffer_dirty(bh); |
591 | if (!mapping->assoc_mapping) { | 590 | if (!mapping->private_data) { |
592 | mapping->assoc_mapping = buffer_mapping; | 591 | mapping->private_data = buffer_mapping; |
593 | } else { | 592 | } else { |
594 | BUG_ON(mapping->assoc_mapping != buffer_mapping); | 593 | BUG_ON(mapping->private_data != buffer_mapping); |
595 | } | 594 | } |
596 | if (!bh->b_assoc_map) { | 595 | if (!bh->b_assoc_map) { |
597 | spin_lock(&buffer_mapping->private_lock); | 596 | spin_lock(&buffer_mapping->private_lock); |
@@ -788,7 +787,7 @@ void invalidate_inode_buffers(struct inode *inode) | |||
788 | if (inode_has_buffers(inode)) { | 787 | if (inode_has_buffers(inode)) { |
789 | struct address_space *mapping = &inode->i_data; | 788 | struct address_space *mapping = &inode->i_data; |
790 | struct list_head *list = &mapping->private_list; | 789 | struct list_head *list = &mapping->private_list; |
791 | struct address_space *buffer_mapping = mapping->assoc_mapping; | 790 | struct address_space *buffer_mapping = mapping->private_data; |
792 | 791 | ||
793 | spin_lock(&buffer_mapping->private_lock); | 792 | spin_lock(&buffer_mapping->private_lock); |
794 | while (!list_empty(list)) | 793 | while (!list_empty(list)) |
@@ -811,7 +810,7 @@ int remove_inode_buffers(struct inode *inode) | |||
811 | if (inode_has_buffers(inode)) { | 810 | if (inode_has_buffers(inode)) { |
812 | struct address_space *mapping = &inode->i_data; | 811 | struct address_space *mapping = &inode->i_data; |
813 | struct list_head *list = &mapping->private_list; | 812 | struct list_head *list = &mapping->private_list; |
814 | struct address_space *buffer_mapping = mapping->assoc_mapping; | 813 | struct address_space *buffer_mapping = mapping->private_data; |
815 | 814 | ||
816 | spin_lock(&buffer_mapping->private_lock); | 815 | spin_lock(&buffer_mapping->private_lock); |
817 | while (!list_empty(list)) { | 816 | while (!list_empty(list)) { |
@@ -850,13 +849,10 @@ try_again: | |||
850 | if (!bh) | 849 | if (!bh) |
851 | goto no_grow; | 850 | goto no_grow; |
852 | 851 | ||
853 | bh->b_bdev = NULL; | ||
854 | bh->b_this_page = head; | 852 | bh->b_this_page = head; |
855 | bh->b_blocknr = -1; | 853 | bh->b_blocknr = -1; |
856 | head = bh; | 854 | head = bh; |
857 | 855 | ||
858 | bh->b_state = 0; | ||
859 | atomic_set(&bh->b_count, 0); | ||
860 | bh->b_size = size; | 856 | bh->b_size = size; |
861 | 857 | ||
862 | /* Link the buffer to its page */ | 858 | /* Link the buffer to its page */ |
@@ -2939,6 +2935,7 @@ static void guard_bh_eod(int rw, struct bio *bio, struct buffer_head *bh) | |||
2939 | void *kaddr = kmap_atomic(bh->b_page); | 2935 | void *kaddr = kmap_atomic(bh->b_page); |
2940 | memset(kaddr + bh_offset(bh) + bytes, 0, bh->b_size - bytes); | 2936 | memset(kaddr + bh_offset(bh) + bytes, 0, bh->b_size - bytes); |
2941 | kunmap_atomic(kaddr); | 2937 | kunmap_atomic(kaddr); |
2938 | flush_dcache_page(bh->b_page); | ||
2942 | } | 2939 | } |
2943 | } | 2940 | } |
2944 | 2941 | ||