[Devel] [PATCH rh7 1/2] fs/writeback: prepare for per-CT writeback
Andrey Ryabinin
aryabinin at virtuozzo.com
Fri Jan 15 07:17:24 PST 2016
Small preparational chages for the next patch:
* export writeback_inodes_wb() and add new argument 'struct user_beancounter *ub'
* add beancounter pointer to struct wb_writeback_work.
* Pass beacounter to __bdi_start_writeback().
https://jira.sw.ru/browse/PSBM-33841
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
fs/fs-writeback.c | 17 +++++++++++------
include/linux/backing-dev.h | 2 ++
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index ac8066b..91c1b07 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -51,6 +51,7 @@ struct wb_writeback_work {
struct list_head list; /* pending work list */
struct completion *done; /* set if the caller waits */
+ struct user_beancounter *ub;
};
/*
@@ -130,7 +131,8 @@ out_unlock:
static void
__bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages,
- bool range_cyclic, enum wb_reason reason)
+ bool range_cyclic, enum wb_reason reason,
+ struct user_beancounter *ub)
{
struct wb_writeback_work *work;
@@ -149,6 +151,8 @@ __bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages,
work->nr_pages = nr_pages;
work->range_cyclic = range_cyclic;
work->reason = reason;
+ work->ub = ub;
+ work->for_background = (reason == WB_REASON_BACKGROUND);
bdi_queue_work(bdi, work);
}
@@ -168,7 +172,7 @@ __bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages,
void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages,
enum wb_reason reason)
{
- __bdi_start_writeback(bdi, nr_pages, true, reason);
+ __bdi_start_writeback(bdi, nr_pages, true, reason, NULL);
}
/**
@@ -809,14 +813,15 @@ static long __writeback_inodes_wb(struct bdi_writeback *wb,
return wrote;
}
-static long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
- enum wb_reason reason)
+long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
+ enum wb_reason reason, struct user_beancounter *ub)
{
struct wb_writeback_work work = {
.nr_pages = nr_pages,
.sync_mode = WB_SYNC_NONE,
.range_cyclic = 1,
.reason = reason,
+ .ub = ub,
};
spin_lock(&wb->list_lock);
@@ -1115,7 +1120,7 @@ void bdi_writeback_workfn(struct work_struct *work)
* enough for efficient IO.
*/
pages_written = writeback_inodes_wb(&bdi->wb, 1024,
- WB_REASON_FORKER_THREAD);
+ WB_REASON_FORKER_THREAD, NULL);
trace_writeback_pages_written(pages_written);
}
@@ -1142,7 +1147,7 @@ void wakeup_flusher_threads(long nr_pages, enum wb_reason reason)
list_for_each_entry_rcu(bdi, &bdi_list, bdi_list) {
if (!bdi_has_dirty_io(bdi))
continue;
- __bdi_start_writeback(bdi, nr_pages, false, reason);
+ __bdi_start_writeback(bdi, nr_pages, false, reason, NULL);
}
rcu_read_unlock();
}
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 859504b..b7668cf 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -130,6 +130,8 @@ int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int);
void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages,
enum wb_reason reason);
void bdi_start_background_writeback(struct backing_dev_info *bdi);
+long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
+ enum wb_reason reason, struct user_beancounter *ub);
void bdi_writeback_workfn(struct work_struct *work);
int bdi_has_dirty_io(struct backing_dev_info *bdi);
void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi);
--
2.4.10
More information about the Devel
mailing list