Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3739756yba; Tue, 23 Apr 2019 08:50:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMT23fie4k86mwHj2rGiPyKxhMlBqupvHIhi2IZKsRkGXzejp/Lrs7C2eO7eqgRDwY4nyT X-Received: by 2002:a63:4c:: with SMTP id 73mr25315789pga.210.1556034644602; Tue, 23 Apr 2019 08:50:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556034644; cv=none; d=google.com; s=arc-20160816; b=nEObrbjr/Ye2hU/zKCMgTEIaFoictf9KBFDCkpuoemGf7rQV6DAZF+dmROaqjFTPcC Ar1ThLhyUo8GQv607U4b103nQEYZqFvUP3o6wYchus2s/p007T+7L8lkK9ElN4/KST7Q J8Vf0Ic9nqR20SHILr4oTEDjUY5rYWffWThockjwNoxi56uZj7Y1O2BHpE07Zqd6AZt5 uZUqbJlE3qZLj7braHeIpgB9GZd+nU4O3ivBAGaJIvjRsfPKVBH+tYP9kApPmb1FR1U6 fvXcH5aYAsi9svwjgrVN9qXAmivp2qiZDBsiyVohaI0Tle3z0AC2Oki/hL6BsO3Ivs/Z dg9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=BDRIWzInkkfLVSX/ZJcGJ7Zz0BK3R9sN2jdBwbzjJs8=; b=q0JeM6EOBE9HZWBtqU1/wYO+pKOXU+V/fSwb+m1mdZIA2tktBgGZqX/nwz31m0rtHP aiO4XJ/wOzgXdOZ8VL+nLGps4gciPG5/soMgoKl2v5JgxNXk+Uhs8velrtR5MG8H9/Ii j06XgMo6jCjOwZv3BnIu+TMnJ7kZ7VV9BE60VJlXroelqtMFTUVeEWo5t6o1rwjBFsvb im5Ppu+tfORwqToHSgGx25rCGbV+f0ntq7ez2PXs9VvT+Q+JrcLBaLRS5gpHlVbsfKwu syrupRj7JgUPpg4Ji1efoLg2Klt7bJuomx74VrAGTVzQ8z5SKSrkBn0G+hKUTbnBwmdu c/3w== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t14si16566157pfa.102.2019.04.23.08.50.29; Tue, 23 Apr 2019 08:50:44 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728474AbfDWPtl (ORCPT + 99 others); Tue, 23 Apr 2019 11:49:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45446 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727740AbfDWPtk (ORCPT ); Tue, 23 Apr 2019 11:49:40 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 30CD73003B46; Tue, 23 Apr 2019 15:49:38 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 509741001DDC; Tue, 23 Apr 2019 15:49:32 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id x3NFnVHH019162; Tue, 23 Apr 2019 11:49:31 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id x3NFnVdW019159; Tue, 23 Apr 2019 11:49:31 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Tue, 23 Apr 2019 11:49:31 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Huaisheng Ye cc: snitzer@redhat.com, agk@redhat.com, prarit@redhat.com, chengnt@lenovo.com, dm-devel@redhat.com, linux-kernel@vger.kernel.org, Huaisheng Ye Subject: Re: [PATCH] dm-writecache: simplify the using of pointer wb In-Reply-To: <20190412152718.27102-1-huye@redhat.com> Message-ID: References: <20190412152718.27102-1-huye@redhat.com> User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 23 Apr 2019 15:49:40 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 12 Apr 2019, Huaisheng Ye wrote: > From: Huaisheng Ye > > In function __writecache_writeback_pmem, the pointer bio has been > already there, it doesn't need to seek bio's address from pointer wb. The compiler optimizer knows that the offset between "wb" and "bio" is constant, so that there is no difference in the generated code before or after this patch. Mikulas > Signed-off-by: Huaisheng Ye > --- > drivers/md/dm-writecache.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c > index f782287..5b4d1c1 100644 > --- a/drivers/md/dm-writecache.c > +++ b/drivers/md/dm-writecache.c > @@ -1478,9 +1478,9 @@ static void __writecache_writeback_pmem(struct dm_writecache *wc, struct writeba > bio = bio_alloc_bioset(GFP_NOIO, max_pages, &wc->bio_set); > wb = container_of(bio, struct writeback_struct, bio); > wb->wc = wc; > - wb->bio.bi_end_io = writecache_writeback_endio; > - bio_set_dev(&wb->bio, wc->dev->bdev); > - wb->bio.bi_iter.bi_sector = read_original_sector(wc, e); > + bio->bi_end_io = writecache_writeback_endio; > + bio_set_dev(bio, wc->dev->bdev); > + bio->bi_iter.bi_sector = read_original_sector(wc, e); > wb->page_offset = PAGE_SIZE; > if (max_pages <= WB_LIST_INLINE || > unlikely(!(wb->wc_list = kmalloc_array(max_pages, sizeof(struct wc_entry *), > @@ -1507,12 +1507,12 @@ static void __writecache_writeback_pmem(struct dm_writecache *wc, struct writeba > wb->wc_list[wb->wc_list_n++] = f; > e = f; > } > - bio_set_op_attrs(&wb->bio, REQ_OP_WRITE, WC_MODE_FUA(wc) * REQ_FUA); > + bio_set_op_attrs(bio, REQ_OP_WRITE, WC_MODE_FUA(wc) * REQ_FUA); > if (writecache_has_error(wc)) { > bio->bi_status = BLK_STS_IOERR; > - bio_endio(&wb->bio); > + bio_endio(bio); > } else { > - submit_bio(&wb->bio); > + submit_bio(bio); > } > > __writeback_throttle(wc, wbl); > -- > 1.8.3.1 >