fuse: negotiate per inode DAX in FUSE_INIT
[sfrench/cifs-2.6.git] / fs / fuse / inode.c
index dc6714350f2138329902950d5ae198bc286fd273..c256fd82af3c65f29ff7a30b9badb9e9e1a16efb 100644 (file)
@@ -1171,10 +1171,13 @@ static void process_init_reply(struct fuse_mount *fm, struct fuse_args *args,
                                        min_t(unsigned int, fc->max_pages_limit,
                                        max_t(unsigned int, arg->max_pages, 1));
                        }
-                       if (IS_ENABLED(CONFIG_FUSE_DAX) &&
-                           flags & FUSE_MAP_ALIGNMENT &&
-                           !fuse_dax_check_alignment(fc, arg->map_alignment)) {
-                               ok = false;
+                       if (IS_ENABLED(CONFIG_FUSE_DAX)) {
+                               if (flags & FUSE_MAP_ALIGNMENT &&
+                                   !fuse_dax_check_alignment(fc, arg->map_alignment)) {
+                                       ok = false;
+                               }
+                               if (flags & FUSE_HAS_INODE_DAX)
+                                       fc->inode_dax = 1;
                        }
                        if (flags & FUSE_HANDLE_KILLPRIV_V2) {
                                fc->handle_killpriv_v2 = 1;
@@ -1233,6 +1236,8 @@ void fuse_send_init(struct fuse_mount *fm)
 #ifdef CONFIG_FUSE_DAX
        if (fm->fc->dax)
                flags |= FUSE_MAP_ALIGNMENT;
+       if (fuse_is_inode_dax_mode(fm->fc->dax_mode))
+               flags |= FUSE_HAS_INODE_DAX;
 #endif
        if (fm->fc->auto_submounts)
                flags |= FUSE_SUBMOUNTS;