Received: by 2002:a4a:3008:0:0:0:0:0 with SMTP id q8-v6csp3642593oof; Mon, 10 Sep 2018 18:39:06 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdaix67SrfGng046A9xVpQYxvNdhngk4w6p0+SFehV3g4fBCx6ERv82wweVLmZAv/4uyr8ct X-Received: by 2002:a17:902:a413:: with SMTP id p19-v6mr24705338plq.220.1536629946406; Mon, 10 Sep 2018 18:39:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536629946; cv=none; d=google.com; s=arc-20160816; b=EkH3Azz3AU4CPrMSCh291UKjQ3gYvo5F7iyVMsGYVvr5RcVtz1SKJ18PACsAoUY/lH 7g0+xCelmw+KaS9iwsxhE5EZcswfJVFXRPBb0qWk08T7h5bVUAOadfAqXMUWl8s3rnUl ohxSJZuXTcbAh7tyZDyaXVTckuwwCXGeY+le4aywd8tGrn+8p6Cthn1J8q0RllmQrmNv MhrB/QD5bXLXoL7yz2JR9tW6kq0FLt2+JFmIDSQgZgGlDULEkgVcRGAYH3nPOFHZRlj+ hbUt4zLiibJBAcfGZQfno1IssltNYoQBvUC8VdXT4813MOtIcELYMEdmBPwt1CfUe5GX +/vA== 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:in-reply-to :references:subject:cc:to:mime-version:user-agent:from:date :message-id; bh=6KS9TLeP3lrtCdoPr2/52fKoKTJS8CBrYpSIP8hseQo=; b=W7VoIbxCYRVjAN+uOGcimz9u3eS8vfNLC44/NhpN4dtMSLNMMUAdqQfwotf9zD5pWD D9oXfTJ4cf/98nYp0ZXZES7fNtCUrUHQms+d7VXzsvUH3sPUfwM1rNcwEXFwIHUEiraw VkpnZJ3xDa6D9cfZmSTf4Sbqw6yNXgn4VgLo7jpHe4Da9Ir22Y06qZYi6jbj2kdTxG2Q pyMu2DDsyU/fGh4S68ErNkYlmkAmOMzVSlog2CC6KF/ProoYvz7Tseo3rYxj4jafGszu VVG1oIBZ7AhkBYGQwpLgrtPKuwp957fbc3Q+oD0CMJkoZId8jWZk46PvfeU9M9R/L9JU aMfQ== ARC-Authentication-Results: i=1; mx.google.com; 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 t8-v6si16784444plz.126.2018.09.10.18.38.50; Mon, 10 Sep 2018 18:39:06 -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; 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 S1726720AbeIKGdx (ORCPT + 99 others); Tue, 11 Sep 2018 02:33:53 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:56614 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726251AbeIKGdx (ORCPT ); Tue, 11 Sep 2018 02:33:53 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 99431D8D83A46; Tue, 11 Sep 2018 09:37:00 +0800 (CST) Received: from [127.0.0.1] (10.177.29.68) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.399.0; Tue, 11 Sep 2018 09:37:00 +0800 Message-ID: <5B971C3B.4070605@huawei.com> Date: Tue, 11 Sep 2018 09:36:59 +0800 From: zhong jiang User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Junhui Tang CC: , Kent Overstreet , , Subject: Re: [PATCH] bcache: remove unnecessary null poiner check in cache_set_free References: <1536406766-27021-1-git-send-email-zhongjiang@huawei.com> In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.177.29.68] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/9/11 8:59, Junhui Tang wrote: > This patch is NOT OK to me,maybe many cache in a cache_set, and some > cache are not registered yet, so ca is possible NULL. Yep, It's my fault. please ingnore the patch. Thanks, zhong jiang > zhong jiang 于2018年9月8日周六 下午7:52写道: >> The iterator in for_each_cache is never null, therefore, remove >> the redundant null pointer check. >> >> Signed-off-by: zhong jiang >> --- >> drivers/md/bcache/super.c | 11 +++++------ >> 1 file changed, 5 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c >> index 94c756c..2d26f9e 100644 >> --- a/drivers/md/bcache/super.c >> +++ b/drivers/md/bcache/super.c >> @@ -1513,12 +1513,11 @@ static void cache_set_free(struct closure *cl) >> bch_btree_cache_free(c); >> bch_journal_free(c); >> >> - for_each_cache(ca, c, i) >> - if (ca) { >> - ca->set = NULL; >> - c->cache[ca->sb.nr_this_dev] = NULL; >> - kobject_put(&ca->kobj); >> - } >> + for_each_cache(ca, c, i) { >> + ca->set = NULL; >> + c->cache[ca->sb.nr_this_dev] = NULL; >> + kobject_put(&ca->kobj); >> + } >> >> bch_bset_sort_state_free(&c->sort); >> free_pages((unsigned long) c->uuids, ilog2(bucket_pages(c))); >> -- >> 1.7.12.4 >> >