From patchwork Fri Oct 13 23:35:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Lyle X-Patchwork-Id: 10006123 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 75C8460230 for ; Fri, 13 Oct 2017 23:36:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 661CA2918E for ; Fri, 13 Oct 2017 23:36:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B0592918F; Fri, 13 Oct 2017 23:36:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 058592918B for ; Fri, 13 Oct 2017 23:36:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753249AbdJMXgI (ORCPT ); Fri, 13 Oct 2017 19:36:08 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:54852 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753010AbdJMXgF (ORCPT ); Fri, 13 Oct 2017 19:36:05 -0400 Received: by mail-pg0-f65.google.com with SMTP id l24so2285314pgu.11 for ; Fri, 13 Oct 2017 16:36:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lyle-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=n23LE8Alb73Ik0/kR6WcM168ukjq7QL1CjEQURKMQ4A=; b=lPOuzXRJIqLvuCuHwgLnfeeB1GL485jSvVzg8H3rET10yJcpF0Is8+rm3UhDxgo5FX h1xcc6qEwf2MRg6CszIQjVS0ifK/xgR/3uFzYT1Q0Dsc4kaydZ2JgbR1Da6txaPd2v3o STp5WbXcFHlQ4Ok9x4KUUoHfyrQCf8AxcvNFnQb+HXJgXD+eUUzu281ou4ksRc6xW2y1 N8750x5UaKqlERxFjyXGInARgH1+xhJRcFMLk0C92bI79NARi3LB5r3I8cbUllhQ7vrE Rn1IcXW2Y3TZqpSvSvcn11ulp27Mtsv84dZBMqH9bfpWmH8aNxVDZgjyQnRRP12wVAlF ZBjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=n23LE8Alb73Ik0/kR6WcM168ukjq7QL1CjEQURKMQ4A=; b=Pxjdf13qjUd1U7fAL2m6HBetod+TOTTNaiAwVqHLDjKh7N5n657M3H4z2qhXJ80Cvx x8KTAWMK6b5atEEz2CzMLl3KsIuihhT74hbdz1PviD08ticDp4pmLJnDM3rvXVdP9OMK sUZk5biUuIswv2U0TESu9FSFnbhDuvL5jm4i1KWQ2L6sTdZZLUR122//Qv3lJGD7NueN O3yGpNrif78127sSc7K1fd2gNBxswCd12cmBOjQAWV9BjevlCxrbOMlZhQawyBaltHby ZRWt0PYUXqhUNopkZag5emOnWZQgvF9H+lna2H+286Y1r8Pdu+0SNe/yIzh8aVRrxSth FMwQ== X-Gm-Message-State: AMCzsaUpwUQLZUFGeOmgHy3G9HqNt0Eh96d7w6+ztri34e+ZcEd0rN9l w791DCZsf5PsoPDpwRQrhpxE9w== X-Google-Smtp-Source: AOwi7QACmKAvwe3iuHV0Xh02j47zCqfW/ARoVrI8ncf8bgBJP6DYzhb+oEpkc/GTBOKqFSBoNAMFiA== X-Received: by 10.84.246.203 with SMTP id j11mr2711732plt.122.1507937764796; Fri, 13 Oct 2017 16:36:04 -0700 (PDT) Received: from localhost.localdomain (68-189-67-104.dhcp.prtv.ca.charter.com. [68.189.67.104]) by smtp.gmail.com with ESMTPSA id 74sm4950718pft.184.2017.10.13.16.36.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Oct 2017 16:36:04 -0700 (PDT) From: Michael Lyle To: linux-bcache@vger.kernel.org, linux-block@vger.kernel.org Cc: axboe@fb.com, Eric Wheeler Subject: [PATCH 06/15] bcache: update bio->bi_opf bypass/writeback REQ_ flag hints Date: Fri, 13 Oct 2017 16:35:33 -0700 Message-Id: <20171013233542.20938-7-mlyle@lyle.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171013233542.20938-1-mlyle@lyle.org> References: <20171013233542.20938-1-mlyle@lyle.org> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Wheeler Flag for bypass if the IO is for read-ahead or background, unless the read-ahead request is for metadata (eg, from gfs2). Bypass if: bio->bi_opf & (REQ_RAHEAD|REQ_BACKGROUND) && !(bio->bi_opf & REQ_META)) Writeback if: op_is_sync(bio->bi_opf) || bio->bi_opf & (REQ_META|REQ_PRIO) Signed-off-by: Eric Wheeler Reviewed-by: Coly Li --- drivers/md/bcache/request.c | 8 ++++++++ drivers/md/bcache/writeback.h | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 681b4f12b05a..9ee137e8d387 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -384,6 +384,14 @@ static bool check_should_bypass(struct cached_dev *dc, struct bio *bio) op_is_write(bio_op(bio)))) goto skip; + /* + * Flag for bypass if the IO is for read-ahead or background, + * unless the read-ahead request is for metadata (eg, for gfs2). + */ + if (bio->bi_opf & (REQ_RAHEAD|REQ_BACKGROUND) && + !(bio->bi_opf & REQ_META)) + goto skip; + if (bio->bi_iter.bi_sector & (c->sb.block_size - 1) || bio_sectors(bio) & (c->sb.block_size - 1)) { pr_debug("skipping unaligned io"); diff --git a/drivers/md/bcache/writeback.h b/drivers/md/bcache/writeback.h index e35421d20d2e..34bcf49d737b 100644 --- a/drivers/md/bcache/writeback.h +++ b/drivers/md/bcache/writeback.h @@ -76,7 +76,9 @@ static inline bool should_writeback(struct cached_dev *dc, struct bio *bio, if (would_skip) return false; - return op_is_sync(bio->bi_opf) || in_use <= CUTOFF_WRITEBACK; + return (op_is_sync(bio->bi_opf) || + bio->bi_opf & (REQ_META|REQ_PRIO) || + in_use <= CUTOFF_WRITEBACK); } static inline void bch_writeback_queue(struct cached_dev *dc)