diff mbox

[v2] ceph: change variable name to follow common rule

Message ID 1519818227-36768-1-git-send-email-cgxu519@icloud.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chengguang Xu Feb. 28, 2018, 11:43 a.m. UTC
Variable name ci is mostly used for ceph_inode_info.
Variable name fi is mostly used for ceph_file_info.
Variable name cf is mostly used for ceph_cap_flush.

Change variable name to follow above common rules
in case of confusing.

Signed-off-by: Chengguang Xu <cgxu519@icloud.com>
---
 fs/ceph/addr.c |  4 ++--
 fs/ceph/dir.c  | 18 +++++++++---------
 fs/ceph/file.c | 38 +++++++++++++++++++-------------------
 3 files changed, 30 insertions(+), 30 deletions(-)

Comments

Yan, Zheng March 5, 2018, 2:57 a.m. UTC | #1
> On 28 Feb 2018, at 19:43, Chengguang Xu <cgxu519@icloud.com> wrote:
> 
> Variable name ci is mostly used for ceph_inode_info.
> Variable name fi is mostly used for ceph_file_info.
> Variable name cf is mostly used for ceph_cap_flush.
> 
> Change variable name to follow above common rules
> in case of confusing.
> 
> Signed-off-by: Chengguang Xu <cgxu519@icloud.com>
> ---
> fs/ceph/addr.c |  4 ++--
> fs/ceph/dir.c  | 18 +++++++++---------
> fs/ceph/file.c | 38 +++++++++++++++++++-------------------
> 3 files changed, 30 insertions(+), 30 deletions(-)
> 
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index b4336b4..e554285 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -438,7 +438,7 @@ static int ceph_readpages(struct file *file, struct address_space *mapping,
> {
> 	struct inode *inode = file_inode(file);
> 	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
> -	struct ceph_file_info *ci = file->private_data;
> +	struct ceph_file_info *fi = file->private_data;
> 	struct ceph_rw_context *rw_ctx;
> 	int rc = 0;
> 	int max = 0;
> @@ -452,7 +452,7 @@ static int ceph_readpages(struct file *file, struct address_space *mapping,
> 	if (rc == 0)
> 		goto out;
> 
> -	rw_ctx = ceph_find_rw_context(ci);
> +	rw_ctx = ceph_find_rw_context(fi);
> 	max = fsc->mount_options->rsize >> PAGE_SHIFT;
> 	dout("readpages %p file %p ctx %p nr_pages %d max %d\n",
> 	     inode, file, rw_ctx, nr_pages, max);
> diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
> index 0c43468..8e5d9d4 100644
> --- a/fs/ceph/dir.c
> +++ b/fs/ceph/dir.c
> @@ -1370,7 +1370,7 @@ static void ceph_d_prune(struct dentry *dentry)
> static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
> 			     loff_t *ppos)
> {
> -	struct ceph_file_info *cf = file->private_data;
> +	struct ceph_file_info *fi = file->private_data;
> 	struct inode *inode = file_inode(file);
> 	struct ceph_inode_info *ci = ceph_inode(inode);
> 	int left;
> @@ -1379,12 +1379,12 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
> 	if (!ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb), DIRSTAT))
> 		return -EISDIR;
> 
> -	if (!cf->dir_info) {
> -		cf->dir_info = kmalloc(bufsize, GFP_KERNEL);
> -		if (!cf->dir_info)
> +	if (!fi->dir_info) {
> +		fi->dir_info = kmalloc(bufsize, GFP_KERNEL);
> +		if (!fi->dir_info)
> 			return -ENOMEM;
> -		cf->dir_info_len =
> -			snprintf(cf->dir_info, bufsize,
> +		fi->dir_info_len =
> +			snprintf(fi->dir_info, bufsize,
> 				"entries:   %20lld\n"
> 				" files:    %20lld\n"
> 				" subdirs:  %20lld\n"
> @@ -1404,10 +1404,10 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
> 				(long)ci->i_rctime.tv_nsec);
> 	}
> 
> -	if (*ppos >= cf->dir_info_len)
> +	if (*ppos >= fi->dir_info_len)
> 		return 0;
> -	size = min_t(unsigned, size, cf->dir_info_len-*ppos);
> -	left = copy_to_user(buf, cf->dir_info + *ppos, size);
> +	size = min_t(unsigned, size, fi->dir_info_len-*ppos);
> +	left = copy_to_user(buf, fi->dir_info + *ppos, size);
> 	if (left == size)
> 		return -EFAULT;
> 	*ppos += (size - left);
> diff --git a/fs/ceph/file.c b/fs/ceph/file.c
> index 6639926..9aa50b0 100644
> --- a/fs/ceph/file.c
> +++ b/fs/ceph/file.c
> @@ -165,7 +165,7 @@ static size_t dio_get_pagev_size(const struct iov_iter *it)
>  */
> static int ceph_init_file(struct inode *inode, struct file *file, int fmode)
> {
> -	struct ceph_file_info *cf;
> +	struct ceph_file_info *fi;
> 	int ret = 0;
> 
> 	switch (inode->i_mode & S_IFMT) {
> @@ -175,19 +175,19 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode)
> 	case S_IFDIR:
> 		dout("init_file %p %p 0%o (regular)\n", inode, file,
> 		     inode->i_mode);
> -		cf = kmem_cache_zalloc(ceph_file_cachep, GFP_KERNEL);
> -		if (!cf) {
> +		fi = kmem_cache_zalloc(ceph_file_cachep, GFP_KERNEL);
> +		if (!fi) {
> 			ceph_put_fmode(ceph_inode(inode), fmode); /* clean up */
> 			return -ENOMEM;
> 		}
> -		cf->fmode = fmode;
> +		fi->fmode = fmode;
> 
> -		spin_lock_init(&cf->rw_contexts_lock);
> -		INIT_LIST_HEAD(&cf->rw_contexts);
> +		spin_lock_init(&fi->rw_contexts_lock);
> +		INIT_LIST_HEAD(&fi->rw_contexts);
> 
> -		cf->next_offset = 2;
> -		cf->readdir_cache_idx = -1;
> -		file->private_data = cf;
> +		fi->next_offset = 2;
> +		fi->readdir_cache_idx = -1;
> +		file->private_data = fi;
> 		BUG_ON(inode->i_fop->release != ceph_release);
> 		break;
> 
> @@ -278,11 +278,11 @@ int ceph_open(struct inode *inode, struct file *file)
> 	struct ceph_fs_client *fsc = ceph_sb_to_client(inode->i_sb);
> 	struct ceph_mds_client *mdsc = fsc->mdsc;
> 	struct ceph_mds_request *req;
> -	struct ceph_file_info *cf = file->private_data;
> +	struct ceph_file_info *fi = file->private_data;
> 	int err;
> 	int flags, fmode, wanted;
> 
> -	if (cf) {
> +	if (fi) {
> 		dout("open file %p is already opened\n", file);
> 		return 0;
> 	}
> @@ -460,16 +460,16 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
> int ceph_release(struct inode *inode, struct file *file)
> {
> 	struct ceph_inode_info *ci = ceph_inode(inode);
> -	struct ceph_file_info *cf = file->private_data;
> +	struct ceph_file_info *fi = file->private_data;
> 
> 	dout("release inode %p file %p\n", inode, file);
> -	ceph_put_fmode(ci, cf->fmode);
> -	if (cf->last_readdir)
> -		ceph_mdsc_put_request(cf->last_readdir);
> -	kfree(cf->last_name);
> -	kfree(cf->dir_info);
> -	WARN_ON(!list_empty(&cf->rw_contexts));
> -	kmem_cache_free(ceph_file_cachep, cf);
> +	ceph_put_fmode(ci, fi->fmode);
> +	if (fi->last_readdir)
> +		ceph_mdsc_put_request(fi->last_readdir);
> +	kfree(fi->last_name);
> +	kfree(fi->dir_info);
> +	WARN_ON(!list_empty(&fi->rw_contexts));
> +	kmem_cache_free(ceph_file_cachep, fi);
> 
> 	/* wake up anyone waiting for caps on this inode */
> 	wake_up_all(&ci->i_cap_wq);
> -- 
> 1.8.3.1
> 

Applied. Thanks

Yan, Zheng

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" 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/ceph/addr.c b/fs/ceph/addr.c
index b4336b4..e554285 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -438,7 +438,7 @@  static int ceph_readpages(struct file *file, struct address_space *mapping,
 {
 	struct inode *inode = file_inode(file);
 	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
-	struct ceph_file_info *ci = file->private_data;
+	struct ceph_file_info *fi = file->private_data;
 	struct ceph_rw_context *rw_ctx;
 	int rc = 0;
 	int max = 0;
@@ -452,7 +452,7 @@  static int ceph_readpages(struct file *file, struct address_space *mapping,
 	if (rc == 0)
 		goto out;
 
-	rw_ctx = ceph_find_rw_context(ci);
+	rw_ctx = ceph_find_rw_context(fi);
 	max = fsc->mount_options->rsize >> PAGE_SHIFT;
 	dout("readpages %p file %p ctx %p nr_pages %d max %d\n",
 	     inode, file, rw_ctx, nr_pages, max);
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 0c43468..8e5d9d4 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -1370,7 +1370,7 @@  static void ceph_d_prune(struct dentry *dentry)
 static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
 			     loff_t *ppos)
 {
-	struct ceph_file_info *cf = file->private_data;
+	struct ceph_file_info *fi = file->private_data;
 	struct inode *inode = file_inode(file);
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	int left;
@@ -1379,12 +1379,12 @@  static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
 	if (!ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb), DIRSTAT))
 		return -EISDIR;
 
-	if (!cf->dir_info) {
-		cf->dir_info = kmalloc(bufsize, GFP_KERNEL);
-		if (!cf->dir_info)
+	if (!fi->dir_info) {
+		fi->dir_info = kmalloc(bufsize, GFP_KERNEL);
+		if (!fi->dir_info)
 			return -ENOMEM;
-		cf->dir_info_len =
-			snprintf(cf->dir_info, bufsize,
+		fi->dir_info_len =
+			snprintf(fi->dir_info, bufsize,
 				"entries:   %20lld\n"
 				" files:    %20lld\n"
 				" subdirs:  %20lld\n"
@@ -1404,10 +1404,10 @@  static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
 				(long)ci->i_rctime.tv_nsec);
 	}
 
-	if (*ppos >= cf->dir_info_len)
+	if (*ppos >= fi->dir_info_len)
 		return 0;
-	size = min_t(unsigned, size, cf->dir_info_len-*ppos);
-	left = copy_to_user(buf, cf->dir_info + *ppos, size);
+	size = min_t(unsigned, size, fi->dir_info_len-*ppos);
+	left = copy_to_user(buf, fi->dir_info + *ppos, size);
 	if (left == size)
 		return -EFAULT;
 	*ppos += (size - left);
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 6639926..9aa50b0 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -165,7 +165,7 @@  static size_t dio_get_pagev_size(const struct iov_iter *it)
  */
 static int ceph_init_file(struct inode *inode, struct file *file, int fmode)
 {
-	struct ceph_file_info *cf;
+	struct ceph_file_info *fi;
 	int ret = 0;
 
 	switch (inode->i_mode & S_IFMT) {
@@ -175,19 +175,19 @@  static int ceph_init_file(struct inode *inode, struct file *file, int fmode)
 	case S_IFDIR:
 		dout("init_file %p %p 0%o (regular)\n", inode, file,
 		     inode->i_mode);
-		cf = kmem_cache_zalloc(ceph_file_cachep, GFP_KERNEL);
-		if (!cf) {
+		fi = kmem_cache_zalloc(ceph_file_cachep, GFP_KERNEL);
+		if (!fi) {
 			ceph_put_fmode(ceph_inode(inode), fmode); /* clean up */
 			return -ENOMEM;
 		}
-		cf->fmode = fmode;
+		fi->fmode = fmode;
 
-		spin_lock_init(&cf->rw_contexts_lock);
-		INIT_LIST_HEAD(&cf->rw_contexts);
+		spin_lock_init(&fi->rw_contexts_lock);
+		INIT_LIST_HEAD(&fi->rw_contexts);
 
-		cf->next_offset = 2;
-		cf->readdir_cache_idx = -1;
-		file->private_data = cf;
+		fi->next_offset = 2;
+		fi->readdir_cache_idx = -1;
+		file->private_data = fi;
 		BUG_ON(inode->i_fop->release != ceph_release);
 		break;
 
@@ -278,11 +278,11 @@  int ceph_open(struct inode *inode, struct file *file)
 	struct ceph_fs_client *fsc = ceph_sb_to_client(inode->i_sb);
 	struct ceph_mds_client *mdsc = fsc->mdsc;
 	struct ceph_mds_request *req;
-	struct ceph_file_info *cf = file->private_data;
+	struct ceph_file_info *fi = file->private_data;
 	int err;
 	int flags, fmode, wanted;
 
-	if (cf) {
+	if (fi) {
 		dout("open file %p is already opened\n", file);
 		return 0;
 	}
@@ -460,16 +460,16 @@  int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
 int ceph_release(struct inode *inode, struct file *file)
 {
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_file_info *cf = file->private_data;
+	struct ceph_file_info *fi = file->private_data;
 
 	dout("release inode %p file %p\n", inode, file);
-	ceph_put_fmode(ci, cf->fmode);
-	if (cf->last_readdir)
-		ceph_mdsc_put_request(cf->last_readdir);
-	kfree(cf->last_name);
-	kfree(cf->dir_info);
-	WARN_ON(!list_empty(&cf->rw_contexts));
-	kmem_cache_free(ceph_file_cachep, cf);
+	ceph_put_fmode(ci, fi->fmode);
+	if (fi->last_readdir)
+		ceph_mdsc_put_request(fi->last_readdir);
+	kfree(fi->last_name);
+	kfree(fi->dir_info);
+	WARN_ON(!list_empty(&fi->rw_contexts));
+	kmem_cache_free(ceph_file_cachep, fi);
 
 	/* wake up anyone waiting for caps on this inode */
 	wake_up_all(&ci->i_cap_wq);