]> granicus.if.org Git - zfs/commitdiff
Enable /etc/mtab cache to improve performance
authorBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 7 Jan 2014 17:21:20 +0000 (09:21 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 7 Jan 2014 17:48:09 +0000 (09:48 -0800)
Re-enable the /etc/mtab cache to prevent the zfs command from
having to repeatedly open and read from the /etc/mtab file.
Instead an AVL tree of the mounted filesystems is created and
used to vastly speed up lookups. This means that if non-zfs
filesystems are mounted concurrently the 'zfs mount' will not
immediately detect them.  In practice that will rarely happen
and even if it does the absolute worst case would be a failed
mount.  This was originally disabled out of an abundance of
paranoia.

NOTE: There may still be some parts of the code which do not
consult the mtab cache.  They should be updated to check the
mtab cache as they as discovered to be a problem.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Turbo Fredriksson <turbo@bayour.com>
Signed-off-by: Chris Dunlop <chris@onthe.net.au>
Issue #845

cmd/zfs/zfs_main.c

index cea42123812e10f2b861c0074adbe2142950a55a..836979bdf741b7866de5941fabc57cae83349b58 100644 (file)
@@ -6477,7 +6477,7 @@ main(int argc, char **argv)
        /*
         * Run the appropriate command.
         */
-       libzfs_mnttab_cache(g_zfs, B_FALSE);
+       libzfs_mnttab_cache(g_zfs, B_TRUE);
        if (find_command_idx(cmdname, &i) == 0) {
                current_command = &command_table[i];
                ret = command_table[i].func(argc - 1, argv + 1);