diff -ur nilfs2-utils.orig/man/mount.nilfs2.8 nilfs2-utils/man/mount.nilfs2.8 --- nilfs2-utils.orig/man/mount.nilfs2.8 2010-03-14 15:11:30.916690347 +0100 +++ nilfs2-utils/man/mount.nilfs2.8 2010-03-28 12:16:49.785942470 +0200 @@ -108,6 +108,11 @@ elapsed time from its creation is smaller than \fIprotection-period\fP. .TP +.BR nogc +Disable garbage collection. The cleaner daemon will not be started. +It can be be started manually, but in that case it must also be +stopped manually before unmounting. +.TP .BR order=relaxed " / " order=strict Specify order semantics for file data. Metadata is always written to follow the POSIX semantics about the order of filesystem operations. diff -ur nilfs2-utils.orig/sbin/mount/mount.nilfs2.c nilfs2-utils/sbin/mount/mount.nilfs2.c --- nilfs2-utils.orig/sbin/mount/mount.nilfs2.c 2010-03-14 15:11:30.918691251 +0100 +++ nilfs2-utils/sbin/mount/mount.nilfs2.c 2010-03-28 14:05:28.861362988 +0200 @@ -74,6 +74,9 @@ const char pp_opt_fmt[] = PPOPT_NAME "=%lu"; typedef unsigned long pp_opt_t; +const char nogc_opt_fmt[] = NOGCOPT_NAME; +typedef int nogc_opt_t; + struct mount_options { char *fstype; char *opts; @@ -329,6 +332,7 @@ int type; int mounted; pp_opt_t protperiod; + nogc_opt_t nogc; }; static int check_mtab(void) @@ -391,6 +395,8 @@ if (find_opt(mc->m.mnt_opts, pp_opt_fmt, &prot_period) >= 0) mi->protperiod = prot_period; + mi->nogc = (find_opt(mc->m.mnt_opts, nogc_opt_fmt, NULL) >= 0); + switch (mo->flags & (MS_RDONLY | MS_REMOUNT)) { case 0: /* overlapping rw-mount */ error(_("%s: the device already has a rw-mount on %s." @@ -426,11 +432,13 @@ static int do_mount_one(struct nilfs_mount_info *mi, const struct mount_options *mo) { - int res, errsv; - char *exopts; + int res, errsv, mtab_ok; + char *tmpexopts, *exopts; pp_opt_t prot_period; - exopts = change_opt(mo->extra_opts, pp_opt_fmt, &prot_period, ""); + tmpexopts = change_opt(mo->extra_opts, pp_opt_fmt, &prot_period, ""); + exopts = change_opt(tmpexopts, nogc_opt_fmt, NULL, ""); + my_free(tmpexopts); res = mount(mi->device, mi->mntdir, fstype, mo->flags & ~MS_NOSYS, exopts); @@ -450,9 +458,12 @@ } if (mi->type != RW2RO_REMOUNT && mi->type != RW2RW_REMOUNT) goto out; + + mtab_ok = check_mtab(); + /* Cleaner daemon was stopped and it needs to run */ /* because filesystem is still mounted */ - if (check_mtab()) { + if (!mi->nogc && mtab_ok) { /* Restarting cleaner daemon */ if (start_cleanerd(mi->device, mi->mntdir, mi->protperiod, &mi->gcpid) == 0) { @@ -481,7 +492,7 @@ char *exopts; int rungc; - rungc = !(mo->flags & MS_RDONLY) && !(mo->flags & MS_BIND); + rungc = (find_opt(mo->extra_opts, nogc_opt_fmt, NULL) < 0) && !(mo->flags & MS_RDONLY) && !(mo->flags & MS_BIND); if (!check_mtab()) { if (rungc) diff -ur nilfs2-utils.orig/sbin/mount/mount.nilfs2.h nilfs2-utils/sbin/mount/mount.nilfs2.h --- nilfs2-utils.orig/sbin/mount/mount.nilfs2.h 2010-03-14 15:11:30.918691251 +0100 +++ nilfs2-utils/sbin/mount/mount.nilfs2.h 2010-03-28 11:05:38.717647856 +0200 @@ -14,6 +14,7 @@ #define CLEANERD_NAME "nilfs_cleanerd" #define PIDOPT_NAME "gcpid" #define PPOPT_NAME "pp" +#define NOGCOPT_NAME "nogc" #define CLEANERD_WAIT_RETRY_COUNT 3 #define CLEANERD_WAIT_RETRY_INTERVAL 2 /* in seconds */