Re: [PATCH 18/79] exofs: switch to {simple,page}_symlink_inode_operations

From: Boaz Harrosh
Date: Wed May 06 2015 - 05:59:22 EST


On 05/05/2015 08:21 AM, Al Viro wrote:
> From: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
>
> Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>

ACK-by: Boaz Harrosh <ooo@xxxxxxxxxxxxxxx>

Thanks Al so much nicer (And safer)
Boaz

> ---
> fs/exofs/Kbuild | 2 +-
> fs/exofs/exofs.h | 4 ----
> fs/exofs/inode.c | 9 +++++----
> fs/exofs/namei.c | 5 +++--
> fs/exofs/symlink.c | 55 ------------------------------------------------------
> 5 files changed, 9 insertions(+), 66 deletions(-)
> delete mode 100644 fs/exofs/symlink.c
>
> diff --git a/fs/exofs/Kbuild b/fs/exofs/Kbuild
> index b47c7b8..a364fd0 100644
> --- a/fs/exofs/Kbuild
> +++ b/fs/exofs/Kbuild
> @@ -16,5 +16,5 @@
> libore-y := ore.o ore_raid.o
> obj-$(CONFIG_ORE) += libore.o
>
> -exofs-y := inode.o file.o symlink.o namei.o dir.o super.o sys.o
> +exofs-y := inode.o file.o namei.o dir.o super.o sys.o
> obj-$(CONFIG_EXOFS_FS) += exofs.o
> diff --git a/fs/exofs/exofs.h b/fs/exofs/exofs.h
> index ad9cac6..2e86086 100644
> --- a/fs/exofs/exofs.h
> +++ b/fs/exofs/exofs.h
> @@ -207,10 +207,6 @@ extern const struct address_space_operations exofs_aops;
> extern const struct inode_operations exofs_dir_inode_operations;
> extern const struct inode_operations exofs_special_inode_operations;
>
> -/* symlink.c */
> -extern const struct inode_operations exofs_symlink_inode_operations;
> -extern const struct inode_operations exofs_fast_symlink_inode_operations;
> -
> /* exofs_init_comps will initialize an ore_components device array
> * pointing to a single ore_comp struct, and a round-robin view
> * of the device table.
> diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
> index 786e4cc..73c64da 100644
> --- a/fs/exofs/inode.c
> +++ b/fs/exofs/inode.c
> @@ -1222,10 +1222,11 @@ struct inode *exofs_iget(struct super_block *sb, unsigned long ino)
> inode->i_fop = &exofs_dir_operations;
> inode->i_mapping->a_ops = &exofs_aops;
> } else if (S_ISLNK(inode->i_mode)) {
> - if (exofs_inode_is_fast_symlink(inode))
> - inode->i_op = &exofs_fast_symlink_inode_operations;
> - else {
> - inode->i_op = &exofs_symlink_inode_operations;
> + if (exofs_inode_is_fast_symlink(inode)) {
> + inode->i_op = &simple_symlink_inode_operations;
> + inode->i_link = (char *)oi->i_data;
> + } else {
> + inode->i_op = &page_symlink_inode_operations;
> inode->i_mapping->a_ops = &exofs_aops;
> }
> } else {
> diff --git a/fs/exofs/namei.c b/fs/exofs/namei.c
> index 5ae25e4..09a6bb1 100644
> --- a/fs/exofs/namei.c
> +++ b/fs/exofs/namei.c
> @@ -113,7 +113,7 @@ static int exofs_symlink(struct inode *dir, struct dentry *dentry,
> oi = exofs_i(inode);
> if (l > sizeof(oi->i_data)) {
> /* slow symlink */
> - inode->i_op = &exofs_symlink_inode_operations;
> + inode->i_op = &page_symlink_inode_operations;
> inode->i_mapping->a_ops = &exofs_aops;
> memset(oi->i_data, 0, sizeof(oi->i_data));
>
> @@ -122,7 +122,8 @@ static int exofs_symlink(struct inode *dir, struct dentry *dentry,
> goto out_fail;
> } else {
> /* fast symlink */
> - inode->i_op = &exofs_fast_symlink_inode_operations;
> + inode->i_op = &simple_symlink_inode_operations;
> + inode->i_link = (char *)oi->i_data;
> memcpy(oi->i_data, symname, l);
> inode->i_size = l-1;
> }
> diff --git a/fs/exofs/symlink.c b/fs/exofs/symlink.c
> deleted file mode 100644
> index 6f6f3a4..0000000
> --- a/fs/exofs/symlink.c
> +++ /dev/null
> @@ -1,55 +0,0 @@
> -/*
> - * Copyright (C) 2005, 2006
> - * Avishay Traeger (avishay@xxxxxxxxx)
> - * Copyright (C) 2008, 2009
> - * Boaz Harrosh <ooo@xxxxxxxxxxxxxxx>
> - *
> - * Copyrights for code taken from ext2:
> - * Copyright (C) 1992, 1993, 1994, 1995
> - * Remy Card (card@xxxxxxxxxxx)
> - * Laboratoire MASI - Institut Blaise Pascal
> - * Universite Pierre et Marie Curie (Paris VI)
> - * from
> - * linux/fs/minix/inode.c
> - * Copyright (C) 1991, 1992 Linus Torvalds
> - *
> - * This file is part of exofs.
> - *
> - * exofs is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation. Since it is based on ext2, and the only
> - * valid version of GPL for the Linux kernel is version 2, the only valid
> - * version of GPL for exofs is version 2.
> - *
> - * exofs is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with exofs; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> - */
> -
> -#include <linux/namei.h>
> -
> -#include "exofs.h"
> -
> -static void *exofs_follow_link(struct dentry *dentry, struct nameidata *nd)
> -{
> - struct exofs_i_info *oi = exofs_i(d_inode(dentry));
> -
> - nd_set_link(nd, (char *)oi->i_data);
> - return NULL;
> -}
> -
> -const struct inode_operations exofs_symlink_inode_operations = {
> - .readlink = generic_readlink,
> - .follow_link = page_follow_link_light,
> - .put_link = page_put_link,
> -};
> -
> -const struct inode_operations exofs_fast_symlink_inode_operations = {
> - .readlink = generic_readlink,
> - .follow_link = exofs_follow_link,
> -};
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/