Enable more capabilities by default, and document defaults.
authorNikolaus Rath <Nikolaus@rath.org>
Wed, 16 Nov 2016 21:04:47 +0000 (13:04 -0800)
committerNikolaus Rath <Nikolaus@rath.org>
Wed, 16 Nov 2016 21:14:30 +0000 (13:14 -0800)
Fixes #112.

ChangeLog.rst
include/fuse_common.h
lib/fuse_lowlevel.c

index 8a22a5eced3ea62517228891521e5fd6e4bba273..10879df6db96afe876203cb9a8e13d053d7b7b8b 100644 (file)
@@ -15,6 +15,14 @@ UNRELEASED CHANGES
 * The FUSE main loop is now aborted if the file-system requests
   capabilities that are not supported by the kernel.
 
+* Most file-system capabilities that were opt-in in libfuse2 are now
+  enabled by default. Filesystem developers are encouraged to review
+  the documentation of the FUSE_CAP_* features to ensure that their
+  filesystem is compatible with the new semantics. As before, a
+  particular capability can still be disabled by unsetting the
+  corresponding bit of `fuse_conn_info.wants` in the init() handler.
+
+
 FUSE 3.0.0-rc2 (2016-11-06)
 ===========================
 
index a906bc5280e244a57f8c743648c8be3defa1738f..251ad8b01639e20f5e33cde7b06ff3a6cab63110 100644 (file)
@@ -91,45 +91,63 @@ struct fuse_file_info {
  * ensure that there is at most one pending read request per
  * file-handle at any time, and will attempt to order read requests by
  * increasing offset.
+ *
+ * This feature is enabled by default when supported by the kernel.
  */
 #define FUSE_CAP_ASYNC_READ            (1 << 0)
 
 /**
  * Indicates that the filesystem supports "remote" locking.
+ *
+ * This feature is enabled by default when supported by the kernel,
+ * and if getlk() and setlk() handlers are implemented.
  */
 #define FUSE_CAP_POSIX_LOCKS           (1 << 1)
 
 /**
  * Indicates that the filesystem supports  the O_TRUNC open flag
+ *
+ * This feature is enabled by default when supported by the kernel.
  */
 #define FUSE_CAP_ATOMIC_O_TRUNC                (1 << 3)
 
 /**
  * Indicates that the filesystem supports lookups of "." and "..".
+ *
+ * This feature is disabled by default.
  */
 #define FUSE_CAP_EXPORT_SUPPORT                (1 << 4)
 
 /**
  * Indicates that the kernel should not apply the umask to the
  * file mode on create operations.
+ *
+ * This feature is disabled by default.
  */
 #define FUSE_CAP_DONT_MASK             (1 << 6)
 
 /**
  * Indicates that libfuse should try to use splice() when writing to
- * the fuse device
+ * the fuse device. This may improve performance.
+ *
+ * This feature is disabled by default.
  */
 #define FUSE_CAP_SPLICE_WRITE          (1 << 7)
 
 /**
- * Indicates that libfuse should try to move pages instead of copying
- * when writing to / reading from the fuse device.
+ * Indicates that libfuse should try to move pages instead of copying when
+ * writing to / reading from the fuse device. This may improve performance.
+ *
+ * This feature is disabled by default.
  */
 #define FUSE_CAP_SPLICE_MOVE           (1 << 8)
 
 /**
  * Indicates that libfuse should try to use splice() when reading from
- * the fuse device.
+ * the fuse device. This may improve performance.
+ *
+ * This feature is enabled by default when supported by the kernel and
+ * if the filesystem implements a write_buf() handler.
  */
 #define FUSE_CAP_SPLICE_READ           (1 << 9)
 
@@ -140,11 +158,16 @@ struct fuse_file_info {
  * If not set, flock(2) calls will be handled by the FUSE kernel module
  * internally (so any access that does not go through the kernel cannot be taken
  * into account).
+ *
+ * This feature is enabled by default when supported by the kernel and
+ * if the filesystem implements a flock() handler.
  */
 #define FUSE_CAP_FLOCK_LOCKS           (1 << 10)
 
 /**
  * Indicates that the filesystem supports ioctl's on directories.
+ *
+ * This feature is enabled by default when supported by the kernel.
  */
 #define FUSE_CAP_IOCTL_DIR             (1 << 11)
 
@@ -165,25 +188,35 @@ struct fuse_file_info {
  * This flag should always be set when available. If all file changes
  * go through the kernel, *attr_timeout* should be set to zero to
  * avoid unneccessary getattr() calls.
+ *
+ * This feature is enabled by default when supported by the kernel.
  */
 #define FUSE_CAP_AUTO_INVAL_DATA       (1 << 12)
 
 /**
  * Indicates that the filesystem supports readdirplus
+ *
+ * This feature is enabled by default when supported by the kernel and if the
+ * filesystem implements a readdirplus() handler.
  */
 #define FUSE_CAP_READDIRPLUS           (1 << 13)
 
 /**
  * Indicates that the filesystem supports adaptive readdirplus
+ *
+ * This feature is enabled by default when supported by the kernel and if the
+ * filesystem implements a readdirplus() handler.
  */
 #define FUSE_CAP_READDIRPLUS_AUTO      (1 << 14)
 
 /**
  * Indicates that the filesystem supports asynchronous direct I/O submission.
  *
- * If this capability is not requested/available, the kernel will
- * ensure that there is at most one pending read and one pending write request per
- * direct I/O file-handle at any time.
+ * If this capability is not requested/available, the kernel will ensure that
+ * there is at most one pending read and one pending write request per direct
+ * I/O file-handle at any time.
+ *
+ * This feature is enabled by default when supported by the kernel.
  */
 #define FUSE_CAP_ASYNC_DIO             (1 << 15)
 
@@ -191,6 +224,8 @@ struct fuse_file_info {
  * Indicates that writeback caching should be enabled. This means that
  * individual write request may be buffered and merged in the kernel
  * before they are send to the filesystem.
+ *
+ * This feature is disabled by default.
  */
 #define FUSE_CAP_WRITEBACK_CACHE       (1 << 16)
 
index 77fc014cba52525d2dd603e6e67c32de803e4bdf..c53c9f7990fdfbe2865c1e0457add0934e0c2361 100644 (file)
@@ -1890,11 +1890,21 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
        if (se->conn.proto_minor >= 18)
                se->conn.capable |= FUSE_CAP_IOCTL_DIR;
 
-       /* Default settings (where non-zero) */
+       /* Default settings for modern filesystems.
+        *
+        * Most of these capabilities were disabled by default in
+        * libfuse2 for backwards compatibility reasons. In libfuse3,
+        * we can finally enable them by default (as long as they're
+        * supported by the kernel).
+        */
 #define LL_SET_DEFAULT(cond, cap) \
        if ((cond) && (se->conn.capable & (cap))) \
                se->conn.want |= (cap)
        LL_SET_DEFAULT(1, FUSE_CAP_ASYNC_READ);
+       LL_SET_DEFAULT(1, FUSE_CAP_AUTO_INVAL_DATA);
+       LL_SET_DEFAULT(1, FUSE_CAP_ASYNC_DIO);
+       LL_SET_DEFAULT(1, FUSE_CAP_IOCTL_DIR);
+       LL_SET_DEFAULT(1, FUSE_CAP_ATOMIC_O_TRUNC);
        LL_SET_DEFAULT(se->op.write_buf, FUSE_CAP_SPLICE_READ);
        LL_SET_DEFAULT(se->op.getlk && se->op.setlk,
                       FUSE_CAP_POSIX_LOCKS);