Commit 8e8f9298 authored by Jens Axboe's avatar Jens Axboe

fs: add support for buffered writeback to pass down write hints

Reviewed-by: default avatarAndreas Dilger <adilger@dilger.ca>
Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 45d06cf7
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
static int fsync_buffers_list(spinlock_t *lock, struct list_head *list); static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
struct writeback_control *wbc); enum rw_hint hint, struct writeback_control *wbc);
#define BH_ENTRY(list) list_entry((list), struct buffer_head, b_assoc_buffers) #define BH_ENTRY(list) list_entry((list), struct buffer_head, b_assoc_buffers)
...@@ -1829,7 +1829,8 @@ int __block_write_full_page(struct inode *inode, struct page *page, ...@@ -1829,7 +1829,8 @@ int __block_write_full_page(struct inode *inode, struct page *page,
do { do {
struct buffer_head *next = bh->b_this_page; struct buffer_head *next = bh->b_this_page;
if (buffer_async_write(bh)) { if (buffer_async_write(bh)) {
submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, wbc); submit_bh_wbc(REQ_OP_WRITE, write_flags, bh,
inode->i_write_hint, wbc);
nr_underway++; nr_underway++;
} }
bh = next; bh = next;
...@@ -1883,7 +1884,8 @@ int __block_write_full_page(struct inode *inode, struct page *page, ...@@ -1883,7 +1884,8 @@ int __block_write_full_page(struct inode *inode, struct page *page,
struct buffer_head *next = bh->b_this_page; struct buffer_head *next = bh->b_this_page;
if (buffer_async_write(bh)) { if (buffer_async_write(bh)) {
clear_buffer_dirty(bh); clear_buffer_dirty(bh);
submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, wbc); submit_bh_wbc(REQ_OP_WRITE, write_flags, bh,
inode->i_write_hint, wbc);
nr_underway++; nr_underway++;
} }
bh = next; bh = next;
...@@ -3091,7 +3093,7 @@ void guard_bio_eod(int op, struct bio *bio) ...@@ -3091,7 +3093,7 @@ void guard_bio_eod(int op, struct bio *bio)
} }
static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
struct writeback_control *wbc) enum rw_hint write_hint, struct writeback_control *wbc)
{ {
struct bio *bio; struct bio *bio;
...@@ -3120,6 +3122,7 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, ...@@ -3120,6 +3122,7 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9); bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9);
bio->bi_bdev = bh->b_bdev; bio->bi_bdev = bh->b_bdev;
bio->bi_write_hint = write_hint;
bio_add_page(bio, bh->b_page, bh->b_size, bh_offset(bh)); bio_add_page(bio, bh->b_page, bh->b_size, bh_offset(bh));
BUG_ON(bio->bi_iter.bi_size != bh->b_size); BUG_ON(bio->bi_iter.bi_size != bh->b_size);
...@@ -3142,7 +3145,7 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, ...@@ -3142,7 +3145,7 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
int submit_bh(int op, int op_flags, struct buffer_head *bh) int submit_bh(int op, int op_flags, struct buffer_head *bh)
{ {
return submit_bh_wbc(op, op_flags, bh, NULL); return submit_bh_wbc(op, op_flags, bh, 0, NULL);
} }
EXPORT_SYMBOL(submit_bh); EXPORT_SYMBOL(submit_bh);
......
...@@ -615,6 +615,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc, ...@@ -615,6 +615,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
goto confused; goto confused;
wbc_init_bio(wbc, bio); wbc_init_bio(wbc, bio);
bio->bi_write_hint = inode->i_write_hint;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment