From patchwork Tue Apr 12 18:43:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 8814501 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 337BA9FBEA for ; Tue, 12 Apr 2016 18:44:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3FA5620361 for ; Tue, 12 Apr 2016 18:44:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6819B2034F for ; Tue, 12 Apr 2016 18:44:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965435AbcDLSoG (ORCPT ); Tue, 12 Apr 2016 14:44:06 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:34458 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965350AbcDLSoE (ORCPT ); Tue, 12 Apr 2016 14:44:04 -0400 Received: from pps.filterd (m0044008.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u3CIevWo013906; Tue, 12 Apr 2016 11:44:00 -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=aqRVbIMoeHuhnJsPfyh2QSBVdTOB6BR1Wczg3z0l1v8=; b=XeEsm12YzhzWDzvRUHBJjXfatJ470JDQiT7jPBv5dSG7OrDPTC5dDji5SL7WZ5ipEEsA ccBTm2Sxy7ldPs3hxpqz0H69adNvoWLKTuiMKindNIr3ie7T8VmJ7Z1rFc05aSlGjMbs +k3W6vc8U2RESndE33dXAGJoopH/Kue09Vs= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2296e0g1jv-2 (version=TLSv1 cipher=AES128-SHA bits=128 verify=NOT); Tue, 12 Apr 2016 11:44:00 -0700 Received: from localhost.localdomain (192.168.54.13) by mail.thefacebook.com (192.168.16.16) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 12 Apr 2016 11:43:59 -0700 From: Jens Axboe To: , CC: , Jens Axboe Subject: [PATCH 1/3] writeback: propagate the various reasons for writeback Date: Tue, 12 Apr 2016 12:43:51 -0600 Message-ID: <1460486633-26099-2-git-send-email-axboe@fb.com> X-Mailer: git-send-email 2.8.0.rc4.6.g7e4ba36 In-Reply-To: <1460486633-26099-1-git-send-email-axboe@fb.com> References: <1460486633-26099-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-04-12_09:, , 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=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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. 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 --- 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,