mirror of
https://git.code.sf.net/p/ntfs-3g/ntfs-3g.git
synced 2024-11-27 03:53:48 +08:00
Used kernel cacheing on read-only mounts or with lowntfs-3g
Kernel cacheing is now safe when using lowntfs-3g on Linux. It is also safe on read-only mounts with both ntfs-3g and lowntfs-3g.
This commit is contained in:
parent
4163390f2b
commit
5d6fd5c2d2
@ -119,6 +119,9 @@ enum {
|
||||
* having access control in the file system leads to fewer requests
|
||||
* to the file system and fewer context switches.
|
||||
*
|
||||
* Irrespective of the selected mode, cacheing is always used
|
||||
* in read-only mounts
|
||||
*
|
||||
* Possible values for high level :
|
||||
* 1 : no cache, kernel control (recommended)
|
||||
* 4 : no cache, file system control
|
||||
@ -126,8 +129,8 @@ enum {
|
||||
* 7 : no cache, kernel control for ACLs
|
||||
*
|
||||
* Possible values for low level :
|
||||
* 2 : no cache, kernel control (recommended)
|
||||
* 3 : use kernel/fuse cache, kernel control
|
||||
* 2 : no cache, kernel control
|
||||
* 3 : use kernel/fuse cache, kernel control (recommended)
|
||||
* 5 : no cache, file system control
|
||||
* 6 : kernel/fuse cache, file system control (OpenIndiana only)
|
||||
* 8 : no cache, kernel control for ACLs
|
||||
@ -138,6 +141,7 @@ enum {
|
||||
* of 6 is added in the mount report.
|
||||
*/
|
||||
|
||||
#define TIMEOUT_RO 600 /* Attribute time out for read-only mounts */
|
||||
#if defined(__sun) && defined(__SVR4)
|
||||
/*
|
||||
* Access control by kernel is not implemented on OpenIndiana,
|
||||
@ -153,7 +157,7 @@ enum {
|
||||
* Also ACL checks by recent kernels do not prove satisfactory.
|
||||
*/
|
||||
#define HPERMSCONFIG 1
|
||||
#define LPERMSCONFIG 2
|
||||
#define LPERMSCONFIG 3
|
||||
#endif /* defined(__sun) && defined(__SVR4) */
|
||||
|
||||
#endif /* defined _NTFS_PARAM_H */
|
||||
|
@ -129,12 +129,12 @@
|
||||
#endif
|
||||
|
||||
#if !CACHEING
|
||||
#define ATTR_TIMEOUT 0.0
|
||||
#define ENTRY_TIMEOUT 0.0
|
||||
#define ATTR_TIMEOUT (ctx->ro ? TIMEOUT_RO : 0.0)
|
||||
#define ENTRY_TIMEOUT (ctx->ro ? TIMEOUT_RO : 0.0)
|
||||
#else
|
||||
#if defined(__sun) && defined (__SVR4)
|
||||
#define ATTR_TIMEOUT 10.0
|
||||
#define ENTRY_TIMEOUT 10.0
|
||||
#define ATTR_TIMEOUT (ctx->ro ? TIMEOUT_RO : 10.0)
|
||||
#define ENTRY_TIMEOUT (ctx->ro ? TIMEOUT_RO : 10.0)
|
||||
#else /* defined(__sun) && defined (__SVR4) */
|
||||
/*
|
||||
* FUSE cacheing is only usable with basic permissions
|
||||
@ -144,11 +144,13 @@
|
||||
#warning "Fuse cacheing is only usable with basic permissions checked by kernel"
|
||||
#endif
|
||||
#if KERNELACLS
|
||||
#define ATTR_TIMEOUT 10.0
|
||||
#define ENTRY_TIMEOUT 10.0
|
||||
#define ATTR_TIMEOUT (ctx->ro ? TIMEOUT_RO : 10.0)
|
||||
#define ENTRY_TIMEOUT (ctx->ro ? TIMEOUT_RO : 10.0)
|
||||
#else /* KERNELACLS */
|
||||
#define ATTR_TIMEOUT (ctx->vol->secure_flags & (1 << SECURITY_DEFAULT) ? 10.0 : 0.0)
|
||||
#define ENTRY_TIMEOUT (ctx->vol->secure_flags & (1 << SECURITY_DEFAULT) ? 10.0 : 0.0)
|
||||
#define ATTR_TIMEOUT (ctx->ro ? TIMEOUT_RO : \
|
||||
(ctx->vol->secure_flags & (1 << SECURITY_DEFAULT) ? 10.0 : 0.0))
|
||||
#define ENTRY_TIMEOUT (ctx->ro ? TIMEOUT_RO : \
|
||||
(ctx->vol->secure_flags & (1 << SECURITY_DEFAULT) ? 10.0 : 0.0))
|
||||
#endif /* KERNELACLS */
|
||||
#endif /* defined(__sun) && defined (__SVR4) */
|
||||
#endif /* !CACHEING */
|
||||
|
@ -4054,13 +4054,28 @@ static struct fuse *mount_fuse(char *parsed_options)
|
||||
|
||||
if (fuse_opt_add_arg(&args, "") == -1)
|
||||
goto err;
|
||||
if (ctx->ro) {
|
||||
char buf[128];
|
||||
int len;
|
||||
|
||||
len = snprintf(buf, sizeof(buf), "-ouse_ino,kernel_cache"
|
||||
",attr_timeout=%d,entry_timeout=%d",
|
||||
(int)TIMEOUT_RO, (int)TIMEOUT_RO);
|
||||
if ((len < 0)
|
||||
|| (len >= (int)sizeof(buf))
|
||||
|| (fuse_opt_add_arg(&args, buf) == -1))
|
||||
goto err;
|
||||
} else {
|
||||
#if !CACHEING
|
||||
if (fuse_opt_add_arg(&args, "-ouse_ino,kernel_cache,attr_timeout=0") == -1)
|
||||
if (fuse_opt_add_arg(&args, "-ouse_ino,kernel_cache"
|
||||
",attr_timeout=0") == -1)
|
||||
goto err;
|
||||
#else
|
||||
if (fuse_opt_add_arg(&args, "-ouse_ino,kernel_cache,attr_timeout=1") == -1)
|
||||
if (fuse_opt_add_arg(&args, "-ouse_ino,kernel_cache"
|
||||
",attr_timeout=1") == -1)
|
||||
goto err;
|
||||
#endif
|
||||
}
|
||||
if (ctx->debug)
|
||||
if (fuse_opt_add_arg(&args, "-odebug") == -1)
|
||||
goto err;
|
||||
|
Loading…
Reference in New Issue
Block a user