From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44460) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THFPv-0000zt-2x for qemu-devel@nongnu.org; Thu, 27 Sep 2012 10:50:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THFPo-0008BV-9R for qemu-devel@nongnu.org; Thu, 27 Sep 2012 10:50:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:65432) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THFPo-0008Av-0D for qemu-devel@nongnu.org; Thu, 27 Sep 2012 10:50:12 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8REo8Qk008189 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 27 Sep 2012 10:50:10 -0400 Message-ID: <5064679D.5060603@redhat.com> Date: Thu, 27 Sep 2012 16:50:05 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1348675011-8794-1-git-send-email-pbonzini@redhat.com> <1348675011-8794-15-git-send-email-pbonzini@redhat.com> <50645785.3020600@redhat.com> In-Reply-To: <50645785.3020600@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 14/45] block: introduce block job error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: jcody@redhat.com, qemu-devel@nongnu.org Il 27/09/2012 15:41, Kevin Wolf ha scritto: >> > +BlockErrorAction block_job_error_action(BlockJob *job, BlockDriverState *bs, >> > + BlockdevOnError on_err, >> > + int is_read, int error) >> > +{ >> > + BlockErrorAction action; >> > + >> > + switch (on_err) { >> > + case BLOCKDEV_ON_ERROR_ENOSPC: >> > + action = (error == ENOSPC) ? BDRV_ACTION_STOP : BDRV_ACTION_REPORT; >> > + break; >> > + case BLOCKDEV_ON_ERROR_STOP: >> > + action = BDRV_ACTION_STOP; >> > + break; >> > + case BLOCKDEV_ON_ERROR_REPORT: >> > + action = BDRV_ACTION_REPORT; >> > + break; >> > + case BLOCKDEV_ON_ERROR_IGNORE: >> > + action = BDRV_ACTION_IGNORE; >> > + break; >> > + default: >> > + abort(); >> > + } > Isn't this a duplication of bdrv_get_error_action()? bdrv_get_error_action() has this: BlockdevOnError on_err = is_read ? bs->on_read_error : bs->on_write_error; It can use some refactoring to commonize the switch statement, but it's not a direct replacement. Paolo