diff options
Diffstat (limited to 'fs/buffer.c')
| -rw-r--r-- | fs/buffer.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index 10179cfa1152..c26da785938a 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
| @@ -99,10 +99,18 @@ __clear_page_buffers(struct page *page) | |||
| 99 | page_cache_release(page); | 99 | page_cache_release(page); |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | |||
| 103 | static int quiet_error(struct buffer_head *bh) | ||
| 104 | { | ||
| 105 | if (!test_bit(BH_Quiet, &bh->b_state) && printk_ratelimit()) | ||
| 106 | return 0; | ||
| 107 | return 1; | ||
| 108 | } | ||
| 109 | |||
| 110 | |||
| 102 | static void buffer_io_error(struct buffer_head *bh) | 111 | static void buffer_io_error(struct buffer_head *bh) |
| 103 | { | 112 | { |
| 104 | char b[BDEVNAME_SIZE]; | 113 | char b[BDEVNAME_SIZE]; |
| 105 | |||
| 106 | printk(KERN_ERR "Buffer I/O error on device %s, logical block %Lu\n", | 114 | printk(KERN_ERR "Buffer I/O error on device %s, logical block %Lu\n", |
| 107 | bdevname(bh->b_bdev, b), | 115 | bdevname(bh->b_bdev, b), |
| 108 | (unsigned long long)bh->b_blocknr); | 116 | (unsigned long long)bh->b_blocknr); |
| @@ -144,7 +152,7 @@ void end_buffer_write_sync(struct buffer_head *bh, int uptodate) | |||
| 144 | if (uptodate) { | 152 | if (uptodate) { |
| 145 | set_buffer_uptodate(bh); | 153 | set_buffer_uptodate(bh); |
| 146 | } else { | 154 | } else { |
| 147 | if (!buffer_eopnotsupp(bh) && printk_ratelimit()) { | 155 | if (!buffer_eopnotsupp(bh) && !quiet_error(bh)) { |
| 148 | buffer_io_error(bh); | 156 | buffer_io_error(bh); |
| 149 | printk(KERN_WARNING "lost page write due to " | 157 | printk(KERN_WARNING "lost page write due to " |
| 150 | "I/O error on %s\n", | 158 | "I/O error on %s\n", |
| @@ -394,7 +402,7 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate) | |||
| 394 | set_buffer_uptodate(bh); | 402 | set_buffer_uptodate(bh); |
| 395 | } else { | 403 | } else { |
| 396 | clear_buffer_uptodate(bh); | 404 | clear_buffer_uptodate(bh); |
| 397 | if (printk_ratelimit()) | 405 | if (!quiet_error(bh)) |
| 398 | buffer_io_error(bh); | 406 | buffer_io_error(bh); |
| 399 | SetPageError(page); | 407 | SetPageError(page); |
| 400 | } | 408 | } |
| @@ -455,7 +463,7 @@ static void end_buffer_async_write(struct buffer_head *bh, int uptodate) | |||
| 455 | if (uptodate) { | 463 | if (uptodate) { |
| 456 | set_buffer_uptodate(bh); | 464 | set_buffer_uptodate(bh); |
| 457 | } else { | 465 | } else { |
| 458 | if (printk_ratelimit()) { | 466 | if (!quiet_error(bh)) { |
| 459 | buffer_io_error(bh); | 467 | buffer_io_error(bh); |
| 460 | printk(KERN_WARNING "lost page write due to " | 468 | printk(KERN_WARNING "lost page write due to " |
| 461 | "I/O error on %s\n", | 469 | "I/O error on %s\n", |
| @@ -1988,7 +1996,7 @@ int block_write_begin(struct file *file, struct address_space *mapping, | |||
| 1988 | page = *pagep; | 1996 | page = *pagep; |
| 1989 | if (page == NULL) { | 1997 | if (page == NULL) { |
| 1990 | ownpage = 1; | 1998 | ownpage = 1; |
| 1991 | page = __grab_cache_page(mapping, index); | 1999 | page = grab_cache_page_write_begin(mapping, index, flags); |
| 1992 | if (!page) { | 2000 | if (!page) { |
| 1993 | status = -ENOMEM; | 2001 | status = -ENOMEM; |
| 1994 | goto out; | 2002 | goto out; |
| @@ -2014,7 +2022,6 @@ int block_write_begin(struct file *file, struct address_space *mapping, | |||
| 2014 | if (pos + len > inode->i_size) | 2022 | if (pos + len > inode->i_size) |
| 2015 | vmtruncate(inode, inode->i_size); | 2023 | vmtruncate(inode, inode->i_size); |
| 2016 | } | 2024 | } |
| 2017 | goto out; | ||
| 2018 | } | 2025 | } |
| 2019 | 2026 | ||
| 2020 | out: | 2027 | out: |
| @@ -2494,7 +2501,7 @@ int nobh_write_begin(struct file *file, struct address_space *mapping, | |||
| 2494 | from = pos & (PAGE_CACHE_SIZE - 1); | 2501 | from = pos & (PAGE_CACHE_SIZE - 1); |
| 2495 | to = from + len; | 2502 | to = from + len; |
| 2496 | 2503 | ||
| 2497 | page = __grab_cache_page(mapping, index); | 2504 | page = grab_cache_page_write_begin(mapping, index, flags); |
| 2498 | if (!page) | 2505 | if (!page) |
| 2499 | return -ENOMEM; | 2506 | return -ENOMEM; |
| 2500 | *pagep = page; | 2507 | *pagep = page; |
| @@ -2913,6 +2920,9 @@ static void end_bio_bh_io_sync(struct bio *bio, int err) | |||
| 2913 | set_bit(BH_Eopnotsupp, &bh->b_state); | 2920 | set_bit(BH_Eopnotsupp, &bh->b_state); |
| 2914 | } | 2921 | } |
| 2915 | 2922 | ||
| 2923 | if (unlikely (test_bit(BIO_QUIET,&bio->bi_flags))) | ||
| 2924 | set_bit(BH_Quiet, &bh->b_state); | ||
| 2925 | |||
| 2916 | bh->b_end_io(bh, test_bit(BIO_UPTODATE, &bio->bi_flags)); | 2926 | bh->b_end_io(bh, test_bit(BIO_UPTODATE, &bio->bi_flags)); |
| 2917 | bio_put(bio); | 2927 | bio_put(bio); |
| 2918 | } | 2928 | } |
