writeback: pass in super_block to bdi_start_writeback()
authorJens Axboe <jens.axboe@oracle.com>
Fri, 25 Sep 2009 22:07:46 +0000 (00:07 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 25 Sep 2009 22:10:40 +0000 (00:10 +0200)
Sometimes we only want to write pages from a specific super_block,
so allow that to be passed in.

This fixes a problem with commit 56a131dcf7ed36c3c6e36bea448b674ea85ed5bb
causing writeback on all super_blocks on a bdi, where we only really
want to sync a specific sb from writeback_inodes_sb().

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fs/fs-writeback.c
include/linux/backing-dev.h
mm/page-writeback.c

index fb61178c86e3e56eb0dcecaad7ff6e3f3db1cc1d..9d5360c4c2afbe98d2b46112f131f90d943e00f5 100644 (file)
@@ -250,9 +250,11 @@ static void bdi_sync_writeback(struct backing_dev_info *bdi,
  *   completion. Caller need not hold sb s_umount semaphore.
  *
  */
-void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages)
+void bdi_start_writeback(struct backing_dev_info *bdi, struct super_block *sb,
+                        long nr_pages)
 {
        struct wb_writeback_args args = {
+               .sb             = sb,
                .sync_mode      = WB_SYNC_NONE,
                .nr_pages       = nr_pages,
                .range_cyclic   = 1,
@@ -1206,7 +1208,7 @@ void writeback_inodes_sb(struct super_block *sb)
        nr_to_write = nr_dirty + nr_unstable +
                        (inodes_stat.nr_inodes - inodes_stat.nr_unused);
 
-       bdi_start_writeback(sb->s_bdi, nr_to_write);
+       bdi_start_writeback(sb->s_bdi, sb, nr_to_write);
 }
 EXPORT_SYMBOL(writeback_inodes_sb);
 
index 0ee33c2e6129005aa13191244f9ed391af9630e7..b449e738533a6ad327eb9e9401488f96bf09791e 100644 (file)
@@ -101,7 +101,8 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent,
                const char *fmt, ...);
 int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev);
 void bdi_unregister(struct backing_dev_info *bdi);
-void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages);
+void bdi_start_writeback(struct backing_dev_info *bdi, struct super_block *sb,
+                               long nr_pages);
 int bdi_writeback_task(struct bdi_writeback *wb);
 int bdi_has_dirty_io(struct backing_dev_info *bdi);
 
index 69b5fbabc8bd4e9248f54f460d0f01b4e75f8e86..a3b14090b1fb8f296ce9ce2fcec2bd2bbccd8d22 100644 (file)
@@ -596,7 +596,7 @@ static void balance_dirty_pages(struct address_space *mapping,
            (!laptop_mode && ((global_page_state(NR_FILE_DIRTY)
                               + global_page_state(NR_UNSTABLE_NFS))
                                          > background_thresh)))
-               bdi_start_writeback(bdi, 0);
+               bdi_start_writeback(bdi, NULL, 0);
 }
 
 void set_page_dirty_balance(struct page *page, int page_mkwrite)