Added an optional argument (number of seconds) to the option delay_mtime
The option delay_mtime avoid updating the mtime of a file after each individual updating. With this patch, the frequency of the update can be adjusted to needs (default 60s). This is mainly useful for big files which are kept open for a long period (file system images, virtual computers, etc.)edge.strict_endians
parent
9704ff9396
commit
8f896f112a
|
@ -50,6 +50,12 @@ enum {
|
|||
/* maximum cluster size for allowing compression for new files */
|
||||
#define MAX_COMPRESSION_CLUSTER_SIZE 4096
|
||||
|
||||
/*
|
||||
* Parameters for default options
|
||||
*/
|
||||
|
||||
#define DEFAULT_DMTIME 60 /* default 1mn for delay_mtime */
|
||||
|
||||
/*
|
||||
* Use of big write buffers
|
||||
*
|
||||
|
|
|
@ -1368,7 +1368,10 @@ static void ntfs_fuse_write(fuse_req_t req, fuse_ino_t ino, const char *buf,
|
|||
total += ret;
|
||||
}
|
||||
res = total;
|
||||
if ((res > 0) && !ctx->dmtime)
|
||||
if ((res > 0)
|
||||
&& (!ctx->dmtime
|
||||
|| (le64_to_cpu(ntfs_current_time())
|
||||
- le64_to_cpu(ni->last_data_change_time)) > ctx->dmtime))
|
||||
ntfs_fuse_update_times(na->ni, NTFS_UPDATE_MCTIME);
|
||||
exit:
|
||||
if (na)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
.\" Copyright (c) 2005-2006 Yura Pakhuchiy.
|
||||
.\" Copyright (c) 2005 Richard Russon.
|
||||
.\" Copyright (c) 2006-2009 Szabolcs Szakacsits.
|
||||
.\" Copyright (c) 2009 Jean-Pierre Andre
|
||||
.\" Copyright (c) 2009-2012 Jean-Pierre Andre
|
||||
.\" This file may be copied under the terms of the GNU Public License.
|
||||
.\"
|
||||
.TH NTFS-3G 8 "February 2010" "ntfs-3g @VERSION@"
|
||||
.TH NTFS-3G 8 "May 2012" "ntfs-3g @VERSION@"
|
||||
.SH NAME
|
||||
ntfs-3g \- Third Generation Read/Write NTFS Driver
|
||||
.SH SYNOPSIS
|
||||
|
@ -199,11 +199,13 @@ this option doesn't break applications that need to know
|
|||
if a file has been read since the last time it was modified.
|
||||
This is the default behaviour.
|
||||
.TP
|
||||
.B delay_mtime
|
||||
Delay the updating of file modification time and file change time until
|
||||
the file is closed. This is mainly useful for files which are written
|
||||
to without changing their size, such as databases or file system images
|
||||
mounted as loop.
|
||||
.B delay_mtime[= value]
|
||||
Only update the file modification time and the file change time of a file
|
||||
when it is closed or when the indicated delay since the previous update has
|
||||
elapsed. The argument is a number of seconds, with a default value of 60.
|
||||
This is mainly useful for big files which are kept open for a long
|
||||
time and written to without changing their size, such as databases or file
|
||||
system images mounted as loop.
|
||||
.TP
|
||||
.B show_sys_files
|
||||
Show the metafiles in directory listings. Otherwise the default behaviour is
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (c) 2005-2007 Yura Pakhuchiy
|
||||
* Copyright (c) 2005 Yuval Fledel
|
||||
* Copyright (c) 2006-2009 Szabolcs Szakacsits
|
||||
* Copyright (c) 2007-2011 Jean-Pierre Andre
|
||||
* Copyright (c) 2007-2012 Jean-Pierre Andre
|
||||
* Copyright (c) 2009 Erik Larsson
|
||||
*
|
||||
* This file is originated from the Linux-NTFS project.
|
||||
|
@ -168,7 +168,7 @@ static const char *usage_msg =
|
|||
"\n"
|
||||
"Copyright (C) 2005-2007 Yura Pakhuchiy\n"
|
||||
"Copyright (C) 2006-2009 Szabolcs Szakacsits\n"
|
||||
"Copyright (C) 2007-2011 Jean-Pierre Andre\n"
|
||||
"Copyright (C) 2007-2012 Jean-Pierre Andre\n"
|
||||
"Copyright (C) 2009 Erik Larsson\n"
|
||||
"\n"
|
||||
"Usage: %s [-o option[,...]] <device|image_file> <mount_point>\n"
|
||||
|
@ -1293,7 +1293,10 @@ static int ntfs_fuse_write(const char *org_path, const char *buf, size_t size,
|
|||
total += ret;
|
||||
}
|
||||
res = total;
|
||||
if ((res > 0) && !ctx->dmtime)
|
||||
if ((res > 0)
|
||||
&& (!ctx->dmtime
|
||||
|| (le64_to_cpu(ntfs_current_time())
|
||||
- le64_to_cpu(ni->last_data_change_time)) > ctx->dmtime))
|
||||
ntfs_fuse_update_times(na->ni, NTFS_UPDATE_MCTIME);
|
||||
exit:
|
||||
if (na)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* ntfs-3g_common.c - Common definitions for ntfs-3g and lowntfs-3g.
|
||||
*
|
||||
* Copyright (c) 2010-2011 Jean-Pierre Andre
|
||||
* Copyright (c) 2010-2012 Jean-Pierre Andre
|
||||
* Copyright (c) 2010 Erik Larsson
|
||||
*
|
||||
* This program/include file is free software; you can redistribute it and/or
|
||||
|
@ -76,7 +76,7 @@ const struct DEFOPTION optionlist[] = {
|
|||
{ "noatime", OPT_NOATIME, FLGOPT_BOGUS },
|
||||
{ "atime", OPT_ATIME, FLGOPT_BOGUS },
|
||||
{ "relatime", OPT_RELATIME, FLGOPT_BOGUS },
|
||||
{ "delay_mtime", OPT_DMTIME, FLGOPT_BOGUS },
|
||||
{ "delay_mtime", OPT_DMTIME, FLGOPT_DECIMAL | FLGOPT_OPTIONAL },
|
||||
{ "fake_rw", OPT_FAKE_RW, FLGOPT_BOGUS },
|
||||
{ "fsname", OPT_FSNAME, FLGOPT_NOSUPPORT },
|
||||
{ "no_def_opts", OPT_NO_DEF_OPTS, FLGOPT_BOGUS },
|
||||
|
@ -262,12 +262,17 @@ char *parse_mount_options(ntfs_fuse_context_t *ctx,
|
|||
opt);
|
||||
goto err_exit;
|
||||
}
|
||||
if ((poptl->flags & FLGOPT_DECIMAL)
|
||||
&& (!val
|
||||
|| !sscanf(val, "%i", &intarg))) {
|
||||
ntfs_log_error("'%s' option needs a decimal value\n",
|
||||
opt);
|
||||
goto err_exit;
|
||||
if (poptl->flags & FLGOPT_DECIMAL) {
|
||||
if ((poptl->flags & FLGOPT_OPTIONAL) && !val)
|
||||
intarg = 0;
|
||||
else
|
||||
if (!val
|
||||
|| !sscanf(val, "%i", &intarg)) {
|
||||
ntfs_log_error("'%s' option "
|
||||
"needs a decimal value\n",
|
||||
opt);
|
||||
goto err_exit;
|
||||
}
|
||||
}
|
||||
if ((poptl->flags & FLGOPT_STRING)
|
||||
&& missing_option_value(val, opt))
|
||||
|
@ -288,7 +293,9 @@ char *parse_mount_options(ntfs_fuse_context_t *ctx,
|
|||
ctx->atime = ATIME_RELATIVE;
|
||||
break;
|
||||
case OPT_DMTIME :
|
||||
ctx->dmtime = TRUE;
|
||||
if (!intarg)
|
||||
intarg = DEFAULT_DMTIME;
|
||||
ctx->dmtime = intarg*10000000LL;
|
||||
break;
|
||||
case OPT_NO_DEF_OPTS :
|
||||
no_def_opts = TRUE; /* Don't add default options. */
|
||||
|
|
|
@ -100,7 +100,8 @@ enum {
|
|||
FLGOPT_OCTAL = 4,
|
||||
FLGOPT_DECIMAL = 8,
|
||||
FLGOPT_APPEND = 16,
|
||||
FLGOPT_NOSUPPORT = 32
|
||||
FLGOPT_NOSUPPORT = 32,
|
||||
FLGOPT_OPTIONAL = 64
|
||||
} ;
|
||||
|
||||
typedef enum {
|
||||
|
@ -117,7 +118,7 @@ typedef struct {
|
|||
unsigned int dmask;
|
||||
ntfs_fuse_streams_interface streams;
|
||||
ntfs_atime_t atime;
|
||||
BOOL dmtime;
|
||||
u64 dmtime;
|
||||
BOOL ro;
|
||||
BOOL show_sys_files;
|
||||
BOOL hide_hid_files;
|
||||
|
|
Loading…
Reference in New Issue