--On 14 November 2013 10:17:26 +0100 Kevin Wolf <kw...@redhat.com> 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

Reply via email to