diff mbox

[08/79] ext3: switch to simple_follow_link()

Message ID 1430803373-4948-8-git-send-email-viro@ZenIV.linux.org.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Al Viro May 5, 2015, 5:21 a.m. UTC
From: Al Viro <viro@zeniv.linux.org.uk>

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/ext3/inode.c   |  1 +
 fs/ext3/namei.c   |  3 ++-
 fs/ext3/symlink.c | 10 +---------
 3 files changed, 4 insertions(+), 10 deletions(-)

Comments

Jan Kara May 5, 2015, 9:19 a.m. UTC | #1
On Tue 05-05-15 06:21:42, Al Viro wrote:
> From: Al Viro <viro@zeniv.linux.org.uk>
> 
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  Looks good. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext3/inode.c   |  1 +
>  fs/ext3/namei.c   |  3 ++-
>  fs/ext3/symlink.c | 10 +---------
>  3 files changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
> index 2ee2dc4..6c7e546 100644
> --- a/fs/ext3/inode.c
> +++ b/fs/ext3/inode.c
> @@ -2999,6 +2999,7 @@ struct inode *ext3_iget(struct super_block *sb, unsigned long ino)
>  			inode->i_op = &ext3_fast_symlink_inode_operations;
>  			nd_terminate_link(ei->i_data, inode->i_size,
>  				sizeof(ei->i_data) - 1);
> +			inode->i_link = (char *)ei->i_data;
>  		} else {
>  			inode->i_op = &ext3_symlink_inode_operations;
>  			ext3_set_aops(inode);
> diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
> index 4264b9b..c9e767c 100644
> --- a/fs/ext3/namei.c
> +++ b/fs/ext3/namei.c
> @@ -2308,7 +2308,8 @@ retry:
>  		}
>  	} else {
>  		inode->i_op = &ext3_fast_symlink_inode_operations;
> -		memcpy((char*)&EXT3_I(inode)->i_data,symname,l);
> +		inode->i_link = (char*)&EXT3_I(inode)->i_data;
> +		memcpy(inode->i_link, symname, l);
>  		inode->i_size = l-1;
>  	}
>  	EXT3_I(inode)->i_disksize = inode->i_size;
> diff --git a/fs/ext3/symlink.c b/fs/ext3/symlink.c
> index ea96df3..c08c590 100644
> --- a/fs/ext3/symlink.c
> +++ b/fs/ext3/symlink.c
> @@ -17,17 +17,9 @@
>   *  ext3 symlink handling code
>   */
>  
> -#include <linux/namei.h>
>  #include "ext3.h"
>  #include "xattr.h"
>  
> -static void * ext3_follow_link(struct dentry *dentry, struct nameidata *nd)
> -{
> -	struct ext3_inode_info *ei = EXT3_I(d_inode(dentry));
> -	nd_set_link(nd, (char*)ei->i_data);
> -	return NULL;
> -}
> -
>  const struct inode_operations ext3_symlink_inode_operations = {
>  	.readlink	= generic_readlink,
>  	.follow_link	= page_follow_link_light,
> @@ -43,7 +35,7 @@ const struct inode_operations ext3_symlink_inode_operations = {
>  
>  const struct inode_operations ext3_fast_symlink_inode_operations = {
>  	.readlink	= generic_readlink,
> -	.follow_link	= ext3_follow_link,
> +	.follow_link	= simple_follow_link,
>  	.setattr	= ext3_setattr,
>  #ifdef CONFIG_EXT3_FS_XATTR
>  	.setxattr	= generic_setxattr,
> -- 
> 2.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 2ee2dc4..6c7e546 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -2999,6 +2999,7 @@  struct inode *ext3_iget(struct super_block *sb, unsigned long ino)
 			inode->i_op = &ext3_fast_symlink_inode_operations;
 			nd_terminate_link(ei->i_data, inode->i_size,
 				sizeof(ei->i_data) - 1);
+			inode->i_link = (char *)ei->i_data;
 		} else {
 			inode->i_op = &ext3_symlink_inode_operations;
 			ext3_set_aops(inode);
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index 4264b9b..c9e767c 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -2308,7 +2308,8 @@  retry:
 		}
 	} else {
 		inode->i_op = &ext3_fast_symlink_inode_operations;
-		memcpy((char*)&EXT3_I(inode)->i_data,symname,l);
+		inode->i_link = (char*)&EXT3_I(inode)->i_data;
+		memcpy(inode->i_link, symname, l);
 		inode->i_size = l-1;
 	}
 	EXT3_I(inode)->i_disksize = inode->i_size;
diff --git a/fs/ext3/symlink.c b/fs/ext3/symlink.c
index ea96df3..c08c590 100644
--- a/fs/ext3/symlink.c
+++ b/fs/ext3/symlink.c
@@ -17,17 +17,9 @@ 
  *  ext3 symlink handling code
  */
 
-#include <linux/namei.h>
 #include "ext3.h"
 #include "xattr.h"
 
-static void * ext3_follow_link(struct dentry *dentry, struct nameidata *nd)
-{
-	struct ext3_inode_info *ei = EXT3_I(d_inode(dentry));
-	nd_set_link(nd, (char*)ei->i_data);
-	return NULL;
-}
-
 const struct inode_operations ext3_symlink_inode_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= page_follow_link_light,
@@ -43,7 +35,7 @@  const struct inode_operations ext3_symlink_inode_operations = {
 
 const struct inode_operations ext3_fast_symlink_inode_operations = {
 	.readlink	= generic_readlink,
-	.follow_link	= ext3_follow_link,
+	.follow_link	= simple_follow_link,
 	.setattr	= ext3_setattr,
 #ifdef CONFIG_EXT3_FS_XATTR
 	.setxattr	= generic_setxattr,