From patchwork Tue Feb 27 17:49:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Lyle X-Patchwork-Id: 10245891 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 D2F2E60211 for ; Tue, 27 Feb 2018 17:49:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4A1128A3E for ; Tue, 27 Feb 2018 17:49:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B994E28A42; Tue, 27 Feb 2018 17:49:47 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI 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 E8C8628A3E for ; Tue, 27 Feb 2018 17:49:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751890AbeB0Rto (ORCPT ); Tue, 27 Feb 2018 12:49:44 -0500 Received: from mail-pl0-f67.google.com ([209.85.160.67]:42653 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751877AbeB0Rti (ORCPT ); Tue, 27 Feb 2018 12:49:38 -0500 Received: by mail-pl0-f67.google.com with SMTP id 93-v6so1236669plc.9 for ; Tue, 27 Feb 2018 09:49:38 -0800 (PST) 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=HfeVYgi0Gu9CqrPNoScg8p/6v6/ERfh2C8z+6rPeId0=; b=AfiVR28UYBwy9ijxLZPwassrH2o/IvT1Pe2AzKo46y9izvsYeASzMkwP0fEAKD5rNV jzDd8iAy6gBUKuRNBXqlPkXCCktEL8vaR7oG6ZT2X5AjldB9x2xIki0hBygU70HBQ8iB fMp97jsS3wt++LsQqaMMg4DgqvO+TSUEujADJIuxdzGYmH+qSfUqFoPINfk/n0KNXHm2 952a8poKALFUFZoT2RTV6SEN5OXPdQJDoeDG6jfA+ee62tFWhuCLCECYoYMUVM7oSCh0 VFbWBfE3asCSQzstqxOtUZZM+HVueCTnGyV6DO25f1DWwUy9tvRnJWrgrg/SvCkfVLKg +/vQ== 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=HfeVYgi0Gu9CqrPNoScg8p/6v6/ERfh2C8z+6rPeId0=; b=QfFq7Zn6nG/S3ah3js0siF1umIsGhCpsFbdvpIh/fX0M6a5hMPUSEJjdeIvilO8upP Wop2oiEc2CklI6LqK5MyJubJVGf1Brj0eaq5wES8fc8A188T9VD7LjpThdzOzDGoqBrQ E2TS7xW4jkmT9/UzMztHkoR46jpZmj3OuDxQQxqZFOkWQ7/xbKMsRili3TcVf7qZ0Kcw w0VMDHVyZV2dOS4xfSzJH/yQQea0QE03YKXDlifLPsXdE+0g7UUF13cdY0zHoSw5G6tQ qVnrS7YETGrIvhMibFQKPjgBNaaE52V+fOV0TULisk8aduj/gzcEuX5wjzPcviRZIba0 Lzow== X-Gm-Message-State: APf1xPAVjmJpk179k624PogIKm3Fi0rQiQmXFOk/qBSaQ1rF7oGsdMsV POCeSgt3aAWkfMWbssZUqFDaIw== X-Google-Smtp-Source: AH8x227NkFkhGBiifGTW2pxvV/UfayjBHQ0xT8hBP8WyLpQbONFmgRAFYrIilmLmhpUBYmeh9FIY5Q== X-Received: by 2002:a17:902:8c83:: with SMTP id t3-v6mr15325578plo.310.1519753777943; Tue, 27 Feb 2018 09:49:37 -0800 (PST) Received: from midnight.lan (2600-6c52-6200-09b7-0000-0000-0000-0d66.dhcp6.chtrptr.net. [2600:6c52:6200:9b7::d66]) by smtp.gmail.com with ESMTPSA id t15sm18581523pfa.60.2018.02.27.09.49.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Feb 2018 09:49:37 -0800 (PST) From: Michael Lyle To: linux-bcache@vger.kernel.org, linux-block@vger.kernel.org Cc: axboe@fb.com, Coly Li Subject: [PATCH 1/2] bcache: correct flash only vols (check all uuids) Date: Tue, 27 Feb 2018 09:49:29 -0800 Message-Id: <20180227174930.15911-2-mlyle@lyle.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180227174930.15911-1-mlyle@lyle.org> References: <20180227174930.15911-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: Coly Li Commit 2831231d4c3f ("bcache: reduce cache_set devices iteration by devices_max_used") adds c->devices_max_used to reduce iteration of c->uuids elements, this value is updated in bcache_device_attach(). But for flash only volume, when calling flash_devs_run(), the function bcache_device_attach() is not called yet and c->devices_max_used is not updated. The unexpected result is, the flash only volume won't be run by flash_devs_run(). This patch fixes the issue by iterate all c->uuids elements in flash_devs_run(). c->devices_max_used will be updated properly when bcache_device_attach() gets called. [mlyle: commit subject edited for character limit] Fixes: 2831231d4c3f ("bcache: reduce cache_set devices iteration by devices_max_used") Reported-by: Tang Junhui Signed-off-by: Coly Li Reviewed-by: Michael Lyle --- drivers/md/bcache/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 312895788036..4d1d8dfb2d2a 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -1274,7 +1274,7 @@ static int flash_devs_run(struct cache_set *c) struct uuid_entry *u; for (u = c->uuids; - u < c->uuids + c->devices_max_used && !ret; + u < c->uuids + c->nr_uuids && !ret; u++) if (UUID_FLASH_ONLY(u)) ret = flash_dev_run(c, u);