Skip to contentSkip to conversation

nilfs2: tune write performance

PATCH In review Jiro SEKIBA 2 participants 4 messages Aug 5, 2009 – Aug 9, 2009 2 messages not in the archive NILFS2 filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nilfs2: tune write performance

Hi,

This is a candidate patch to improve write performance.

When GC is runnning, GC moves live block to difference segments. Moving live blocks to different segment is done in a transaction, but it is not necessarily to be in the transaction. This patch will get the nilfs_ioctl_move_blocks() out from transaction lock and put it before the transaction.

Here are the bonnie++ bench mark results against rc5.
I used sata disk so performace difference is not big.
So I modified nilfs_cleanerd.conf to ensure lock will be long enough.

I ran "bonnie++ -b" three times in each environment. Create clean nilfs2 partition each time before test run.

Results
- write performance of rc5
* Char|17472.333 K/sec
* Block|30748.000 K/sec
* Rewrite|18506.000 K/sec

- write performance of the patched rc5
* Char|17961.000 K/sec -> 102.700%
* Block|30987.666 K/sec -> 100.700%
* Rewrite|18775.666 K/sec -> 101.400%

Here are the nilfs_cleanerd.conf and raw data. -------8<---------8<---------nilfs_cleanerd.conf---------8<---------8<-------
protection_period 150
selection_policy timestamp # timestamp in ascend order
nsegments_per_clean 10
cleaning_interval 5
retry_interval 60
use_mmap
log_priority info
-------8<---------8<---------nilfs_cleanerd.conf---------8<---------8<------- ---------8<---------8<---------rc5---------8<---------8<---------
Version 1.03d ------Sequential Output------ --Sequential Input- --Random-

                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
foras           10G 17404  22 30751   5 18519   3 33855  38 45560   4  47.3   0
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16   103   1 +++++ +++   255   0   251   4 +++++ +++   223   1
foras,10G,17404,22,30751,5,18519,3,33855,38,45560,4,47.3,0,16,103,1,+++++,+++,255,0,251,4,+++++,+++,223,1
Version 1.03d       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
foras           10G 17561  22 30781   5 18412   3 33973  38 46063   3  46.6   0
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16   102   1 +++++ +++   237   0   244   3 +++++ +++   222   1
foras,10G,17561,22,30781,5,18412,3,33973,38,46063,3,46.6,0,16,102,1,+++++,+++,237,0,244,3,+++++,+++,222,1
Version 1.03d       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
foras           10G 17452  22 30712   5 18587   3 34071  38 45479   4  50.6   0
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16   102   1 +++++ +++   238   0   252   4 +++++ +++   222   1

foras,10G,17452,22,30712,5,18587,3,34071,38,45479,4,50.6,0,16,102,1,+++++,+++,238,0,252,4,+++++,+++,222,1 ---------8<---------8<---------rc5---------8<---------8<--------- ---------8<---------8<---------patch---------8<---------8<---------
Version 1.03d ------Sequential Output------ --Sequential Input- --Random-

                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
foras           10G 18004  22 31375   5 19110   3 33755  38 45224   4  97.1   0
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16    99   1 +++++ +++   223   0   231   3 +++++ +++   209   1
foras,10G,18004,22,31375,5,19110,3,33755,38,45224,4,97.1,0,16,99,1,+++++,+++,223,0,231,3,+++++,+++,209,1
Version 1.03d       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
foras           10G 17866  22 30673   5 18619   3 33923  38 45878   4  55.3   0
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16    97   1 +++++ +++   211   0   224   3 +++++ +++   203   1
foras,10G,17866,22,30673,5,18619,3,33923,38,45878,4,55.3,0,16,97,1,+++++,+++,211,0,224,3,+++++,+++,203,1
Version 1.03d       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
foras           10G 18013  22 30915   5 18598   3 33879  38 44957   4  47.5   0
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16    99   1 +++++ +++   255   0   253   4 +++++ +++   226   1

