linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] f2fs: move grabing orphan pages out of protection region
@ 2014-01-10 10:09 Gu Zheng
  2014-01-11  1:27 ` Chao Yu
  2014-01-13  9:43 ` [f2fs-dev][PATCH V2 1/3] f2fs: move grabbing " Gu Zheng
  0 siblings, 2 replies; 4+ messages in thread
From: Gu Zheng @ 2014-01-10 10:09 UTC (permalink / raw)
  To: Kim; +Cc: fsdevel, linux-kernel, f2fs

Move grabing orphan block page out of protection region, and grab all
the orphan block pages ahead.

Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
---
 fs/f2fs/checkpoint.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 0d78bbe..af92c74 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -303,22 +303,25 @@ static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t start_blk)
 {
 	struct list_head *head;
 	struct f2fs_orphan_block *orphan_blk = NULL;
-	struct page *page = NULL;
 	unsigned int nentries = 0;
-	unsigned short index = 1;
-	unsigned short orphan_blocks;
+	unsigned short index;
+	unsigned short orphan_blocks = (unsigned short)((sbi->n_orphans +
+		(F2FS_ORPHANS_PER_BLOCK - 1)) / F2FS_ORPHANS_PER_BLOCK);
+	struct page *page = NULL;
+	struct page *pages[orphan_blocks];
 	struct orphan_inode_entry *orphan = NULL;
 
-	orphan_blocks = (unsigned short)((sbi->n_orphans +
-		(F2FS_ORPHANS_PER_BLOCK - 1)) / F2FS_ORPHANS_PER_BLOCK);
+	for (index = 0; index < orphan_blocks; index++)
+		pages[index] = grab_meta_page(sbi, start_blk + index);
 
+	index = 1;
 	mutex_lock(&sbi->orphan_inode_mutex);
 	head = &sbi->orphan_inode_list;
 
 	/* loop for each orphan inode entry and write them in Jornal block */
 	list_for_each_entry(orphan, head, list) {
 		if (!page) {
-			page = grab_meta_page(sbi, start_blk);
+			page = pages[index - 1];
 			orphan_blk =
 				(struct f2fs_orphan_block *)page_address(page);
 			memset(orphan_blk, 0, sizeof(*orphan_blk));
-- 
1.7.7


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk

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

* Re: [PATCH 1/3] f2fs: move grabing orphan pages out of protection region
  2014-01-10 10:09 [PATCH 1/3] f2fs: move grabing orphan pages out of protection region Gu Zheng
@ 2014-01-11  1:27 ` Chao Yu
  2014-01-13  9:36   ` Gu Zheng
  2014-01-13  9:43 ` [f2fs-dev][PATCH V2 1/3] f2fs: move grabbing " Gu Zheng
  1 sibling, 1 reply; 4+ messages in thread
From: Chao Yu @ 2014-01-11  1:27 UTC (permalink / raw)
  To: 'Gu Zheng', 'Kim'
  Cc: 'fsdevel', 'linux-kernel', 'f2fs'

Hi Gu,

> -----Original Message-----
> From: Gu Zheng [mailto:guz.fnst@cn.fujitsu.com]
> Sent: Friday, January 10, 2014 6:09 PM
> To: Kim
> Cc: fsdevel; linux-kernel; f2fs
> Subject: [f2fs-dev] [PATCH 1/3] f2fs: move grabing orphan pages out of protection region
> 
> Move grabing orphan block page out of protection region, and grab all
> the orphan block pages ahead.
> 
> Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>

Reviewed-by: Chao Yu <chao2.yu@samsung.com>

> ---
>  fs/f2fs/checkpoint.c |   15 +++++++++------
>  1 files changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
> index 0d78bbe..af92c74 100644
> --- a/fs/f2fs/checkpoint.c
> +++ b/fs/f2fs/checkpoint.c
> @@ -303,22 +303,25 @@ static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t
> start_blk)
>  {
>  	struct list_head *head;
>  	struct f2fs_orphan_block *orphan_blk = NULL;
> -	struct page *page = NULL;
>  	unsigned int nentries = 0;
> -	unsigned short index = 1;
> -	unsigned short orphan_blocks;
> +	unsigned short index;
> +	unsigned short orphan_blocks = (unsigned short)((sbi->n_orphans +
> +		(F2FS_ORPHANS_PER_BLOCK - 1)) / F2FS_ORPHANS_PER_BLOCK);
> +	struct page *page = NULL;
> +	struct page *pages[orphan_blocks];
>  	struct orphan_inode_entry *orphan = NULL;
> 
> -	orphan_blocks = (unsigned short)((sbi->n_orphans +
> -		(F2FS_ORPHANS_PER_BLOCK - 1)) / F2FS_ORPHANS_PER_BLOCK);
> +	for (index = 0; index < orphan_blocks; index++)
> +		pages[index] = grab_meta_page(sbi, start_blk + index);
> 
> +	index = 1;
>  	mutex_lock(&sbi->orphan_inode_mutex);
>  	head = &sbi->orphan_inode_list;
> 
>  	/* loop for each orphan inode entry and write them in Jornal block */
>  	list_for_each_entry(orphan, head, list) {
>  		if (!page) {
> -			page = grab_meta_page(sbi, start_blk);
> +			page = pages[index - 1];
>  			orphan_blk =
>  				(struct f2fs_orphan_block *)page_address(page);
>  			memset(orphan_blk, 0, sizeof(*orphan_blk));

It seems that we could remove the following code in write_orphan_inodes.
			start_blk++;

> --
> 1.7.7
> 
> 
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk

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

* Re: [PATCH 1/3] f2fs: move grabing orphan pages out of protection region
  2014-01-11  1:27 ` Chao Yu
@ 2014-01-13  9:36   ` Gu Zheng
  0 siblings, 0 replies; 4+ messages in thread
From: Gu Zheng @ 2014-01-13  9:36 UTC (permalink / raw)
  To: Chao Yu; +Cc: 'fsdevel', 'linux-kernel', 'f2fs'

Hi Yu,
On 01/11/2014 09:27 AM, Chao Yu wrote:

> Hi Gu,
> 
>> -----Original Message-----
>> From: Gu Zheng [mailto:guz.fnst@cn.fujitsu.com]
>> Sent: Friday, January 10, 2014 6:09 PM
>> To: Kim
>> Cc: fsdevel; linux-kernel; f2fs
>> Subject: [f2fs-dev] [PATCH 1/3] f2fs: move grabing orphan pages out of protection region
>>
>> Move grabing orphan block page out of protection region, and grab all
>> the orphan block pages ahead.
>>
>> Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
> 
> Reviewed-by: Chao Yu <chao2.yu@samsung.com>
> 
>> ---
>>  fs/f2fs/checkpoint.c |   15 +++++++++------
>>  1 files changed, 9 insertions(+), 6 deletions(-)
>>
>> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
>> index 0d78bbe..af92c74 100644
>> --- a/fs/f2fs/checkpoint.c
>> +++ b/fs/f2fs/checkpoint.c
>> @@ -303,22 +303,25 @@ static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t
>> start_blk)
>>  {
>>  	struct list_head *head;
>>  	struct f2fs_orphan_block *orphan_blk = NULL;
>> -	struct page *page = NULL;
>>  	unsigned int nentries = 0;
>> -	unsigned short index = 1;
>> -	unsigned short orphan_blocks;
>> +	unsigned short index;
>> +	unsigned short orphan_blocks = (unsigned short)((sbi->n_orphans +
>> +		(F2FS_ORPHANS_PER_BLOCK - 1)) / F2FS_ORPHANS_PER_BLOCK);
>> +	struct page *page = NULL;
>> +	struct page *pages[orphan_blocks];
>>  	struct orphan_inode_entry *orphan = NULL;
>>
>> -	orphan_blocks = (unsigned short)((sbi->n_orphans +
>> -		(F2FS_ORPHANS_PER_BLOCK - 1)) / F2FS_ORPHANS_PER_BLOCK);
>> +	for (index = 0; index < orphan_blocks; index++)
>> +		pages[index] = grab_meta_page(sbi, start_blk + index);
>>
>> +	index = 1;
>>  	mutex_lock(&sbi->orphan_inode_mutex);
>>  	head = &sbi->orphan_inode_list;
>>
>>  	/* loop for each orphan inode entry and write them in Jornal block */
>>  	list_for_each_entry(orphan, head, list) {
>>  		if (!page) {
>> -			page = grab_meta_page(sbi, start_blk);
>> +			page = pages[index - 1];
>>  			orphan_blk =
>>  				(struct f2fs_orphan_block *)page_address(page);
>>  			memset(orphan_blk, 0, sizeof(*orphan_blk));
> 
> It seems that we could remove the following code in write_orphan_inodes.
> 			start_blk++;

Yes, you're right, thanks for your review.

Regards,
Gu

> 
>> --
>> 1.7.7
>>
>>
>> ------------------------------------------------------------------------------
>> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
>> Learn Why More Businesses Are Choosing CenturyLink Cloud For
>> Critical Workloads, Development Environments & Everything In Between.
>> Get a Quote or Start a Free Trial Today.
>> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Linux-f2fs-devel mailing list
>> Linux-f2fs-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> 
> 



------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk

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

* [f2fs-dev][PATCH V2 1/3] f2fs: move grabbing orphan pages out of protection region
  2014-01-10 10:09 [PATCH 1/3] f2fs: move grabing orphan pages out of protection region Gu Zheng
  2014-01-11  1:27 ` Chao Yu
@ 2014-01-13  9:43 ` Gu Zheng
  1 sibling, 0 replies; 4+ messages in thread
From: Gu Zheng @ 2014-01-13  9:43 UTC (permalink / raw)
  To: Kim; +Cc: f2fs, fsdevel, linux-kernel, 俞超

Move grabbing orphan block page out of protection region, and grab all
the orphan block pages ahead.

v2:
  Remove the redundant code as Chao Yu suggested.

Reviewed-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
---
 fs/f2fs/checkpoint.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 0d78bbe..fdc5a12 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -303,22 +303,25 @@ static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t start_blk)
 {
 	struct list_head *head;
 	struct f2fs_orphan_block *orphan_blk = NULL;
-	struct page *page = NULL;
 	unsigned int nentries = 0;
-	unsigned short index = 1;
-	unsigned short orphan_blocks;
+	unsigned short index;
+	unsigned short orphan_blocks = (unsigned short)((sbi->n_orphans +
+		(F2FS_ORPHANS_PER_BLOCK - 1)) / F2FS_ORPHANS_PER_BLOCK);
+	struct page *page = NULL;
+	struct page *pages[orphan_blocks];
 	struct orphan_inode_entry *orphan = NULL;
 
-	orphan_blocks = (unsigned short)((sbi->n_orphans +
-		(F2FS_ORPHANS_PER_BLOCK - 1)) / F2FS_ORPHANS_PER_BLOCK);
+	for (index = 0; index < orphan_blocks; index++)
+		pages[index] = grab_meta_page(sbi, start_blk + index);
 
+	index = 1;
 	mutex_lock(&sbi->orphan_inode_mutex);
 	head = &sbi->orphan_inode_list;
 
 	/* loop for each orphan inode entry and write them in Jornal block */
 	list_for_each_entry(orphan, head, list) {
 		if (!page) {
-			page = grab_meta_page(sbi, start_blk);
+			page = pages[index - 1];
 			orphan_blk =
 				(struct f2fs_orphan_block *)page_address(page);
 			memset(orphan_blk, 0, sizeof(*orphan_blk));
@@ -338,7 +341,6 @@ static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t start_blk)
 			set_page_dirty(page);
 			f2fs_put_page(page, 1);
 			index++;
-			start_blk++;
 			nentries = 0;
 			page = NULL;
 		}
-- 
1.7.7



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

end of thread, other threads:[~2014-01-13  9:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-10 10:09 [PATCH 1/3] f2fs: move grabing orphan pages out of protection region Gu Zheng
2014-01-11  1:27 ` Chao Yu
2014-01-13  9:36   ` Gu Zheng
2014-01-13  9:43 ` [f2fs-dev][PATCH V2 1/3] f2fs: move grabbing " Gu Zheng

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).