writeback: move bandwidth related fields from backing_dev_info into bdi_writeback
authorTejun Heo <tj@kernel.org>
Fri, 22 May 2015 21:13:28 +0000 (17:13 -0400)
committerJens Axboe <axboe@fb.com>
Tue, 2 Jun 2015 14:33:34 +0000 (08:33 -0600)
Currently, a bdi (backing_dev_info) embeds single wb (bdi_writeback)
and the role of the separation is unclear.  For cgroup support for
writeback IOs, a bdi will be updated to host multiple wb's where each
wb serves writeback IOs of a different cgroup on the bdi.  To achieve
that, a wb should carry all states necessary for servicing writeback
IOs for a cgroup independently.

This patch moves bandwidth related fields from backing_dev_info into
bdi_writeback.

* The moved fields are: bw_time_stamp, dirtied_stamp, written_stamp,
  write_bandwidth, avg_write_bandwidth, dirty_ratelimit,
  balanced_dirty_ratelimit, completions and dirty_exceeded.

* writeback_chunk_size() and over_bground_thresh() now take @wb
  instead of @bdi.

* bdi_writeout_fraction(bdi, ...) -> wb_writeout_fraction(wb, ...)
  bdi_dirty_limit(bdi, ...) -> wb_dirty_limit(wb, ...)
  bdi_position_ration(bdi, ...) -> wb_position_ratio(wb, ...)
  bdi_update_writebandwidth(bdi, ...) -> wb_update_write_bandwidth(wb, ...)
  [__]bdi_update_bandwidth(bdi, ...) -> [__]wb_update_bandwidth(wb, ...)
  bdi_{max|min}_pause(bdi, ...) -> wb_{max|min}_pause(wb, ...)
  bdi_dirty_limits(bdi, ...) -> wb_dirty_limits(wb, ...)

* Init/exits of the relocated fields are moved to bdi_wb_init/exit()
  respectively.  Note that explicit zeroing is dropped in the process
  as wb's are cleared in entirety anyway.

* As there's still only one bdi_writeback per backing_dev_info, all
  uses of bdi->stat[] are mechanically replaced with bdi->wb.stat[]
  introducing no behavior changes.

v2: Typo in description fixed as suggested by Jan.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Steven Whitehouse <swhiteho@redhat.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
fs/f2fs/node.c
fs/f2fs/segment.h
fs/fs-writeback.c
fs/gfs2/super.c
include/linux/backing-dev.h
include/linux/writeback.h
include/trace/events/writeback.h
mm/backing-dev.c
mm/page-writeback.c

index 8ab0cf1..d211602 100644 (file)
@@ -53,7 +53,7 @@ bool available_free_memory(struct f2fs_sb_info *sbi, int type)
                                                        PAGE_CACHE_SHIFT;
                res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 2);
        } else if (type == DIRTY_DENTS) {
-               if (sbi->sb->s_bdi->dirty_exceeded)
+               if (sbi->sb->s_bdi->wb.dirty_exceeded)
                        return false;
                mem_size = get_pages(sbi, F2FS_DIRTY_DENTS);
                res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 1);
@@ -70,7 +70,7 @@ bool available_free_memory(struct f2fs_sb_info *sbi, int type)
                                sizeof(struct extent_node)) >> PAGE_CACHE_SHIFT;
                res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 1);
        } else {
-               if (sbi->sb->s_bdi->dirty_exceeded)
+               if (sbi->sb->s_bdi->wb.dirty_exceeded)
                        return false;
        }
        return res;
index 85d7fa7..6408989 100644 (file)
@@ -713,7 +713,7 @@ static inline unsigned int max_hw_blocks(struct f2fs_sb_info *sbi)
  */
 static inline int nr_pages_to_skip(struct f2fs_sb_info *sbi, int type)
 {
-       if (sbi->sb->s_bdi->dirty_exceeded)
+       if (sbi->sb->s_bdi->wb.dirty_exceeded)
                return 0;
 
        if (type == DATA)
Simple merge
diff --cc fs/gfs2/super.c
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge