Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp635853img; Fri, 22 Mar 2019 05:37:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwadciFu/BBGBMhWSpHb3B3IBb8at8omkv5/y2WCIEC/nMs8wxPBXnTnJupYoJoD3Erhtnk X-Received: by 2002:a62:5543:: with SMTP id j64mr8933445pfb.105.1553258254575; Fri, 22 Mar 2019 05:37:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553258254; cv=none; d=google.com; s=arc-20160816; b=JB5dibWCN/eg+0Yv0SkUyVBH4hX/YvAOEb7AOzMCuhvrFLZPwSYOggVUOZJvb0s6fv FfoCsmlbyF4HooaMcN0mY/jl1h/M2XY2JMR4Tkp1kOi+sejGuRHhdCrz9QgGtQg7oE/q o3F976CL621tJfuEL/RDTB/Wgmted/mZa9tbPWY7DxCIi4OxY8av2fjVUcpNI4vV0Myp DBpYElIR/XwABmGseLzsiT3R2ygWS5x9uec1ncbgERFcT+flCk5Jyforf21B3jPKVkBk HYdLQuyUCtOA27jjbFyGKU22WYNpeKjKxJw9nTbFQ4JN72MvJ0mxHpRuR2wUL1L19yQH oN2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OfJP5sJhxtbqu8pxeQxOXQyV/OeurH3/yOBEIYhLlvs=; b=xa/8NO0NvCwg8VYjW3m2YHEEGSkCd/vU4cLWGn+TDdKN+3goBRH10BDvRE1mRZQKAy 5sNLSnX4THXmdWP3MBiirNyd03R2PgWuOYdtCEA8i+RKPy5NinkmmHKjIxu956Zb5Ipm CUv8U0uZZ90iWiKFEbgrWB7JrJ0pP2eX/uhYjjNUXdntxTyUYzg5LfTxzko2+GS5CYmQ hKbGDlm14hMi3Bn4xhK/0+XbBnet7CyLLxgn2Ziup35ome90Wg/Jqr3vpigaXkIrp4hC gnVipIISXnB3BIBNgxhMrNJtWvCWI9B4zpMgJRoOHG3PDNQ97+BW4BCz9pEBJGF0B2C7 xatg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lmWcr7uU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q12si7147835pli.428.2019.03.22.05.37.16; Fri, 22 Mar 2019 05:37:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lmWcr7uU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389474AbfCVMK7 (ORCPT + 99 others); Fri, 22 Mar 2019 08:10:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:49318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389473AbfCVMK6 (ORCPT ); Fri, 22 Mar 2019 08:10:58 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 53A192082C; Fri, 22 Mar 2019 12:10:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553256656; bh=oA0WJM1I0IQaPmAjsJZgMNExtqMo/FS2woJGpcr3H9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lmWcr7uUVZYhFN6JqgQZupxc0MjGqws/JMXee1F1n0CDLHrrMjIL/2IFDJByoNtoR lXpQkSMc8tHZki9d4bQj64u7PZFfZP/MEIeli2AA1nzJXu2JWC20nJp/KCNbsjKKjl 0CRijDdx1CL+4TsqM5YVdI063XJ2jkFGkSHEfrGc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nix , Coly Li , Andre Noll , Dave Chinner , Christoph Hellwig , Jens Axboe Subject: [PATCH 4.19 279/280] bcache: use (REQ_META|REQ_PRIO) to indicate bio for metadata Date: Fri, 22 Mar 2019 12:17:12 +0100 Message-Id: <20190322111347.937046833@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111306.356185024@linuxfoundation.org> References: <20190322111306.356185024@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Coly Li commit dc7292a5bcb4c878b076fca2ac3fc22f81b8f8df upstream. In 'commit 752f66a75aba ("bcache: use REQ_PRIO to indicate bio for metadata")' REQ_META is replaced by REQ_PRIO to indicate metadata bio. This assumption is not always correct, e.g. XFS uses REQ_META to mark metadata bio other than REQ_PRIO. This is why Nix noticed that bcache does not cache metadata for XFS after the above commit. Thanks to Dave Chinner, he explains the difference between REQ_META and REQ_PRIO from view of file system developer. Here I quote part of his explanation from mailing list, REQ_META is used for metadata. REQ_PRIO is used to communicate to the lower layers that the submitter considers this IO to be more important that non REQ_PRIO IO and so dispatch should be expedited. IOWs, if the filesystem considers metadata IO to be more important that user data IO, then it will use REQ_PRIO | REQ_META rather than just REQ_META. Then it seems bios with REQ_META or REQ_PRIO should both be cached for performance optimation, because they are all probably low I/O latency demand by upper layer (e.g. file system). So in this patch, when we want to decide whether to bypass the cache, REQ_META and REQ_PRIO are both checked. Then both metadata and high priority I/O requests will be handled properly. Reported-by: Nix Signed-off-by: Coly Li Reviewed-by: Andre Noll Tested-by: Nix Cc: stable@vger.kernel.org Cc: Dave Chinner Cc: Christoph Hellwig Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/md/bcache/request.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -392,10 +392,11 @@ static bool check_should_bypass(struct c /* * Flag for bypass if the IO is for read-ahead or background, - * unless the read-ahead request is for metadata (eg, for gfs2). + * unless the read-ahead request is for metadata + * (eg, for gfs2 or xfs). */ if (bio->bi_opf & (REQ_RAHEAD|REQ_BACKGROUND) && - !(bio->bi_opf & REQ_META)) + !(bio->bi_opf & (REQ_META|REQ_PRIO))) goto skip; if (bio->bi_iter.bi_sector & (c->sb.block_size - 1) || @@ -877,7 +878,7 @@ static int cached_dev_cache_miss(struct } if (!(bio->bi_opf & REQ_RAHEAD) && - !(bio->bi_opf & REQ_META) && + !(bio->bi_opf & (REQ_META|REQ_PRIO)) && s->iop.c->gc_stats.in_use < CUTOFF_CACHE_READA) reada = min_t(sector_t, dc->readahead >> 9, get_capacity(bio->bi_disk) - bio_end_sector(bio));