foras,10G,18013,22,30915,5,18598,3,33879,38,44957,4,47.5,0,16,99,1,+++++,+++,255,0,253,4,+++++,+++,226,1 ---------8<---------8<---------patch---------8<---------8<---------

 fs/nilfs2/ioctl.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
 fs/nilfs2/ioctl.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
fs/nilfs2/ioctl.c +6 -6
index 6ea5f87..83a885c 100644
@@ -442,12 +442,6 @@ int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *nilfs,
 	const char *msg;
 	int ret;
 
-	ret = nilfs_ioctl_move_blocks(nilfs, &argv[0], kbufs[0]);
-	if (ret < 0) {
-		msg = "cannot read source blocks";
-		goto failed;
-	}
-
 	ret = nilfs_ioctl_delete_checkpoints(nilfs, &argv[1], kbufs[1]);
 	if (ret < 0) {
 		/*
@@ -548,6 +542,12 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp,
 		}
 	}
 
+	ret = nilfs_ioctl_move_blocks(nilfs, &argv[0], kbufs[0]);
+	if (ret < 0) {
+		printk(KERN_ERR "NILFS: GC failed during preparation: cannot read source blocks: err=%d\n", ret);
+		goto out_free;
+	}
+
 	ret = nilfs_clean_segments(inode->i_sb, argv, kbufs);
 
  out_free:
Signature · 1 line
1.5.6.5

A message that is not in the archive (sent off-list or not yet received): 1249483023-21088-1-git-send-email-jir-hfpbi5WX9J54Eiagz67IpQ@public.gmane.org

#2 lore raw

Hi!

Quoted 23 lines · Jiro SEKIBA

Hi,

This is a candidate patch to improve write performance.

When GC is runnning, GC moves live block to difference segments. Moving live blocks to different segment is done in a transaction, but it is not necessarily to be in the transaction. This patch will get the nilfs_ioctl_move_blocks() out from transaction lock and put it before the transaction.

Here are the bonnie++ bench mark results against rc5.
I used sata disk so performace difference is not big.
So I modified nilfs_cleanerd.conf to ensure lock will be long enough.

I ran "bonnie++ -b" three times in each environment. Create clean nilfs2 partition each time before test run.

Results
- write performance of rc5
* Char|17472.333 K/sec
* Block|30748.000 K/sec
* Rewrite|18506.000 K/sec

Quoted 4 lines

- write performance of the patched rc5
* Char|17961.000 K/sec -> 102.700%
* Block|30987.666 K/sec -> 100.700%
* Rewrite|18775.666 K/sec -> 101.400%

Thank you for the patch.

I think this patch can mitigate freeze-time of writes due to GC, but this benchmark seems not to be suited for measuring the effect. Particularly, GC fires only once per five seconds with the following config, and this may limit the efficacy in this kind of integrative test.

Is it possible to compare single write time hit GC with the time not hit GC ?

I will check correctness of the patch.

Thanks,
Ryusuke Konishi

Quoted 109 lines

Here are the nilfs_cleanerd.conf and raw data. -------8<---------8<---------nilfs_cleanerd.conf---------8<---------8<-------
protection_period 150
selection_policy timestamp # timestamp in ascend order
nsegments_per_clean 10
cleaning_interval 5
retry_interval 60
use_mmap
log_priority info
-------8<---------8<---------nilfs_cleanerd.conf---------8<---------8<------- ---------8<---------8<---------rc5---------8<---------8<---------
Version 1.03d ------Sequential Output------ --Sequential Input- --Random-

                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
foras           10G 17404  22 30751   5 18519   3 33855  38 45560   4  47.3   0
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16   103   1 +++++ +++   255   0   251   4 +++++ +++   223   1
foras,10G,17404,22,30751,5,18519,3,33855,38,45560,4,47.3,0,16,103,1,+++++,+++,255,0,251,4,+++++,+++,223,1
Version 1.03d       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
foras           10G 17561  22 30781   5 18412   3 33973  38 46063   3  46.6   0
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16   102   1 +++++ +++   237   0   244   3 +++++ +++   222   1
foras,10G,17561,22,30781,5,18412,3,33973,38,46063,3,46.6,0,16,102,1,+++++,+++,237,0,244,3,+++++,+++,222,1
Version 1.03d       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
foras           10G 17452  22 30712   5 18587   3 34071  38 45479   4  50.6   0
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16   102   1 +++++ +++   238   0   252   4 +++++ +++   222   1

foras,10G,17452,22,30712,5,18587,3,34071,38,45479,4,50.6,0,16,102,1,+++++,+++,238,0,252,4,+++++,+++,222,1 ---------8<---------8<---------rc5---------8<---------8<--------- ---------8<---------8<---------patch---------8<---------8<---------
Version 1.03d ------Sequential Output------ --Sequential Input- --Random-

                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
foras           10G 18004  22 31375   5 19110   3 33755  38 45224   4  97.1   0
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16    99   1 +++++ +++   223   0   231   3 +++++ +++   209   1
foras,10G,18004,22,31375,5,19110,3,33755,38,45224,4,97.1,0,16,99,1,+++++,+++,223,0,231,3,+++++,+++,209,1
Version 1.03d       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
foras           10G 17866  22 30673   5 18619   3 33923  38 45878   4  55.3   0
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16    97   1 +++++ +++   211   0   224   3 +++++ +++   203   1
foras,10G,17866,22,30673,5,18619,3,33923,38,45878,4,55.3,0,16,97,1,+++++,+++,211,0,224,3,+++++,+++,203,1
Version 1.03d       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
foras           10G 18013  22 30915   5 18598   3 33879  38 44957   4  47.5   0
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16    99   1 +++++ +++   255   0   253   4 +++++ +++   226   1

foras,10G,18013,22,30915,5,18598,3,33879,38,44957,4,47.5,0,16,99,1,+++++,+++,255,0,253,4,+++++,+++,226,1 ---------8<---------8<---------patch---------8<---------8<---------

 fs/nilfs2/ioctl.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
 fs/nilfs2/ioctl.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
fs/nilfs2/ioctl.c +6 -6
index 6ea5f87..83a885c 100644
@@ -442,12 +442,6 @@ int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *nilfs,
 	const char *msg;
 	int ret;
 
-	ret = nilfs_ioctl_move_blocks(nilfs, &argv[0], kbufs[0]);
-	if (ret < 0) {
-		msg = "cannot read source blocks";
-		goto failed;
-	}
-
 	ret = nilfs_ioctl_delete_checkpoints(nilfs, &argv[1], kbufs[1]);
 	if (ret < 0) {
 		/*
@@ -548,6 +542,12 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp,
 		}
 	}
 
+	ret = nilfs_ioctl_move_blocks(nilfs, &argv[0], kbufs[0]);
+	if (ret < 0) {
+		printk(KERN_ERR "NILFS: GC failed during preparation: cannot read source blocks: err=%d\n", ret);
+		goto out_free;
+	}
+
 	ret = nilfs_clean_segments(inode->i_sb, argv, kbufs);
 
  out_free:
Signature · 1 line
1.5.6.5

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Hi,

Thank you for the comments!
I'll update the patch and re-do the performance benchmark.

At Thu, 06 Aug 2009 03:54:05 +0900 (JST),

Quoted 163 lines · Ryusuke Konishi

Hi!

Quoted 23 lines · Jiro SEKIBA

Hi,

This is a candidate patch to improve write performance.

When GC is runnning, GC moves live block to difference segments. Moving live blocks to different segment is done in a transaction, but it is not necessarily to be in the transaction. This patch will get the nilfs_ioctl_move_blocks() out from transaction lock and put it before the transaction.

Here are the bonnie++ bench mark results against rc5.
I used sata disk so performace difference is not big.
So I modified nilfs_cleanerd.conf to ensure lock will be long enough.

I ran "bonnie++ -b" three times in each environment. Create clean nilfs2 partition each time before test run.

Results
- write performance of rc5
* Char|17472.333 K/sec
* Block|30748.000 K/sec
* Rewrite|18506.000 K/sec

Quoted 4 lines

- write performance of the patched rc5
* Char|17961.000 K/sec -> 102.700%
* Block|30987.666 K/sec -> 100.700%
* Rewrite|18775.666 K/sec -> 101.400%

Thank you for the patch.

I think this patch can mitigate freeze-time of writes due to GC, but this benchmark seems not to be suited for measuring the effect. Particularly, GC fires only once per five seconds with the following config, and this may limit the efficacy in this kind of integrative test.

Is it possible to compare single write time hit GC with the time not hit GC ?

I will check correctness of the patch.

Thanks,
Ryusuke Konishi

Quoted 109 lines

Here are the nilfs_cleanerd.conf and raw data. -------8<---------8<---------nilfs_cleanerd.conf---------8<---------8<-------
protection_period 150
selection_policy timestamp # timestamp in ascend order
nsegments_per_clean 10
cleaning_interval 5
retry_interval 60
use_mmap
log_priority info
-------8<---------8<---------nilfs_cleanerd.conf---------8<---------8<------- ---------8<---------8<---------rc5---------8<---------8<---------
Version 1.03d ------Sequential Output------ --Sequential Input- --Random-

                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
foras           10G 17404  22 30751   5 18519   3 33855  38 45560   4  47.3   0
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16   103   1 +++++ +++   255   0   251   4 +++++ +++   223   1
foras,10G,17404,22,30751,5,18519,3,33855,38,45560,4,47.3,0,16,103,1,+++++,+++,255,0,251,4,+++++,+++,223,1
Version 1.03d       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
foras           10G 17561  22 30781   5 18412   3 33973  38 46063   3  46.6   0
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16   102   1 +++++ +++   237   0   244   3 +++++ +++   222   1
foras,10G,17561,22,30781,5,18412,3,33973,38,46063,3,46.6,0,16,102,1,+++++,+++,237,0,244,3,+++++,+++,222,1
Version 1.03d       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
foras           10G 17452  22 30712   5 18587   3 34071  38 45479   4  50.6   0
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16   102   1 +++++ +++   238   0   252   4 +++++ +++   222   1

foras,10G,17452,22,30712,5,18587,3,34071,38,45479,4,50.6,0,16,102,1,+++++,+++,238,0,252,4,+++++,+++,222,1 ---------8<---------8<---------rc5---------8<---------8<--------- ---------8<---------8<---------patch---------8<---------8<---------
Version 1.03d ------Sequential Output------ --Sequential Input- --Random-

                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
foras           10G 18004  22 31375   5 19110   3 33755  38 45224   4  97.1   0
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16    99   1 +++++ +++   223   0   231   3 +++++ +++   209   1
foras,10G,18004,22,31375,5,19110,3,33755,38,45224,4,97.1,0,16,99,1,+++++,+++,223,0,231,3,+++++,+++,209,1
Version 1.03d       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
foras           10G 17866  22 30673   5 18619   3 33923  38 45878   4  55.3   0
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16    97   1 +++++ +++   211   0   224   3 +++++ +++   203   1
foras,10G,17866,22,30673,5,18619,3,33923,38,45878,4,55.3,0,16,97,1,+++++,+++,211,0,224,3,+++++,+++,203,1
Version 1.03d       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
foras           10G 18013  22 30915   5 18598   3 33879  38 44957   4  47.5   0
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16    99   1 +++++ +++   255   0   253   4 +++++ +++   226   1

foras,10G,18013,22,30915,5,18598,3,33879,38,44957,4,47.5,0,16,99,1,+++++,+++,255,0,253,4,+++++,+++,226,1 ---------8<---------8<---------patch---------8<---------8<---------

 fs/nilfs2/ioctl.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
 fs/nilfs2/ioctl.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
fs/nilfs2/ioctl.c +6 -6
index 6ea5f87..83a885c 100644
@@ -442,12 +442,6 @@ int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *nilfs,
 	const char *msg;
 	int ret;
 
-	ret = nilfs_ioctl_move_blocks(nilfs, &argv[0], kbufs[0]);
-	if (ret < 0) {
-		msg = "cannot read source blocks";
-		goto failed;
-	}
-
 	ret = nilfs_ioctl_delete_checkpoints(nilfs, &argv[1], kbufs[1]);
 	if (ret < 0) {
 		/*
@@ -548,6 +542,12 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp,
 		}
 	}
 
+	ret = nilfs_ioctl_move_blocks(nilfs, &argv[0], kbufs[0]);
+	if (ret < 0) {
+		printk(KERN_ERR "NILFS: GC failed during preparation: cannot read source blocks: err=%d\n", ret);
+		goto out_free;
+	}
+
 	ret = nilfs_clean_segments(inode->i_sb, argv, kbufs);
 
  out_free:
Signature · 1 line
1.5.6.5

_______________________________________________
users mailing list
[email protected]
https://www.nilfs.org/mailman/listinfo/users

Signature · 1 line
Jiro SEKIBA <[email protected]>
#5 lore raw
In reply to a message not in the archive
Quoted 9 lines · Jiro SEKIBA

Hi,

This is a candidate patch to improve write performance.

When GC is runnning, GC moves live block to difference segments. Moving live blocks to different segment is done in a transaction, but it is not necessarily to be in the transaction. This patch will get the nilfs_ioctl_move_blocks() out from transaction lock and put it before the transaction.

Ah, this description may be misleading. nilfs_ioctl_move_blocks() does not actually move blocks, it just reads live blocks in the target segments into own caches (gc-cache).

The move operation is consisting of the read operation and a write operation to new logs, which is carried out in nilfs_clean_segments(). The patch move the former out from the lock section, but it doesn't for the latter.

I think the confusion is due to name of the function. Maybe, it should be named nilfs_ioctl_cache_copy_blocks() or something. But, I would like to separate it off as usual.

Quoted 17 lines

Here are the bonnie++ bench mark results against rc5.
I used sata disk so performace difference is not big.
So I modified nilfs_cleanerd.conf to ensure lock will be long enough.

I ran "bonnie++ -b" three times in each environment. Create clean nilfs2 partition each time before test run.

Results
- write performance of rc5
* Char|17472.333 K/sec
* Block|30748.000 K/sec
* Rewrite|18506.000 K/sec

- write performance of the patched rc5
* Char|17961.000 K/sec -> 102.700%
* Block|30987.666 K/sec -> 100.700%
* Rewrite|18775.666 K/sec -> 101.400%

<snip>

Quoted 27 lines
 fs/nilfs2/ioctl.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
 fs/nilfs2/ioctl.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
fs/nilfs2/ioctl.c +0 -6
index 6ea5f87..83a885c 100644
@@ -442,12 +442,6 @@ int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *nilfs,
 	const char *msg;
 	int ret;
 
-	ret = nilfs_ioctl_move_blocks(nilfs, &argv[0], kbufs[0]);
-	if (ret < 0) {
-		msg = "cannot read source blocks";
-		goto failed;
-	}
-
 	ret = nilfs_ioctl_delete_checkpoints(nilfs, &argv[1], kbufs[1]);
 	if (ret < 0) {
 		/*

fs/nilfs2/ioctl.c static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp, · line 547

Quoted 6 lines
fs/nilfs2/ioctl.c +3 -0
@@ -548,6 +542,12 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp,
 		}
 	}
 
+	ret = nilfs_ioctl_move_blocks(nilfs, &argv[0], kbufs[0]);
+	if (ret < 0) {
+		printk(KERN_ERR "NILFS: GC failed during preparation: cannot read source blocks: err=%d\n", ret);

You should call nilfs_remove_all_gcinode() here before escaping from the normal route.

And, break the line please. You can do it for C-strings just as follows:

printk(KERN_ERR "NILFS: GC failed during preparation: "
"cannot read source blocks: err=%d\n", ret);

Quoted 8 lines
fs/nilfs2/ioctl.c +3 -0
+		goto out_free;
+	}
+
 	ret = nilfs_clean_segments(inode->i_sb, argv, kbufs);
 
  out_free:
Signature · 1 line
1.5.6.5

For the rest, it looks good to me.

Thanks,
Ryusuke Konishi