diff mbox

[16/79] jfs: switch to simple_follow_link()

Message ID 1430803373-4948-16-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/jfs/inode.c   |  3 ++-
 fs/jfs/namei.c   |  5 ++---
 fs/jfs/symlink.c | 10 +---------
 3 files changed, 5 insertions(+), 13 deletions(-)

Comments

Jan Kara May 5, 2015, 9:27 a.m. UTC | #1
On Tue 05-05-15 06:21:50, 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/jfs/inode.c   |  3 ++-
>  fs/jfs/namei.c   |  5 ++---
>  fs/jfs/symlink.c | 10 +---------
>  3 files changed, 5 insertions(+), 13 deletions(-)
> 
> diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
> index 070dc4b..6f1cb2b 100644
> --- a/fs/jfs/inode.c
> +++ b/fs/jfs/inode.c
> @@ -63,11 +63,12 @@ struct inode *jfs_iget(struct super_block *sb, unsigned long ino)
>  			inode->i_mapping->a_ops = &jfs_aops;
>  		} else {
>  			inode->i_op = &jfs_fast_symlink_inode_operations;
> +			inode->i_link = JFS_IP(inode)->i_inline;
>  			/*
>  			 * The inline data should be null-terminated, but
>  			 * don't let on-disk corruption crash the kernel
>  			 */
> -			JFS_IP(inode)->i_inline[inode->i_size] = '\0';
> +			inode->i_link[inode->i_size] = '\0';
>  		}
>  	} else {
>  		inode->i_op = &jfs_file_inode_operations;
> diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
> index 66db7bc..e33be92 100644
> --- a/fs/jfs/namei.c
> +++ b/fs/jfs/namei.c
> @@ -880,7 +880,6 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
>  	int ssize;		/* source pathname size */
>  	struct btstack btstack;
>  	struct inode *ip = d_inode(dentry);
> -	unchar *i_fastsymlink;
>  	s64 xlen = 0;
>  	int bmask = 0, xsize;
>  	s64 xaddr;
> @@ -946,8 +945,8 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
>  	if (ssize <= IDATASIZE) {
>  		ip->i_op = &jfs_fast_symlink_inode_operations;
>  
> -		i_fastsymlink = JFS_IP(ip)->i_inline;
> -		memcpy(i_fastsymlink, name, ssize);
> +		ip->i_link = JFS_IP(ip)->i_inline;
> +		memcpy(ip->i_link, name, ssize);
>  		ip->i_size = ssize - 1;
>  
>  		/*
> diff --git a/fs/jfs/symlink.c b/fs/jfs/symlink.c
> index 80f42bc..5929e23 100644
> --- a/fs/jfs/symlink.c
> +++ b/fs/jfs/symlink.c
> @@ -17,21 +17,13 @@
>   */
>  
>  #include <linux/fs.h>
> -#include <linux/namei.h>
>  #include "jfs_incore.h"
>  #include "jfs_inode.h"
>  #include "jfs_xattr.h"
>  
> -static void *jfs_follow_link(struct dentry *dentry, struct nameidata *nd)
> -{
> -	char *s = JFS_IP(d_inode(dentry))->i_inline;
> -	nd_set_link(nd, s);
> -	return NULL;
> -}
> -
>  const struct inode_operations jfs_fast_symlink_inode_operations = {
>  	.readlink	= generic_readlink,
> -	.follow_link	= jfs_follow_link,
> +	.follow_link	= simple_follow_link,
>  	.setattr	= jfs_setattr,
>  	.setxattr	= jfs_setxattr,
>  	.getxattr	= jfs_getxattr,
> -- 
> 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
Dave Kleikamp May 6, 2015, 1:39 p.m. UTC | #2
On 05/05/2015 12:21 AM, Al Viro wrote:
> From: Al Viro <viro@zeniv.linux.org.uk>
> 
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Dave Kleikamp <dave.kleikamp@oracle.com>

> ---
>  fs/jfs/inode.c   |  3 ++-
>  fs/jfs/namei.c   |  5 ++---
>  fs/jfs/symlink.c | 10 +---------
>  3 files changed, 5 insertions(+), 13 deletions(-)
> 
> diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
> index 070dc4b..6f1cb2b 100644
> --- a/fs/jfs/inode.c
> +++ b/fs/jfs/inode.c
> @@ -63,11 +63,12 @@ struct inode *jfs_iget(struct super_block *sb, unsigned long ino)
>  			inode->i_mapping->a_ops = &jfs_aops;
>  		} else {
>  			inode->i_op = &jfs_fast_symlink_inode_operations;
> +			inode->i_link = JFS_IP(inode)->i_inline;
>  			/*
>  			 * The inline data should be null-terminated, but
>  			 * don't let on-disk corruption crash the kernel
>  			 */
> -			JFS_IP(inode)->i_inline[inode->i_size] = '\0';
> +			inode->i_link[inode->i_size] = '\0';
>  		}
>  	} else {
>  		inode->i_op = &jfs_file_inode_operations;
> diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
> index 66db7bc..e33be92 100644
> --- a/fs/jfs/namei.c
> +++ b/fs/jfs/namei.c
> @@ -880,7 +880,6 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
>  	int ssize;		/* source pathname size */
>  	struct btstack btstack;
>  	struct inode *ip = d_inode(dentry);
> -	unchar *i_fastsymlink;
>  	s64 xlen = 0;
>  	int bmask = 0, xsize;
>  	s64 xaddr;
> @@ -946,8 +945,8 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
>  	if (ssize <= IDATASIZE) {
>  		ip->i_op = &jfs_fast_symlink_inode_operations;
>  
> -		i_fastsymlink = JFS_IP(ip)->i_inline;
> -		memcpy(i_fastsymlink, name, ssize);
> +		ip->i_link = JFS_IP(ip)->i_inline;
> +		memcpy(ip->i_link, name, ssize);
>  		ip->i_size = ssize - 1;
>  
>  		/*
> diff --git a/fs/jfs/symlink.c b/fs/jfs/symlink.c
> index 80f42bc..5929e23 100644
> --- a/fs/jfs/symlink.c
> +++ b/fs/jfs/symlink.c
> @@ -17,21 +17,13 @@
>   */
>  
>  #include <linux/fs.h>
> -#include <linux/namei.h>
>  #include "jfs_incore.h"
>  #include "jfs_inode.h"
>  #include "jfs_xattr.h"
>  
> -static void *jfs_follow_link(struct dentry *dentry, struct nameidata *nd)
> -{
> -	char *s = JFS_IP(d_inode(dentry))->i_inline;
> -	nd_set_link(nd, s);
> -	return NULL;
> -}
> -
>  const struct inode_operations jfs_fast_symlink_inode_operations = {
>  	.readlink	= generic_readlink,
> -	.follow_link	= jfs_follow_link,
> +	.follow_link	= simple_follow_link,
>  	.setattr	= jfs_setattr,
>  	.setxattr	= jfs_setxattr,
>  	.getxattr	= jfs_getxattr,
> 
--
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/jfs/inode.c b/fs/jfs/inode.c
index 070dc4b..6f1cb2b 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -63,11 +63,12 @@  struct inode *jfs_iget(struct super_block *sb, unsigned long ino)
 			inode->i_mapping->a_ops = &jfs_aops;
 		} else {
 			inode->i_op = &jfs_fast_symlink_inode_operations;
+			inode->i_link = JFS_IP(inode)->i_inline;
 			/*
 			 * The inline data should be null-terminated, but
 			 * don't let on-disk corruption crash the kernel
 			 */
-			JFS_IP(inode)->i_inline[inode->i_size] = '\0';
+			inode->i_link[inode->i_size] = '\0';
 		}
 	} else {
 		inode->i_op = &jfs_file_inode_operations;
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 66db7bc..e33be92 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -880,7 +880,6 @@  static int jfs_symlink(struct inode *dip, struct dentry *dentry,
 	int ssize;		/* source pathname size */
 	struct btstack btstack;
 	struct inode *ip = d_inode(dentry);
-	unchar *i_fastsymlink;
 	s64 xlen = 0;
 	int bmask = 0, xsize;
 	s64 xaddr;
@@ -946,8 +945,8 @@  static int jfs_symlink(struct inode *dip, struct dentry *dentry,
 	if (ssize <= IDATASIZE) {
 		ip->i_op = &jfs_fast_symlink_inode_operations;
 
-		i_fastsymlink = JFS_IP(ip)->i_inline;
-		memcpy(i_fastsymlink, name, ssize);
+		ip->i_link = JFS_IP(ip)->i_inline;
+		memcpy(ip->i_link, name, ssize);
 		ip->i_size = ssize - 1;
 
 		/*
diff --git a/fs/jfs/symlink.c b/fs/jfs/symlink.c
index 80f42bc..5929e23 100644
--- a/fs/jfs/symlink.c
+++ b/fs/jfs/symlink.c
@@ -17,21 +17,13 @@ 
  */
 
 #include <linux/fs.h>
-#include <linux/namei.h>
 #include "jfs_incore.h"
 #include "jfs_inode.h"
 #include "jfs_xattr.h"
 
-static void *jfs_follow_link(struct dentry *dentry, struct nameidata *nd)
-{
-	char *s = JFS_IP(d_inode(dentry))->i_inline;
-	nd_set_link(nd, s);
-	return NULL;
-}
-
 const struct inode_operations jfs_fast_symlink_inode_operations = {
 	.readlink	= generic_readlink,
-	.follow_link	= jfs_follow_link,
+	.follow_link	= simple_follow_link,
 	.setattr	= jfs_setattr,
 	.setxattr	= jfs_setxattr,
 	.getxattr	= jfs_getxattr,