]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/buffer.c
filesystem freeze: add error handling of write_super_lockfs/unlockfs
[linux-2.6-omap-h63xx.git] / fs / buffer.c
index 10179cfa11528683495886657bd643ebde590ce8..87f9e537b8c31eec7073c298a07bb80ea223d213 100644 (file)
@@ -99,10 +99,18 @@ __clear_page_buffers(struct page *page)
        page_cache_release(page);
 }
 
+
+static int quiet_error(struct buffer_head *bh)
+{
+       if (!test_bit(BH_Quiet, &bh->b_state) && printk_ratelimit())
+               return 0;
+       return 1;
+}
+
+
 static void buffer_io_error(struct buffer_head *bh)
 {
        char b[BDEVNAME_SIZE];
-
        printk(KERN_ERR "Buffer I/O error on device %s, logical block %Lu\n",
                        bdevname(bh->b_bdev, b),
                        (unsigned long long)bh->b_blocknr);
@@ -144,7 +152,7 @@ void end_buffer_write_sync(struct buffer_head *bh, int uptodate)
        if (uptodate) {
                set_buffer_uptodate(bh);
        } else {
-               if (!buffer_eopnotsupp(bh) && printk_ratelimit()) {
+               if (!buffer_eopnotsupp(bh) && !quiet_error(bh)) {
                        buffer_io_error(bh);
                        printk(KERN_WARNING "lost page write due to "
                                        "I/O error on %s\n",
@@ -213,8 +221,8 @@ struct super_block *freeze_bdev(struct block_device *bdev)
 
                sync_blockdev(sb->s_bdev);
 
-               if (sb->s_op->write_super_lockfs)
-                       sb->s_op->write_super_lockfs(sb);
+               if (sb->s_op->freeze_fs)
+                       sb->s_op->freeze_fs(sb);
        }
 
        sync_blockdev(bdev);
@@ -234,8 +242,8 @@ void thaw_bdev(struct block_device *bdev, struct super_block *sb)
        if (sb) {
                BUG_ON(sb->s_bdev != bdev);
 
-               if (sb->s_op->unlockfs)
-                       sb->s_op->unlockfs(sb);
+               if (sb->s_op->unfreeze_fs)
+                       sb->s_op->unfreeze_fs(sb);
                sb->s_frozen = SB_UNFROZEN;
                smp_wmb();
                wake_up(&sb->s_wait_unfrozen);
@@ -394,7 +402,7 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate)
                set_buffer_uptodate(bh);
        } else {
                clear_buffer_uptodate(bh);
-               if (printk_ratelimit())
+               if (!quiet_error(bh))
                        buffer_io_error(bh);
                SetPageError(page);
        }
@@ -455,7 +463,7 @@ static void end_buffer_async_write(struct buffer_head *bh, int uptodate)
        if (uptodate) {
                set_buffer_uptodate(bh);
        } else {
-               if (printk_ratelimit()) {
+               if (!quiet_error(bh)) {
                        buffer_io_error(bh);
                        printk(KERN_WARNING "lost page write due to "
                                        "I/O error on %s\n",
@@ -1988,7 +1996,7 @@ int block_write_begin(struct file *file, struct address_space *mapping,
        page = *pagep;
        if (page == NULL) {
                ownpage = 1;
-               page = __grab_cache_page(mapping, index);
+               page = grab_cache_page_write_begin(mapping, index, flags);
                if (!page) {
                        status = -ENOMEM;
                        goto out;
@@ -2014,7 +2022,6 @@ int block_write_begin(struct file *file, struct address_space *mapping,
                        if (pos + len > inode->i_size)
                                vmtruncate(inode, inode->i_size);
                }
-               goto out;
        }
 
 out:
@@ -2494,7 +2501,7 @@ int nobh_write_begin(struct file *file, struct address_space *mapping,
        from = pos & (PAGE_CACHE_SIZE - 1);
        to = from + len;
 
-       page = __grab_cache_page(mapping, index);
+       page = grab_cache_page_write_begin(mapping, index, flags);
        if (!page)
                return -ENOMEM;
        *pagep = page;
@@ -2913,6 +2920,9 @@ static void end_bio_bh_io_sync(struct bio *bio, int err)
                set_bit(BH_Eopnotsupp, &bh->b_state);
        }
 
+       if (unlikely (test_bit(BIO_QUIET,&bio->bi_flags)))
+               set_bit(BH_Quiet, &bh->b_state);
+
        bh->b_end_io(bh, test_bit(BIO_UPTODATE, &bio->bi_flags));
        bio_put(bio);
 }