summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2014-04-28 08:19:23 -0400
committerMiklos Szeredi <mszeredi@suse.cz>2014-04-28 08:19:23 -0400
commite27c9d3877a0d0479711a55f5cdd7ee91442da53 (patch)
tree5313ae3779a436d92b042c7584986c1f6f06afd4
parent1e18bda86e2dcc4ecb176213ee34649c93ad1396 (diff)
fuse: fuse: add time_gran to INIT_OUT
Allow userspace fs to specify time granularity. This is needed because with writeback_cache mode the kernel is responsible for generating mtime and ctime, but if the underlying filesystem doesn't support nanosecond granularity then the cache will contain a different value from the one stored on the filesystem resulting in a change of times after a cache flush. Make the default granularity 1s. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
-rw-r--r--fs/fuse/inode.c5
-rw-r--r--include/uapi/linux/fuse.h7
2 files changed, 12 insertions, 0 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 5997e4940512..560eafcdd6a7 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -891,6 +891,11 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
891 fc->async_dio = 1; 891 fc->async_dio = 1;
892 if (arg->flags & FUSE_WRITEBACK_CACHE) 892 if (arg->flags & FUSE_WRITEBACK_CACHE)
893 fc->writeback_cache = 1; 893 fc->writeback_cache = 1;
894 if (arg->time_gran && arg->time_gran <= 1000000000)
895 fc->sb->s_time_gran = arg->time_gran;
896 else
897 fc->sb->s_time_gran = 1000000000;
898
894 } else { 899 } else {
895 ra_pages = fc->max_read / PAGE_CACHE_SIZE; 900 ra_pages = fc->max_read / PAGE_CACHE_SIZE;
896 fc->no_lock = 1; 901 fc->no_lock = 1;
diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
index cf4750e1bb49..d1b4e2ca9672 100644
--- a/include/uapi/linux/fuse.h
+++ b/include/uapi/linux/fuse.h
@@ -96,6 +96,8 @@
96 * 96 *
97 * 7.23 97 * 7.23
98 * - add FUSE_WRITEBACK_CACHE 98 * - add FUSE_WRITEBACK_CACHE
99 * - add time_gran to fuse_init_out
100 * - add reserved space to fuse_init_out
99 */ 101 */
100 102
101#ifndef _LINUX_FUSE_H 103#ifndef _LINUX_FUSE_H
@@ -559,6 +561,9 @@ struct fuse_init_in {
559 uint32_t flags; 561 uint32_t flags;
560}; 562};
561 563
564#define FUSE_COMPAT_INIT_OUT_SIZE 8
565#define FUSE_COMPAT_22_INIT_OUT_SIZE 24
566
562struct fuse_init_out { 567struct fuse_init_out {
563 uint32_t major; 568 uint32_t major;
564 uint32_t minor; 569 uint32_t minor;
@@ -567,6 +572,8 @@ struct fuse_init_out {
567 uint16_t max_background; 572 uint16_t max_background;
568 uint16_t congestion_threshold; 573 uint16_t congestion_threshold;
569 uint32_t max_write; 574 uint32_t max_write;
575 uint32_t time_gran;
576 uint32_t unused[9];
570}; 577};
571 578
572#define CUSE_INIT_INFO_MAX 4096 579#define CUSE_INIT_INFO_MAX 4096