linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 2/2] nilfs2: use atomic64_t type for inodes_count and blocks_count fields in nilfs_root struct
@ 2013-05-29  9:26 Vyacheslav Dubeyko
  2013-05-29 15:32 ` Ryusuke Konishi
  0 siblings, 1 reply; 3+ messages in thread
From: Vyacheslav Dubeyko @ 2013-05-29  9:26 UTC (permalink / raw)
  To: Ryusuke Konishi
  Cc: linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Jörn Engel,
	Andrew Morton, Clemens Eisserer

From: Vyacheslav Dubeyko <slava-yeENwD64cLxBDgjK7y7TUQ@public.gmane.org>
Subject: [PATCH v6 2/2] nilfs2: use atomic64_t type for inodes_count and blocks_count fields in nilfs_root struct

The cp_inodes_count and cp_blocks_count are represented as
__le64 type in on-disk structure (struct nilfs_checkpoint).
But analogous fields in in-core structure (struct nilfs_root)
are represented by atomic_t type.

This patch replaces atomic_t on atomic64_t type in representation
of inodes_count and blocks_count fields in struct nilfs_root.

Signed-off-by: Vyacheslav Dubeyko <slava-yeENwD64cLxBDgjK7y7TUQ@public.gmane.org>
CC: Ryusuke Konishi <konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
CC: Joern Engel <joern-PCqxUs/MD9bYtjvyW6yDsg@public.gmane.org>
---
 fs/nilfs2/ifile.c     |    2 +-
 fs/nilfs2/inode.c     |    8 ++++----
 fs/nilfs2/segment.c   |    4 ++--
 fs/nilfs2/super.c     |    8 +++++---
 fs/nilfs2/the_nilfs.c |    4 ++--
 fs/nilfs2/the_nilfs.h |    4 ++--
 6 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/fs/nilfs2/ifile.c b/fs/nilfs2/ifile.c
index d788a59..6548c78 100644
--- a/fs/nilfs2/ifile.c
+++ b/fs/nilfs2/ifile.c
@@ -174,7 +174,7 @@ int nilfs_ifile_count_free_inodes(struct inode *ifile,
 	*nmaxinodes = 0;
 	*nfreeinodes = 0;
 
-	nused = atomic_read(&NILFS_I(ifile)->i_root->inodes_count);
+	nused = atomic64_read(&NILFS_I(ifile)->i_root->inodes_count);
 	err = nilfs_palloc_count_max_entries(ifile, nused, nmaxinodes);
 	if (likely(!err))
 		*nfreeinodes = *nmaxinodes - nused;
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index 689fb60..3444dca 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -54,7 +54,7 @@ void nilfs_inode_add_blocks(struct inode *inode, int n)
 
 	inode_add_bytes(inode, (1 << inode->i_blkbits) * n);
 	if (root)
-		atomic_add(n, &root->blocks_count);
+		atomic64_add(n, &root->blocks_count);
 }
 
 void nilfs_inode_sub_blocks(struct inode *inode, int n)
@@ -63,7 +63,7 @@ void nilfs_inode_sub_blocks(struct inode *inode, int n)
 
 	inode_sub_bytes(inode, (1 << inode->i_blkbits) * n);
 	if (root)
-		atomic_sub(n, &root->blocks_count);
+		atomic64_sub(n, &root->blocks_count);
 }
 
 /**
@@ -350,7 +350,7 @@ struct inode *nilfs_new_inode(struct inode *dir, umode_t mode)
 		goto failed_ifile_create_inode;
 	/* reference count of i_bh inherits from nilfs_mdt_read_block() */
 
-	atomic_inc(&root->inodes_count);
+	atomic64_inc(&root->inodes_count);
 	inode_init_owner(inode, dir, mode);
 	inode->i_ino = ino;
 	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
@@ -782,7 +782,7 @@ void nilfs_evict_inode(struct inode *inode)
 
 	ret = nilfs_ifile_delete_inode(ii->i_root->ifile, inode->i_ino);
 	if (!ret)
-		atomic_dec(&ii->i_root->inodes_count);
+		atomic64_dec(&ii->i_root->inodes_count);
 
 	nilfs_clear_inode(inode);
 
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index a5752a58..bd88a74 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -835,9 +835,9 @@ static int nilfs_segctor_fill_in_checkpoint(struct nilfs_sc_info *sci)
 	raw_cp->cp_snapshot_list.ssl_next = 0;
 	raw_cp->cp_snapshot_list.ssl_prev = 0;
 	raw_cp->cp_inodes_count =
-		cpu_to_le64(atomic_read(&sci->sc_root->inodes_count));
+		cpu_to_le64(atomic64_read(&sci->sc_root->inodes_count));
 	raw_cp->cp_blocks_count =
-		cpu_to_le64(atomic_read(&sci->sc_root->blocks_count));
+		cpu_to_le64(atomic64_read(&sci->sc_root->blocks_count));
 	raw_cp->cp_nblk_inc =
 		cpu_to_le64(sci->sc_nblk_inc + sci->sc_nblk_this_inc);
 	raw_cp->cp_create = cpu_to_le64(sci->sc_seg_ctime);
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index 7d257e7..1427de5 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -554,8 +554,10 @@ int nilfs_attach_checkpoint(struct super_block *sb, __u64 cno, int curr_mnt,
 	if (err)
 		goto failed_bh;
 
-	atomic_set(&root->inodes_count, le64_to_cpu(raw_cp->cp_inodes_count));
-	atomic_set(&root->blocks_count, le64_to_cpu(raw_cp->cp_blocks_count));
+	atomic64_set(&root->inodes_count,
+			le64_to_cpu(raw_cp->cp_inodes_count));
+	atomic64_set(&root->blocks_count,
+			le64_to_cpu(raw_cp->cp_blocks_count));
 
 	nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, cno, bh_cp);
 
@@ -647,7 +649,7 @@ static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf)
 			 * curent inodes count as maximum possible and
 			 * zero as free inodes value.
 			 */
-			nmaxinodes = atomic_read(&root->inodes_count);
+			nmaxinodes = atomic64_read(&root->inodes_count);
 			nfreeinodes = 0;
 			err = 0;
 		} else
diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c
index 41e6a04..94c451c 100644
--- a/fs/nilfs2/the_nilfs.c
+++ b/fs/nilfs2/the_nilfs.c
@@ -764,8 +764,8 @@ nilfs_find_or_create_root(struct the_nilfs *nilfs, __u64 cno)
 	new->ifile = NULL;
 	new->nilfs = nilfs;
 	atomic_set(&new->count, 1);
-	atomic_set(&new->inodes_count, 0);
-	atomic_set(&new->blocks_count, 0);
+	atomic64_set(&new->inodes_count, 0);
+	atomic64_set(&new->blocks_count, 0);
 
 	rb_link_node(&new->rb_node, parent, p);
 	rb_insert_color(&new->rb_node, &nilfs->ns_cptree);
diff --git a/fs/nilfs2/the_nilfs.h b/fs/nilfs2/the_nilfs.h
index be1267a..de8cc53 100644
--- a/fs/nilfs2/the_nilfs.h
+++ b/fs/nilfs2/the_nilfs.h
@@ -241,8 +241,8 @@ struct nilfs_root {
 	struct the_nilfs *nilfs;
 	struct inode *ifile;
 
-	atomic_t inodes_count;
-	atomic_t blocks_count;
+	atomic64_t inodes_count;
+	atomic64_t blocks_count;
 };
 
 /* Special checkpoint number */
-- 
1.7.9.5



--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v6 2/2] nilfs2: use atomic64_t type for inodes_count and blocks_count fields in nilfs_root struct
  2013-05-29  9:26 [PATCH v6 2/2] nilfs2: use atomic64_t type for inodes_count and blocks_count fields in nilfs_root struct Vyacheslav Dubeyko
@ 2013-05-29 15:32 ` Ryusuke Konishi
       [not found]   ` <20130530.003256.27786650.konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Ryusuke Konishi @ 2013-05-29 15:32 UTC (permalink / raw)
  To: Vyacheslav Dubeyko
  Cc: linux-nilfs, linux-fsdevel, Jörn Engel, Andrew Morton,
	Clemens Eisserer

On Wed, 29 May 2013 13:26:30 +0400, Vyacheslav Dubeyko wrote:
> From: Vyacheslav Dubeyko <slava@dubeyko.com>
> Subject: [PATCH v6 2/2] nilfs2: use atomic64_t type for inodes_count and blocks_count fields in nilfs_root struct
> 
> The cp_inodes_count and cp_blocks_count are represented as
> __le64 type in on-disk structure (struct nilfs_checkpoint).
> But analogous fields in in-core structure (struct nilfs_root)
> are represented by atomic_t type.
> 
> This patch replaces atomic_t on atomic64_t type in representation
> of inodes_count and blocks_count fields in struct nilfs_root.
> 
> Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com>
> CC: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
> CC: Joern Engel <joern@logfs.org>

Acked-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>


Thanks,
Ryusuke Konishi

> ---
>  fs/nilfs2/ifile.c     |    2 +-
>  fs/nilfs2/inode.c     |    8 ++++----
>  fs/nilfs2/segment.c   |    4 ++--
>  fs/nilfs2/super.c     |    8 +++++---
>  fs/nilfs2/the_nilfs.c |    4 ++--
>  fs/nilfs2/the_nilfs.h |    4 ++--
>  6 files changed, 16 insertions(+), 14 deletions(-)
> 
> diff --git a/fs/nilfs2/ifile.c b/fs/nilfs2/ifile.c
> index d788a59..6548c78 100644
> --- a/fs/nilfs2/ifile.c
> +++ b/fs/nilfs2/ifile.c
> @@ -174,7 +174,7 @@ int nilfs_ifile_count_free_inodes(struct inode *ifile,
>  	*nmaxinodes = 0;
>  	*nfreeinodes = 0;
>  
> -	nused = atomic_read(&NILFS_I(ifile)->i_root->inodes_count);
> +	nused = atomic64_read(&NILFS_I(ifile)->i_root->inodes_count);
>  	err = nilfs_palloc_count_max_entries(ifile, nused, nmaxinodes);
>  	if (likely(!err))
>  		*nfreeinodes = *nmaxinodes - nused;
> diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
> index 689fb60..3444dca 100644
> --- a/fs/nilfs2/inode.c
> +++ b/fs/nilfs2/inode.c
> @@ -54,7 +54,7 @@ void nilfs_inode_add_blocks(struct inode *inode, int n)
>  
>  	inode_add_bytes(inode, (1 << inode->i_blkbits) * n);
>  	if (root)
> -		atomic_add(n, &root->blocks_count);
> +		atomic64_add(n, &root->blocks_count);
>  }
>  
>  void nilfs_inode_sub_blocks(struct inode *inode, int n)
> @@ -63,7 +63,7 @@ void nilfs_inode_sub_blocks(struct inode *inode, int n)
>  
>  	inode_sub_bytes(inode, (1 << inode->i_blkbits) * n);
>  	if (root)
> -		atomic_sub(n, &root->blocks_count);
> +		atomic64_sub(n, &root->blocks_count);
>  }
>  
>  /**
> @@ -350,7 +350,7 @@ struct inode *nilfs_new_inode(struct inode *dir, umode_t mode)
>  		goto failed_ifile_create_inode;
>  	/* reference count of i_bh inherits from nilfs_mdt_read_block() */
>  
> -	atomic_inc(&root->inodes_count);
> +	atomic64_inc(&root->inodes_count);
>  	inode_init_owner(inode, dir, mode);
>  	inode->i_ino = ino;
>  	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
> @@ -782,7 +782,7 @@ void nilfs_evict_inode(struct inode *inode)
>  
>  	ret = nilfs_ifile_delete_inode(ii->i_root->ifile, inode->i_ino);
>  	if (!ret)
> -		atomic_dec(&ii->i_root->inodes_count);
> +		atomic64_dec(&ii->i_root->inodes_count);
>  
>  	nilfs_clear_inode(inode);
>  
> diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
> index a5752a58..bd88a74 100644
> --- a/fs/nilfs2/segment.c
> +++ b/fs/nilfs2/segment.c
> @@ -835,9 +835,9 @@ static int nilfs_segctor_fill_in_checkpoint(struct nilfs_sc_info *sci)
>  	raw_cp->cp_snapshot_list.ssl_next = 0;
>  	raw_cp->cp_snapshot_list.ssl_prev = 0;
>  	raw_cp->cp_inodes_count =
> -		cpu_to_le64(atomic_read(&sci->sc_root->inodes_count));
> +		cpu_to_le64(atomic64_read(&sci->sc_root->inodes_count));
>  	raw_cp->cp_blocks_count =
> -		cpu_to_le64(atomic_read(&sci->sc_root->blocks_count));
> +		cpu_to_le64(atomic64_read(&sci->sc_root->blocks_count));
>  	raw_cp->cp_nblk_inc =
>  		cpu_to_le64(sci->sc_nblk_inc + sci->sc_nblk_this_inc);
>  	raw_cp->cp_create = cpu_to_le64(sci->sc_seg_ctime);
> diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
> index 7d257e7..1427de5 100644
> --- a/fs/nilfs2/super.c
> +++ b/fs/nilfs2/super.c
> @@ -554,8 +554,10 @@ int nilfs_attach_checkpoint(struct super_block *sb, __u64 cno, int curr_mnt,
>  	if (err)
>  		goto failed_bh;
>  
> -	atomic_set(&root->inodes_count, le64_to_cpu(raw_cp->cp_inodes_count));
> -	atomic_set(&root->blocks_count, le64_to_cpu(raw_cp->cp_blocks_count));
> +	atomic64_set(&root->inodes_count,
> +			le64_to_cpu(raw_cp->cp_inodes_count));
> +	atomic64_set(&root->blocks_count,
> +			le64_to_cpu(raw_cp->cp_blocks_count));
>  
>  	nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, cno, bh_cp);
>  
> @@ -647,7 +649,7 @@ static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf)
>  			 * curent inodes count as maximum possible and
>  			 * zero as free inodes value.
>  			 */
> -			nmaxinodes = atomic_read(&root->inodes_count);
> +			nmaxinodes = atomic64_read(&root->inodes_count);
>  			nfreeinodes = 0;
>  			err = 0;
>  		} else
> diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c
> index 41e6a04..94c451c 100644
> --- a/fs/nilfs2/the_nilfs.c
> +++ b/fs/nilfs2/the_nilfs.c
> @@ -764,8 +764,8 @@ nilfs_find_or_create_root(struct the_nilfs *nilfs, __u64 cno)
>  	new->ifile = NULL;
>  	new->nilfs = nilfs;
>  	atomic_set(&new->count, 1);
> -	atomic_set(&new->inodes_count, 0);
> -	atomic_set(&new->blocks_count, 0);
> +	atomic64_set(&new->inodes_count, 0);
> +	atomic64_set(&new->blocks_count, 0);
>  
>  	rb_link_node(&new->rb_node, parent, p);
>  	rb_insert_color(&new->rb_node, &nilfs->ns_cptree);
> diff --git a/fs/nilfs2/the_nilfs.h b/fs/nilfs2/the_nilfs.h
> index be1267a..de8cc53 100644
> --- a/fs/nilfs2/the_nilfs.h
> +++ b/fs/nilfs2/the_nilfs.h
> @@ -241,8 +241,8 @@ struct nilfs_root {
>  	struct the_nilfs *nilfs;
>  	struct inode *ifile;
>  
> -	atomic_t inodes_count;
> -	atomic_t blocks_count;
> +	atomic64_t inodes_count;
> +	atomic64_t blocks_count;
>  };
>  
>  /* Special checkpoint number */
> -- 
> 1.7.9.5
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v6 2/2] nilfs2: use atomic64_t type for inodes_count and blocks_count fields in nilfs_root struct
       [not found]   ` <20130530.003256.27786650.konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
