Received: from eggs.gnu.org ([2001:4830:134:3::10]:52853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vgxpi-00047p-4r for qemu-devel@nongnu.org; Thu, 14 Nov 2013 09:23:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vgxpc-0006GX-Hd for qemu-devel@nongnu.org; Thu, 14 Nov 2013 09:23:46 -0500 Received: from mail.avalus.com ([2001:41c8:10:1dd::10]:42172) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vgxpc-0006Ey-3S for qemu-devel@nongnu.org; Thu, 14 Nov 2013 09:23:40 -0500 Date: Thu, 14 Nov 2013 14:23:29 +0000 From: Alex Bligh Message-ID: In-Reply-To: <20131114091726.GA9755@dhcp-200-207.str.redhat.com> References: <1384416928-3441-1-git-send-email-cyliu@suse.com> <20131114091726.GA9755@dhcp-200-207.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: Re: [Qemu-devel] [PATCH] qemu-img: set nocow flag to new file Reply-To: Alex Bligh List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , Chunyan Liu Cc: Alex Bligh , qemu-devel@nongnu.org, stefanha@redhat.com --On 14 November 2013 10:17:26 +0100 Kevin Wolf wrote: >> +#ifdef __linux__ >> + /* set NOCOW flag to solve performance issue on fs like btrfs */ >> + int attr; >> + attr = FS_NOCOW_FL; >> + ioctl(fd, FS_IOC_SETFLAGS, &attr); >> +#endif > > ioctl() returning an error is ignored. This is probably okay because > we're only talking about an optimisation here. Perhaps worth a word or > two in the comment. > > However, while this ioctl is setting FS_NOCOW_FL, it is at the same time > clearing all other flags. This doesn't look right. Also, given FS_NOCOW_FL was only introduced in 2.6.39, should this not be guarded by #ifdef FS_NOCOW_FL (or better tested in configure in case it becomes something other than a #define in which case this test could replace #ifdef __linux__) -- Alex Bligh