|
From: | Alex Bligh |
Subject: | Re: [Qemu-devel] [PATCH] qemu-img: set nocow flag to new file |
Date: | Thu, 14 Nov 2013 14:23:29 +0000 |
--On 14 November 2013 10:17:26 +0100 Kevin Wolf <address@hidden> 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); +#endifioctl() 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
[Prev in Thread] | Current Thread | [Next in Thread] |