diff options
author | Karel Zak | 2012-09-25 16:47:18 +0200 |
---|---|---|
committer | Karel Zak | 2012-09-25 16:47:18 +0200 |
commit | 4709c9e6a19f46bbd085199607438b5ec9f0b0f6 (patch) | |
tree | 3176bafe0b5e6377efff421c46672d7b1415a54d /libmount/src/mountP.h | |
parent | libmount: user-mounted loopback fs cannot be unmounted by user (diff) | |
download | kernel-qcow2-util-linux-4709c9e6a19f46bbd085199607438b5ec9f0b0f6.tar.gz kernel-qcow2-util-linux-4709c9e6a19f46bbd085199607438b5ec9f0b0f6.tar.xz kernel-qcow2-util-linux-4709c9e6a19f46bbd085199607438b5ec9f0b0f6.zip |
libmount: optimize mtab and utab parsing in umount
create 8000 NFS mountpoints:
#!/bin/bash
mount=/tmp/mount
if [ ! -d $mount ]; then
mkdir -p $mount
fi
for dir in {1..8000}; do
if [ ! -d $mount/$dir ]; then
mkdir -p $mount/$dir
fi
echo mount $dir
mount -t nfs 127.0.0.1:/ $mount/$dir
done
old version:
time ./umount /tmp/mount/2255
real 0m1.254s
user 0m1.002s
sys 0m0.238s
new version:
time ./umount /tmp/mount/2244
real 0m0.332s
user 0m0.111s
sys 0m0.218s
Reported-by: chenditang <chendt.fnst@cn.fujitsu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/mountP.h')
-rw-r--r-- | libmount/src/mountP.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libmount/src/mountP.h b/libmount/src/mountP.h index 0ef073a69..bbaa2c6c4 100644 --- a/libmount/src/mountP.h +++ b/libmount/src/mountP.h @@ -148,6 +148,10 @@ extern int mnt_get_filesystems(char ***filesystems, const char *pattern); extern void mnt_free_filesystems(char **filesystems); /* tab.c */ +extern int mnt_table_set_parser_fltrcb( struct libmnt_table *tb, + int (*cb)(struct libmnt_fs *, void *), + void *data); + extern struct libmnt_fs *mnt_table_get_fs_root(struct libmnt_table *tb, struct libmnt_fs *fs, unsigned long mountflags, @@ -248,6 +252,10 @@ struct libmnt_table { int (*errcb)(struct libmnt_table *tb, const char *filename, int line); + int (*fltrcb)(struct libmnt_fs *fs, void *data); + void *fltrcb_data; + + struct list_head ents; /* list of entries (libmnt_fs) */ }; @@ -285,6 +293,9 @@ struct libmnt_context int (*table_errcb)(struct libmnt_table *tb, /* callback for libmnt_table structs */ const char *filename, int line); + int (*table_fltrcb)(struct libmnt_fs *fs, void *data); /* callback for libmnt_table structs */ + void *table_fltrcb_data; + char *(*pwd_get_cb)(struct libmnt_context *); /* get encryption password */ void (*pwd_release_cb)(struct libmnt_context *, char *); /* release password */ @@ -395,6 +406,10 @@ extern int mnt_context_clear_loopdev(struct libmnt_context *cxt); extern int mnt_fork_context(struct libmnt_context *cxt); +extern int mnt_context_set_tabfilter(struct libmnt_context *cxt, + int (*fltr)(struct libmnt_fs *, void *), + void *data); + /* tab_update.c */ extern int mnt_update_set_filename(struct libmnt_update *upd, const char *filename, int userspace_only); |