Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[firefly-linux-kernel-4.4.55.git] / fs / buffer.c
index b85e94134ea6a5a7915e9fbf8e9aa2f55c51ce61..1cf7a53a02771eb1ebdc49564d6f42aef76a449c 100644 (file)
@@ -45,9 +45,9 @@
 #include <trace/events/block.h>
 
 static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
-static int submit_bh_blkcg(int rw, struct buffer_head *bh,
-                          unsigned long bio_flags,
-                          struct cgroup_subsys_state *blkcg_css);
+static int submit_bh_wbc(int rw, struct buffer_head *bh,
+                        unsigned long bio_flags,
+                        struct writeback_control *wbc);
 
 #define BH_ENTRY(list) list_entry((list), struct buffer_head, b_assoc_buffers)
 
@@ -1709,7 +1709,6 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
        unsigned int blocksize, bbits;
        int nr_underway = 0;
        int write_op = (wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : WRITE);
-       struct cgroup_subsys_state *blkcg_css = inode_to_wb_blkcg_css(inode);
 
        head = create_page_buffers(page, inode,
                                        (1 << BH_Dirty)|(1 << BH_Uptodate));
@@ -1798,7 +1797,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
        do {
                struct buffer_head *next = bh->b_this_page;
                if (buffer_async_write(bh)) {
-                       submit_bh_blkcg(write_op, bh, 0, blkcg_css);
+                       submit_bh_wbc(write_op, bh, 0, wbc);
                        nr_underway++;
                }
                bh = next;
@@ -1852,7 +1851,7 @@ recover:
                struct buffer_head *next = bh->b_this_page;
                if (buffer_async_write(bh)) {
                        clear_buffer_dirty(bh);
-                       submit_bh_blkcg(write_op, bh, 0, blkcg_css);
+                       submit_bh_wbc(write_op, bh, 0, wbc);
                        nr_underway++;
                }
                bh = next;
@@ -3017,9 +3016,8 @@ void guard_bio_eod(int rw, struct bio *bio)
        }
 }
 
-static int submit_bh_blkcg(int rw, struct buffer_head *bh,
-                          unsigned long bio_flags,
-                          struct cgroup_subsys_state *blkcg_css)
+static int submit_bh_wbc(int rw, struct buffer_head *bh,
+                        unsigned long bio_flags, struct writeback_control *wbc)
 {
        struct bio *bio;
 
@@ -3041,8 +3039,10 @@ static int submit_bh_blkcg(int rw, struct buffer_head *bh,
         */
        bio = bio_alloc(GFP_NOIO, 1);
 
-       if (blkcg_css)
-               bio_associate_blkcg(bio, blkcg_css);
+       if (wbc) {
+               wbc_init_bio(wbc, bio);
+               wbc_account_io(wbc, bh->b_page, bh->b_size);
+       }
 
        bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9);
        bio->bi_bdev = bh->b_bdev;
@@ -3071,13 +3071,13 @@ static int submit_bh_blkcg(int rw, struct buffer_head *bh,
 
 int _submit_bh(int rw, struct buffer_head *bh, unsigned long bio_flags)
 {
-       return submit_bh_blkcg(rw, bh, bio_flags, NULL);
+       return submit_bh_wbc(rw, bh, bio_flags, NULL);
 }
 EXPORT_SYMBOL_GPL(_submit_bh);
 
 int submit_bh(int rw, struct buffer_head *bh)
 {
-       return submit_bh_blkcg(rw, bh, 0, NULL);
+       return submit_bh_wbc(rw, bh, 0, NULL);
 }
 EXPORT_SYMBOL(submit_bh);