Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3335793imu; Mon, 7 Jan 2019 01:13:35 -0800 (PST) X-Google-Smtp-Source: AFSGD/WyxaN4YQb4rxaQY90zkTjBU+Vs8qeS7ynJ1LmOKjYtGJx6IbJ+54We8J1UDxDGWmsdonIy X-Received: by 2002:a62:1c7:: with SMTP id 190mr62364075pfb.46.1546852415226; Mon, 07 Jan 2019 01:13:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546852415; cv=none; d=google.com; s=arc-20160816; b=u68IcHfnIU56ecEgYW23vbNIRKJPut6M2v6rp4kh+s3cLEqqiYr6oFCxHy1mdLrqDR rdhfRoubwTXtDNlyvOIQHL7wLb0FEhUxaxkvHAeKchoiE17JuO82gTIzHgAUUHAUNaju igH7N3l7Mv6cH1wja4oBL5LcI2HEe20dVgQD/HakMfB35TOx18rFt/X4sOo7scjXZfH+ dM63DE7qaAm5VsFrJZC+wshL8OYirbJA7Cqyp7Rhp128aQsyHUq0GWfpYlDlGcc+lAd9 qFC6s5m6PBiy15LsbKfXBX8FgOPfXciTlQ9PQLneASN2f8WMUOQa4nqgHWgFfjXbylyo 7NAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=WG6CDk3m4nhwk+OhARfXRcgVkg90okgkHacUSce2yjI=; b=zfoLXI/TnTG9KtQQziX0P+rY2Nr6VxSDdNh70zZbpFqq/Ve05mTqfT476+UZ9G6l/O D+t9JJukCbXVMpHUn0zJR1Z9HDwnSWGD0Z2ous7PzswTSrLsLp6vq4FB1Zjl34c+Hn9Z p3nhE3Xz3cDK7ykXa5p7f4rJLuuLPB3UvWrLmCXCLfhiTGEbD7n5wbcxbOnHZnRRnb02 3g+t8wytnDix7jpZBNvN9N62XnI7Qy6SCgL2gHMD5PWqD9UEeaBml2P4te/iGYMqWquQ Tx02i4i4rJ6q7aSwiLhBoY/sG2SCoDpDSPjFcn9pEs6BqnWhKk6arb4vRDH+PAD0LEq5 hTKA== 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 u5si2535576pgi.146.2019.01.07.01.13.19; Mon, 07 Jan 2019 01:13:35 -0800 (PST) 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 S1726716AbfAGJLu convert rfc822-to-8bit (ORCPT + 99 others); Mon, 7 Jan 2019 04:11:50 -0500 Received: from smtp.ctxuk.citrix.com ([185.25.65.24]:40516 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726531AbfAGJLu (ORCPT ); Mon, 7 Jan 2019 04:11:50 -0500 X-IronPort-AV: E=Sophos;i="5.56,450,1539648000"; d="scan'208";a="84216627" From: Paul Durrant To: 'Dongli Zhang' , "xen-devel@lists.xenproject.org" , "linux-block@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: "konrad.wilk@oracle.com" , Roger Pau Monne , "axboe@kernel.dk" Subject: RE: [PATCH v4 1/2] xen/blkback: add stack variable 'blkif' in connect_ring() Thread-Topic: [PATCH v4 1/2] xen/blkback: add stack variable 'blkif' in connect_ring() Thread-Index: AQHUpkp5vrBK4NjhGEeMyY1dcgdul6WjhUsw Date: Mon, 7 Jan 2019 09:11:44 +0000 Message-ID: <1962950ce556421e9630ef561600f4f3@AMSPEX02CL03.citrite.net> References: <1546839359-5478-1-git-send-email-dongli.zhang@oracle.com> In-Reply-To: <1546839359-5478-1-git-send-email-dongli.zhang@oracle.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Dongli Zhang [mailto:dongli.zhang@oracle.com] > Sent: 07 January 2019 05:36 > To: xen-devel@lists.xenproject.org; linux-block@vger.kernel.org; linux- > kernel@vger.kernel.org > Cc: konrad.wilk@oracle.com; Roger Pau Monne ; > axboe@kernel.dk; Paul Durrant > Subject: [PATCH v4 1/2] xen/blkback: add stack variable 'blkif' in > connect_ring() > > As 'be->blkif' is used for many times in connect_ring(), the stack > variable > 'blkif' is added to substitute 'be-blkif'. > > Suggested-by: Paul Durrant > Signed-off-by: Dongli Zhang That looks better :-) Reviewed-by: Paul Durrant > --- > drivers/block/xen-blkback/xenbus.c | 27 ++++++++++++++------------- > 1 file changed, 14 insertions(+), 13 deletions(-) > > diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen- > blkback/xenbus.c > index a4bc74e..a4aadac 100644 > --- a/drivers/block/xen-blkback/xenbus.c > +++ b/drivers/block/xen-blkback/xenbus.c > @@ -1023,6 +1023,7 @@ static int read_per_ring_refs(struct xen_blkif_ring > *ring, const char *dir) > static int connect_ring(struct backend_info *be) > { > struct xenbus_device *dev = be->dev; > + struct xen_blkif *blkif = be->blkif; > unsigned int pers_grants; > char protocol[64] = ""; > int err, i; > @@ -1033,25 +1034,25 @@ static int connect_ring(struct backend_info *be) > > pr_debug("%s %s\n", __func__, dev->otherend); > > - be->blkif->blk_protocol = BLKIF_PROTOCOL_DEFAULT; > + blkif->blk_protocol = BLKIF_PROTOCOL_DEFAULT; > err = xenbus_scanf(XBT_NIL, dev->otherend, "protocol", > "%63s", protocol); > if (err <= 0) > strcpy(protocol, "unspecified, assuming default"); > else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE)) > - be->blkif->blk_protocol = BLKIF_PROTOCOL_NATIVE; > + blkif->blk_protocol = BLKIF_PROTOCOL_NATIVE; > else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_X86_32)) > - be->blkif->blk_protocol = BLKIF_PROTOCOL_X86_32; > + blkif->blk_protocol = BLKIF_PROTOCOL_X86_32; > else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_X86_64)) > - be->blkif->blk_protocol = BLKIF_PROTOCOL_X86_64; > + blkif->blk_protocol = BLKIF_PROTOCOL_X86_64; > else { > xenbus_dev_fatal(dev, err, "unknown fe protocol %s", > protocol); > return -ENOSYS; > } > pers_grants = xenbus_read_unsigned(dev->otherend, "feature- > persistent", > 0); > - be->blkif->vbd.feature_gnt_persistent = pers_grants; > - be->blkif->vbd.overflow_max_grants = 0; > + blkif->vbd.feature_gnt_persistent = pers_grants; > + blkif->vbd.overflow_max_grants = 0; > > /* > * Read the number of hardware queues from frontend. > @@ -1067,16 +1068,16 @@ static int connect_ring(struct backend_info *be) > requested_num_queues, xenblk_max_queues); > return -ENOSYS; > } > - be->blkif->nr_rings = requested_num_queues; > - if (xen_blkif_alloc_rings(be->blkif)) > + blkif->nr_rings = requested_num_queues; > + if (xen_blkif_alloc_rings(blkif)) > return -ENOMEM; > > pr_info("%s: using %d queues, protocol %d (%s) %s\n", dev->nodename, > - be->blkif->nr_rings, be->blkif->blk_protocol, protocol, > + blkif->nr_rings, blkif->blk_protocol, protocol, > pers_grants ? "persistent grants" : ""); > > - if (be->blkif->nr_rings == 1) > - return read_per_ring_refs(&be->blkif->rings[0], dev- > >otherend); > + if (blkif->nr_rings == 1) > + return read_per_ring_refs(&blkif->rings[0], dev->otherend); > else { > xspathsize = strlen(dev->otherend) + xenstore_path_ext_size; > xspath = kmalloc(xspathsize, GFP_KERNEL); > @@ -1085,10 +1086,10 @@ static int connect_ring(struct backend_info *be) > return -ENOMEM; > } > > - for (i = 0; i < be->blkif->nr_rings; i++) { > + for (i = 0; i < blkif->nr_rings; i++) { > memset(xspath, 0, xspathsize); > snprintf(xspath, xspathsize, "%s/queue-%u", dev- > >otherend, i); > - err = read_per_ring_refs(&be->blkif->rings[i], xspath); > + err = read_per_ring_refs(&blkif->rings[i], xspath); > if (err) { > kfree(xspath); > return err; > -- > 2.7.4