All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@fb.com>
To: <linux-block@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>
Cc: <jack@suse.cz>, Jens Axboe <axboe@fb.com>
Subject: [PATCH 1/3] writeback: propagate the various reasons for writeback
Date: Tue, 12 Apr 2016 12:43:51 -0600	[thread overview]
Message-ID: <1460486633-26099-2-git-send-email-axboe@fb.com> (raw)
In-Reply-To: <1460486633-26099-1-git-send-email-axboe@fb.com>

Avoid losing context by propagating the various reason why we
initiate writeback. If we are doing more important reclaim or
synchronous writeback, the lower levels should know about it.

No intended functional changes in this patch.

Signed-off-by: Jens Axboe <axboe@fb.com>
---
 fs/fs-writeback.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index fee81e8768c9..4300ee7b1139 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -52,6 +52,7 @@ struct wb_writeback_work {
 	unsigned int range_cyclic:1;
 	unsigned int for_background:1;
 	unsigned int for_sync:1;	/* sync(2) WB_SYNC_ALL writeback */
+	unsigned int for_reclaim:1;	/* for mem reclaim */
 	unsigned int auto_free:1;	/* free on completion */
 	enum wb_reason reason;		/* why was writeback initiated? */
 
@@ -944,6 +945,17 @@ void wb_start_writeback(struct bdi_writeback *wb, long nr_pages,
 	work->reason	= reason;
 	work->auto_free	= 1;
 
+	switch (reason) {
+	case WB_REASON_TRY_TO_FREE_PAGES:
+	case WB_REASON_FREE_MORE_MEM:
+		work->for_reclaim = 1;
+	case WB_REASON_SYNC:
+		work->for_sync = 1;
+		break;
+	default:
+		break;
+	}
+
 	wb_queue_work(wb, work);
 }
 
@@ -1446,6 +1458,7 @@ static long writeback_sb_inodes(struct super_block *sb,
 		.for_kupdate		= work->for_kupdate,
 		.for_background		= work->for_background,
 		.for_sync		= work->for_sync,
+		.for_reclaim		= work->for_reclaim,
 		.range_cyclic		= work->range_cyclic,
 		.range_start		= 0,
 		.range_end		= LLONG_MAX,
-- 
2.8.0.rc4.6.g7e4ba36


  reply	other threads:[~2016-04-12 18:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-12 18:43 [PATCH 0/3] writeback: minor tweaks Jens Axboe
2016-04-12 18:43 ` Jens Axboe [this message]
2016-04-13  9:48   ` [PATCH 1/3] writeback: propagate the various reasons for writeback Jan Kara
2016-04-14 15:43     ` Jens Axboe
2016-04-17 12:01       ` Jan Kara
2016-04-12 18:43 ` [PATCH 2/3] writeback: add wbc_to_write() Jens Axboe
2016-04-13  9:50   ` Jan Kara
2016-04-14 15:41     ` Jens Axboe
2016-04-12 18:43 ` [PATCH 3/3] writeback: use WRITE_SYNC for reclaim or sync writeback Jens Axboe
2016-04-13  0:08 ` [PATCH 0/3] writeback: minor tweaks Dave Chinner
2016-04-13  1:49   ` Jens Axboe
2016-04-13  6:09     ` Dave Chinner
2016-04-13 10:07     ` Jan Kara
2016-04-14 15:41       ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1460486633-26099-2-git-send-email-axboe@fb.com \
    --to=axboe@fb.com \
    --cc=jack@suse.cz \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.