@ 2013-05-29 19:16     ` Jörn Engel
  0 siblings, 0 replies; 3+ messages in thread
From: Jörn Engel @ 2013-05-29 19:16 UTC (permalink / raw)
  To: Ryusuke Konishi
  Cc: Vyacheslav Dubeyko, linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Andrew Morton,
	Clemens Eisserer

On Thu, 30 May 2013 00:32:56 +0900, Ryusuke Konishi wrote:
> On Wed, 29 May 2013 13:26:30 +0400, Vyacheslav Dubeyko wrote:
> > From: Vyacheslav Dubeyko <slava-yeENwD64cLxBDgjK7y7TUQ@public.gmane.org>
> > Subject: [PATCH v6 2/2] nilfs2: use atomic64_t type for inodes_count and blocks_count fields in nilfs_root struct
> > 
> > The cp_inodes_count and cp_blocks_count are represented as
> > __le64 type in on-disk structure (struct nilfs_checkpoint).
> > But analogous fields in in-core structure (struct nilfs_root)
> > are represented by atomic_t type.
> > 
> > This patch replaces atomic_t on atomic64_t type in representation
> > of inodes_count and blocks_count fields in struct nilfs_root.
> > 
> > Signed-off-by: Vyacheslav Dubeyko <slava-yeENwD64cLxBDgjK7y7TUQ@public.gmane.org>
> > CC: Ryusuke Konishi <konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
> > CC: Joern Engel <joern-PCqxUs/MD9bYtjvyW6yDsg@public.gmane.org>
> 
> Acked-by: Ryusuke Konishi <konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>

Not sure how much this is actually worth, but

Acked-by: Joern Engel <joern-PCqxUs/MD9bYtjvyW6yDsg@public.gmane.org>

Jörn

--
Linux is more the core point of a concept that surrounds "open source"
which, in turn, is based on a false concept. This concept is that
people actually want to look at source code.
-- Rob Enderle
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-29 19:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-29  9:26 [PATCH v6 2/2] nilfs2: use atomic64_t type for inodes_count and blocks_count fields in nilfs_root struct Vyacheslav Dubeyko
2013-05-29 15:32 ` Ryusuke Konishi
     [not found]   ` <20130530.003256.27786650.konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
2013-05-29 19:16     ` Jörn Engel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).