[sheepdog] [PATCH] sheepfs: add -okernel_cache option

Liu Yuan namei.unix at gmail.com
Mon May 28 05:41:22 CEST 2012


From: Liu Yuan <tailai.ly at taobao.com>

This option can enable us to make advantage of the kernel's page cache when
run sheepfs with -k(--pagecache) option.

For difference with direct-io (default)mode:

1 page cache has the inherent limits of max read pages, that is 128k. So a
  read requests more than 128k will be split before presenting to sheepfs.
2 direct-io mode means all the requests are directly sent to sheepfs. But
  fuse's kernel module has a default max read pages macro, 128k. If one wants
  to send reqeusts bigger than 128k and expects not to be split, he needs to
  change the macro as big enough, say 4M, in case he wants to send 4M requests
  in one go. This macro is located in kernel_src/fs/fuse/fuse_i.h, named as
  FUSE_MAX_PAGES_PER_REQ by page uint.

NOTE:
  The max write size is still limited to 128k. I am still poking a means to
  remove this limit. This probably needs to patch FUSE kernel module code.

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheepfs/core.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/sheepfs/core.c b/sheepfs/core.c
index ce1831b..ee52bd2 100644
--- a/sheepfs/core.c
+++ b/sheepfs/core.c
@@ -259,6 +259,7 @@ static int sheepfs_main_loop(char *mountpoint)
 	fuse_opt_add_arg(&args, "sheepfs"); /* placeholder for argv[0] */
 	fuse_opt_add_arg(&args, "-oallow_root");
 	fuse_opt_add_arg(&args, "-obig_writes");
+	fuse_opt_add_arg(&args, "-okernel_cache");
 	fuse_opt_add_arg(&args, "-ofsname=sheepfs");
 	fuse_opt_add_arg(&args, mountpoint);
 	if (sheepfs_debug)
-- 
1.7.10.2




More information about the sheepdog mailing list