From patchwork Wed Mar 23 15:25:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 8650921 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3D60A9FB32 for ; Wed, 23 Mar 2016 15:26:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5FBB4203AC for ; Wed, 23 Mar 2016 15:26:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 80E00203AB for ; Wed, 23 Mar 2016 15:26:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755388AbcCWP0O (ORCPT ); Wed, 23 Mar 2016 11:26:14 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:53043 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752849AbcCWP0M (ORCPT ); Wed, 23 Mar 2016 11:26:12 -0400 Received: from pps.filterd (m0001303.ppops.net [127.0.0.1]) by m0001303.ppops.net (8.16.0.11/8.16.0.11) with SMTP id u2NFJluB009845; Wed, 23 Mar 2016 08:26:11 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=m5FOgnShWC9ilizUL4uSc6aYqBDQHHVWxn8Za+WVEeM=; b=PYPaO67DlVjF6kRWxKYnHq8GwI4PUG+526wOWYaTLBRXctcZMZG2eiXBAt9ZXjdTpZPr /HqpQIo73Bc860uVHKRVp7Ft1dbgIWJlZkNHYTsYZaN67tylJM4hch99fNx0tKXSF4in 6FwnkSR3grrEP5UeAhf6JbWXvnHbvk28LEI= Received: from mail.thefacebook.com ([199.201.64.23]) by m0001303.ppops.net with ESMTP id 21uet8p3wv-12 (version=TLSv1 cipher=AES128-SHA bits=128 verify=NOT); Wed, 23 Mar 2016 08:26:11 -0700 Received: from localhost.localdomain (192.168.54.13) by mail.TheFacebook.com (192.168.16.18) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 23 Mar 2016 08:25:53 -0700 From: Jens Axboe To: , , CC: Jens Axboe Subject: [PATCH 1/8] writeback: propagate the various reasons for writeback Date: Wed, 23 Mar 2016 09:25:43 -0600 Message-ID: <1458746750-9213-2-git-send-email-axboe@fb.com> X-Mailer: git-send-email 2.4.1.168.g1ea28e1 In-Reply-To: <1458746750-9213-1-git-send-email-axboe@fb.com> References: <1458746750-9213-1-git-send-email-axboe@fb.com> MIME-Version: 1.0 X-Originating-IP: [192.168.54.13] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-03-23_08:, , signatures=0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Avoid losing context by propagating the various reason why we initiate writeback. Signed-off-by: Jens Axboe --- fs/fs-writeback.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 5c46ed9f3e14..387610cf4f7f 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? */ @@ -942,6 +943,21 @@ void wb_start_writeback(struct bdi_writeback *wb, long nr_pages, work->reason = reason; work->auto_free = 1; + switch (reason) { + case WB_REASON_BACKGROUND: + case WB_REASON_PERIODIC: + work->for_background = 1; + break; + 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); } @@ -1443,6 +1459,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,