From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40819) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsOzp-0004E1-GP for qemu-devel@nongnu.org; Thu, 05 Jun 2014 00:09:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsOzj-0002hc-2k for qemu-devel@nongnu.org; Thu, 05 Jun 2014 00:09:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42487) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsOzi-0002hY-QS for qemu-devel@nongnu.org; Thu, 05 Jun 2014 00:09:39 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5549be2027733 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 5 Jun 2014 00:09:38 -0400 Message-ID: <538FED7C.3070000@redhat.com> Date: Thu, 05 Jun 2014 06:09:32 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1401933526-22436-1-git-send-email-famz@redhat.com> <1401933526-22436-9-git-send-email-famz@redhat.com> <538FDC26.4030402@redhat.com> <20140605035042.GC10963@T430.nay.redhat.com> In-Reply-To: <20140605035042.GC10963@T430.nay.redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 8/8] virtio-blk: Fill in VirtIOBlockReq.out in dataplane code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi Il 05/06/2014 05:50, Fam Zheng ha scritto: >> > Can you try moving the req allocation and assignments inside process_request >> > instead? Then you can fill in req->out directly without the struct >> > assignment. >> > > The owners of req are do_rdwr_cmd and do_flush_cmd, but do_scsi_cmd and > do_get_id_cmd don't need to allocate. They don't need it, but using req there and freeing it in complete_request_early perhaps could simplify the code. After all, the first three arguments of complete_request_early (s, elem, inhdr) are a duplicate of VirtIOBlockReq and do_flush_cmd is already doing a free after complete_request_early. Paolo > Moving the allocation means transfering the ownership from process_request to > respective cmd functions, and it's not used in two out of four. Not sure much > better than this way, but that's doable.