Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8e9650d authored by Li Zefan's avatar Li Zefan Committed by Al Viro
Browse files

vfs: remove duplicate code in get_fs_type()



save 14 bytes:

   text    data     bss     dec     hex filename
   1354      32       4    1390     56e fs/filesystems.o.before
   text    data     bss     dec     hex filename
   1340      32       4    1376     560 fs/filesystems.o

Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 4c728ef5
Loading
Loading
Loading
Loading
+13 −10
Original line number Original line Diff line number Diff line
@@ -253,25 +253,28 @@ static int __init proc_filesystems_init(void)
module_init(proc_filesystems_init);
module_init(proc_filesystems_init);
#endif
#endif


struct file_system_type *get_fs_type(const char *name)
static struct file_system_type *__get_fs_type(const char *name, int len)
{
{
	struct file_system_type *fs;
	struct file_system_type *fs;
	const char *dot = strchr(name, '.');
	unsigned len = dot ? dot - name : strlen(name);


	read_lock(&file_systems_lock);
	read_lock(&file_systems_lock);
	fs = *(find_filesystem(name, len));
	fs = *(find_filesystem(name, len));
	if (fs && !try_module_get(fs->owner))
	if (fs && !try_module_get(fs->owner))
		fs = NULL;
		fs = NULL;
	read_unlock(&file_systems_lock);
	read_unlock(&file_systems_lock);
	if (!fs && (request_module("%.*s", len, name) == 0)) {
	return fs;
		read_lock(&file_systems_lock);
		fs = *(find_filesystem(name, len));
		if (fs && !try_module_get(fs->owner))
			fs = NULL;
		read_unlock(&file_systems_lock);
}
}


struct file_system_type *get_fs_type(const char *name)
{
	struct file_system_type *fs;
	const char *dot = strchr(name, '.');
	int len = dot ? dot - name : strlen(name);

	fs = __get_fs_type(name, len);
	if (!fs && (request_module("%.*s", len, name) == 0))
		fs = __get_fs_type(name, len);

	if (dot && fs && !(fs->fs_flags & FS_HAS_SUBTYPE)) {
	if (dot && fs && !(fs->fs_flags & FS_HAS_SUBTYPE)) {
		put_filesystem(fs);
		put_filesystem(fs);
		fs = NULL;
		fs = NULL;