diff options
Diffstat (limited to 'fs/buffer.c')
-rw-r--r-- | fs/buffer.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index c017a2dfb909..b4dcb34c9635 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/bitops.h> | 41 | #include <linux/bitops.h> |
42 | #include <linux/mpage.h> | 42 | #include <linux/mpage.h> |
43 | #include <linux/bit_spinlock.h> | 43 | #include <linux/bit_spinlock.h> |
44 | #include <trace/events/block.h> | ||
44 | 45 | ||
45 | static int fsync_buffers_list(spinlock_t *lock, struct list_head *list); | 46 | static int fsync_buffers_list(spinlock_t *lock, struct list_head *list); |
46 | 47 | ||
@@ -53,6 +54,13 @@ void init_buffer(struct buffer_head *bh, bh_end_io_t *handler, void *private) | |||
53 | } | 54 | } |
54 | EXPORT_SYMBOL(init_buffer); | 55 | EXPORT_SYMBOL(init_buffer); |
55 | 56 | ||
57 | inline void touch_buffer(struct buffer_head *bh) | ||
58 | { | ||
59 | trace_block_touch_buffer(bh); | ||
60 | mark_page_accessed(bh->b_page); | ||
61 | } | ||
62 | EXPORT_SYMBOL(touch_buffer); | ||
63 | |||
56 | static int sleep_on_buffer(void *word) | 64 | static int sleep_on_buffer(void *word) |
57 | { | 65 | { |
58 | io_schedule(); | 66 | io_schedule(); |
@@ -1113,6 +1121,8 @@ void mark_buffer_dirty(struct buffer_head *bh) | |||
1113 | { | 1121 | { |
1114 | WARN_ON_ONCE(!buffer_uptodate(bh)); | 1122 | WARN_ON_ONCE(!buffer_uptodate(bh)); |
1115 | 1123 | ||
1124 | trace_block_dirty_buffer(bh); | ||
1125 | |||
1116 | /* | 1126 | /* |
1117 | * Very *carefully* optimize the it-is-already-dirty case. | 1127 | * Very *carefully* optimize the it-is-already-dirty case. |
1118 | * | 1128 | * |
@@ -2332,7 +2342,7 @@ int __block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, | |||
2332 | get_block_t get_block) | 2342 | get_block_t get_block) |
2333 | { | 2343 | { |
2334 | struct page *page = vmf->page; | 2344 | struct page *page = vmf->page; |
2335 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | 2345 | struct inode *inode = file_inode(vma->vm_file); |
2336 | unsigned long end; | 2346 | unsigned long end; |
2337 | loff_t size; | 2347 | loff_t size; |
2338 | int ret; | 2348 | int ret; |
@@ -2359,7 +2369,7 @@ int __block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, | |||
2359 | if (unlikely(ret < 0)) | 2369 | if (unlikely(ret < 0)) |
2360 | goto out_unlock; | 2370 | goto out_unlock; |
2361 | set_page_dirty(page); | 2371 | set_page_dirty(page); |
2362 | wait_on_page_writeback(page); | 2372 | wait_for_stable_page(page); |
2363 | return 0; | 2373 | return 0; |
2364 | out_unlock: | 2374 | out_unlock: |
2365 | unlock_page(page); | 2375 | unlock_page(page); |
@@ -2371,7 +2381,7 @@ int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, | |||
2371 | get_block_t get_block) | 2381 | get_block_t get_block) |
2372 | { | 2382 | { |
2373 | int ret; | 2383 | int ret; |
2374 | struct super_block *sb = vma->vm_file->f_path.dentry->d_inode->i_sb; | 2384 | struct super_block *sb = file_inode(vma->vm_file)->i_sb; |
2375 | 2385 | ||
2376 | sb_start_pagefault(sb); | 2386 | sb_start_pagefault(sb); |
2377 | 2387 | ||
@@ -2935,6 +2945,7 @@ static void guard_bh_eod(int rw, struct bio *bio, struct buffer_head *bh) | |||
2935 | void *kaddr = kmap_atomic(bh->b_page); | 2945 | void *kaddr = kmap_atomic(bh->b_page); |
2936 | memset(kaddr + bh_offset(bh) + bytes, 0, bh->b_size - bytes); | 2946 | memset(kaddr + bh_offset(bh) + bytes, 0, bh->b_size - bytes); |
2937 | kunmap_atomic(kaddr); | 2947 | kunmap_atomic(kaddr); |
2948 | flush_dcache_page(bh->b_page); | ||
2938 | } | 2949 | } |
2939 | } | 2950 | } |
2940 | 2951 | ||
@@ -3226,7 +3237,7 @@ static struct kmem_cache *bh_cachep __read_mostly; | |||
3226 | * Once the number of bh's in the machine exceeds this level, we start | 3237 | * Once the number of bh's in the machine exceeds this level, we start |
3227 | * stripping them in writeback. | 3238 | * stripping them in writeback. |
3228 | */ | 3239 | */ |
3229 | static int max_buffer_heads; | 3240 | static unsigned long max_buffer_heads; |
3230 | 3241 | ||
3231 | int buffer_heads_over_limit; | 3242 | int buffer_heads_over_limit; |
3232 | 3243 | ||
@@ -3342,7 +3353,7 @@ EXPORT_SYMBOL(bh_submit_read); | |||
3342 | 3353 | ||
3343 | void __init buffer_init(void) | 3354 | void __init buffer_init(void) |
3344 | { | 3355 | { |
3345 | int nrpages; | 3356 | unsigned long nrpages; |
3346 | 3357 | ||
3347 | bh_cachep = kmem_cache_create("buffer_head", | 3358 | bh_cachep = kmem_cache_create("buffer_head", |
3348 | sizeof(struct buffer_head), 0, | 3359 | sizeof(struct buffer_head), 0, |