f2fs: readahead contiguous pages for restore_node_summary
Subsystems (2)
PATCH 1/1 f2fs: readahead contiguous pages for restore_node_summary
If cp has no CP_UMOUNT_FLAG, we will read all pages in whole node segment one by one, it makes low performance. So let's merge contiguous pages and readahead for better performance.
--- fs/f2fs/node.c | 89 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 63 insertions(+), 26 deletions(-)
fs/f2fs/node.c +63 -26
@@ -1572,47 +1572,84 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)return 0 ; } +/* +* ra_sum_pages() merge contiguous pages into one bio and submit. +* these pre-readed pages are linked in pages list. +*/ +static int ra_sum_pages (struct f2fs_sb_info *sbi,struct list_head *pages, +int start,int nrpages) +{ +struct page *page; +int page_idx = start; + +for (; page_idx < start + nrpages; page_idx++) { +/* alloc temporal page for read node summary info*/ + page =alloc_page (GFP_NOFS | __GFP_ZERO); +if (!page) { +struct page *tmp; +list_for_each_entry_safe (page, tmp, pages, lru) { +list_del (&page->lru); +unlock_page (page); +__free_pages (page,0 ); + } +return -ENOMEM ; + } + +lock_page (page); + page->index = page_idx; +list_add_tail (&page->lru, pages); + } + +list_for_each_entry (page, pages, lru) +submit_read_page (sbi, page, page->index,READ_SYNC ); + +f2fs_submit_read_bio (sbi,READ_SYNC ); +return 0 ; +} +int restore_node_summary (struct f2fs_sb_info *sbi,unsigned int segno,struct f2fs_summary_block *sum) {struct f2fs_node *rn;struct f2fs_summary *sum_entry; -struct page *page; +struct page *page, *tmp;block_t addr; -int i, last_offset; - -/* alloc temporal page for read node */ - page =alloc_page (GFP_NOFS | __GFP_ZERO); -if (!page) -return -ENOMEM ; -lock_page (page); +int bio_blocks =MAX_BIO_BLOCKS (max_hw_blocks (sbi)); +int i, last_offset, nrpages, err =0 ; +LIST_HEAD (page_list);/* scan the node segment */ last_offset = sbi->blocks_per_seg; addr =START_BLOCK (sbi, segno); sum_entry = &sum->entries[0 ]; -for (i =0 ; i < last_offset; i++, sum_entry++) { -/* -* In order to read next node page, -* we must clear PageUptodate flag. -*/ -ClearPageUptodate (page); +for (i =0 ; i < last_offset; i += nrpages, addr += nrpages) { -if (f2fs_readpage (sbi, page, addr,READ_SYNC )) - goto out; + nrpages =min (last_offset - i, bio_blocks); +/* read ahead node pages */ + err =ra_sum_pages (sbi, &page_list, addr, nrpages); +if (err) +return err; -lock_page (page); - rn =F2FS_NODE (page); - sum_entry->nid = rn->footer.nid; - sum_entry->version =0 ; - sum_entry->ofs_in_node =0 ; - addr++; +list_for_each_entry_safe (page, tmp, &page_list, lru) { + +lock_page (page); +if (PageUptodate (page)) { + rn =F2FS_NODE (page); + sum_entry->nid = rn->footer.nid; + sum_entry->version =0 ; + sum_entry->ofs_in_node =0 ; + sum_entry++; + }else { + err = -EIO ; + } + +list_del (&page->lru); +unlock_page (page); +__free_pages (page,0 ); + } } -unlock_page (page); -out: -__free_pages (page,0 ); -return 0 ; +return err; }static bool flush_nats_in_journal (struct f2fs_sb_info *sbi)
Signature · 9 lines
1.7.9.5 ------------------------------------------------------------------------------ Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
Hi Chao,
It seems that we already have a readahed function for node pages, ra_node_page().
So, we don't make a page list for this, but can use the node_inode's page cache.
So how about writing ra_node_pages() which use the node_inode's page cache?
Thanks,
2013-11-22 (금), 15:48 +0800, Chao Yu:
Quoted 124 lines
If cp has no
CP_UMOUNT_FLAG, we will read all pages in whole node segment one by one, it makes low performance. So let's merge contiguous pages and readahead for better performance.Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/node.c | 89 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 63 insertions(+), 26 deletions(-)fs/f2fs/node.c +63
-26@@ -1572,47 +1572,84 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)return 0 ; } +/* +* ra_sum_pages() merge contiguous pages into one bio and submit. +* these pre-readed pages are linked in pages list. +*/ +static int ra_sum_pages (struct f2fs_sb_info *sbi,struct list_head *pages, +int start,int nrpages) +{ +struct page *page; +int page_idx = start; + +for (; page_idx < start + nrpages; page_idx++) { +/* alloc temporal page for read node summary info*/ + page =alloc_page (GFP_NOFS | __GFP_ZERO); +if (!page) { +struct page *tmp; +list_for_each_entry_safe (page, tmp, pages, lru) { +list_del (&page->lru); +unlock_page (page); +__free_pages (page,0 ); + } +return -ENOMEM ; + } + +lock_page (page); + page->index = page_idx; +list_add_tail (&page->lru, pages); + } + +list_for_each_entry (page, pages, lru) +submit_read_page (sbi, page, page->index,READ_SYNC ); + +f2fs_submit_read_bio (sbi,READ_SYNC ); +return 0 ; +} +int restore_node_summary (struct f2fs_sb_info *sbi,unsigned int segno,struct f2fs_summary_block *sum) {struct f2fs_node *rn;struct f2fs_summary *sum_entry; -struct page *page; +struct page *page, *tmp;block_t addr; -int i, last_offset; - -/* alloc temporal page for read node */ - page =alloc_page (GFP_NOFS | __GFP_ZERO); -if (!page) -return -ENOMEM ; -lock_page (page); +int bio_blocks =MAX_BIO_BLOCKS (max_hw_blocks (sbi)); +int i, last_offset, nrpages, err =0 ; +LIST_HEAD (page_list);/* scan the node segment */ last_offset = sbi->blocks_per_seg; addr =START_BLOCK (sbi, segno); sum_entry = &sum->entries[0 ]; -for (i =0 ; i < last_offset; i++, sum_entry++) { -/* -* In order to read next node page, -* we must clear PageUptodate flag. -*/ -ClearPageUptodate (page); +for (i =0 ; i < last_offset; i += nrpages, addr += nrpages) { -if (f2fs_readpage (sbi, page, addr,READ_SYNC )) - goto out; + nrpages =min (last_offset - i, bio_blocks); +/* read ahead node pages */ + err =ra_sum_pages (sbi, &page_list, addr, nrpages); +if (err) +return err; -lock_page (page); - rn =F2FS_NODE (page); - sum_entry->nid = rn->footer.nid; - sum_entry->version =0 ; - sum_entry->ofs_in_node =0 ; - addr++; +list_for_each_entry_safe (page, tmp, &page_list, lru) { + +lock_page (page); +if (PageUptodate (page)) { + rn =F2FS_NODE (page); + sum_entry->nid = rn->footer.nid; + sum_entry->version =0 ; + sum_entry->ofs_in_node =0 ; + sum_entry++; + }else { + err = -EIO ; + } + +list_del (&page->lru); +unlock_page (page); +__free_pages (page,0 ); + } } -unlock_page (page); -out: -__free_pages (page,0 ); -return 0 ; +return err; }static bool flush_nats_in_journal (struct f2fs_sb_info *sbi)
Signature · 7 lines
Jaegeuk Kim Samsung -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Kim,
Quoted 7 lines
-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Wednesday, November 27, 2013 1:30 PM
To: Chao Yu
Cc: [email protected]; [email protected]; [email protected]; 谭姝
Subject: Re: [f2fs-dev] [PATCH] f2fs: readahead contiguous pages forrestore_node_summary
Quoted 6 lines
Hi Chao,
It seems that we already have a readahed function for node pages,
ra_node_page().
So, we don't make a page list for this, but can use the node_inode's page cache.
So you mean it's waste to release page list with updated data after we finish work in restore_node_summary, right?
Quoted 3 lines
So how about writing
ra_node_pages()which use the node_inode's page cache?
Hmm, so ra_node_pages is introduced for read node_inode's pages which are logical contiguously? and it also could take place of ra_node_page?
Quoted 127 lines
Thanks,
2013-11-22 (금), 15:48 +0800, Chao Yu:
Quoted 123 lines
If cp has no
CP_UMOUNT_FLAG, we will read all pages in whole node segment one by one, it makes low performance. So let's merge contiguous pages and readahead for better performance.Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/node.c | 89 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 63 insertions(+), 26 deletions(-)fs/f2fs/node.c +63
-26@@ -1572,47 +1572,84 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)return 0 ; } +/* +* ra_sum_pages() merge contiguous pages into one bio and submit. +* these pre-readed pages are linked in pages list. +*/ +static int ra_sum_pages (struct f2fs_sb_info *sbi,struct list_head *pages, +int start,int nrpages) +{ +struct page *page; +int page_idx = start; + +for (; page_idx < start + nrpages; page_idx++) { +/* alloc temporal page for read node summary info*/ + page =alloc_page (GFP_NOFS | __GFP_ZERO); +if (!page) { +struct page *tmp; +list_for_each_entry_safe (page, tmp, pages, lru) { +list_del (&page->lru); +unlock_page (page); +__free_pages (page,0 ); + } +return -ENOMEM ; + } + +lock_page (page); + page->index = page_idx; +list_add_tail (&page->lru, pages); + } + +list_for_each_entry (page, pages, lru) +submit_read_page (sbi, page, page->index,READ_SYNC ); + +f2fs_submit_read_bio (sbi,READ_SYNC ); +return 0 ; +} +int restore_node_summary (struct f2fs_sb_info *sbi,unsigned int segno,struct f2fs_summary_block *sum) {struct f2fs_node *rn;struct f2fs_summary *sum_entry; -struct page *page; +struct page *page, *tmp;block_t addr; -int i, last_offset; - -/* alloc temporal page for read node */ - page =alloc_page (GFP_NOFS | __GFP_ZERO); -if (!page) -return -ENOMEM ; -lock_page (page); +int bio_blocks =MAX_BIO_BLOCKS (max_hw_blocks (sbi)); +int i, last_offset, nrpages, err =0 ; +LIST_HEAD (page_list);/* scan the node segment */ last_offset = sbi->blocks_per_seg; addr =START_BLOCK (sbi, segno); sum_entry = &sum->entries[0 ]; -for (i =0 ; i < last_offset; i++, sum_entry++) { -/* -* In order to read next node page, -* we must clear PageUptodate flag. -*/ -ClearPageUptodate (page); +for (i =0 ; i < last_offset; i += nrpages, addr += nrpages) { -if (f2fs_readpage (sbi, page, addr,READ_SYNC )) - goto out; + nrpages =min (last_offset - i, bio_blocks); +/* read ahead node pages */ + err =ra_sum_pages (sbi, &page_list, addr, nrpages); +if (err) +return err; -lock_page (page); - rn =F2FS_NODE (page); - sum_entry->nid = rn->footer.nid; - sum_entry->version =0 ; - sum_entry->ofs_in_node =0 ; - addr++; +list_for_each_entry_safe (page, tmp, &page_list, lru) { + +lock_page (page); +if (PageUptodate (page)) { + rn =F2FS_NODE (page); + sum_entry->nid = rn->footer.nid; + sum_entry->version =0 ; + sum_entry->ofs_in_node =0 ; + sum_entry++; + }else { + err = -EIO ; + } + +list_del (&page->lru); +unlock_page (page); +__free_pages (page,0 ); + } } -unlock_page (page); -out: -__free_pages (page,0 ); -return 0 ; +return err; }
Quoted 5 lines
fs/f2fs/node.c int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page) · line 1655
Quoted 1 line
fs/f2fs/node.c +0
-0static bool flush_nats_in_journal (struct f2fs_sb_info *sbi)--
Jaegeuk Kim
Samsung
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Hi,
2013-11-27 (수), 15:58 +0800, Chao Yu:
Quoted 11 lines
Hi Kim,
Quoted 9 lines
-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Wednesday, November 27, 2013 1:30 PM
To: Chao Yu
Cc: [email protected]; [email protected]; [email protected]; 谭姝
Subject: Re: [f2fs-dev] [PATCH] f2fs: readahead contiguous pages forrestore_node_summaryHi Chao,
Quoted 7 lines
Quoted 4 lines
It seems that we already have a readahed function for node pages,
ra_node_page().
So, we don't make a page list for this, but can use the node_inode's page cache.So you mean it's waste to release page list with updated data after we finish work in
restore_node_summary, right?
Right.
Quoted 7 lines
Quoted 4 lines
So how about writing
ra_node_pages()which use the node_inode's page cache?Hmm, so
ra_node_pagesis introduced for read node_inode's pages which are logical contiguously? and it also could take place ofra_node_page?
Ah. The ra_node_page() read a node page ahead for a given node id. So it doesn't match exactly between ra_node_page() and ra_node_pages() that I suggested.
So how about reading node pages and then caching some of them in the page cache, node_inode's address space?
Thanks,
Quoted 135 lines
Quoted 134 lines
Thanks,
2013-11-22 (금), 15:48 +0800, Chao Yu:
Quoted 114 lines
If cp has no
CP_UMOUNT_FLAG, we will read all pages in whole node segment one by one, it makes low performance. So let's merge contiguous pages and readahead for better performance.Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/node.c | 89 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 63 insertions(+), 26 deletions(-)fs/f2fs/node.c +61
-22@@ -1572,47 +1572,84 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)return 0 ; } +/* +* ra_sum_pages() merge contiguous pages into one bio and submit. +* these pre-readed pages are linked in pages list. +*/ +static int ra_sum_pages (struct f2fs_sb_info *sbi,struct list_head *pages, +int start,int nrpages) +{ +struct page *page; +int page_idx = start; + +for (; page_idx < start + nrpages; page_idx++) { +/* alloc temporal page for read node summary info*/ + page =alloc_page (GFP_NOFS | __GFP_ZERO); +if (!page) { +struct page *tmp; +list_for_each_entry_safe (page, tmp, pages, lru) { +list_del (&page->lru); +unlock_page (page); +__free_pages (page,0 ); + } +return -ENOMEM ; + } + +lock_page (page); + page->index = page_idx; +list_add_tail (&page->lru, pages); + } + +list_for_each_entry (page, pages, lru) +submit_read_page (sbi, page, page->index,READ_SYNC ); + +f2fs_submit_read_bio (sbi,READ_SYNC ); +return 0 ; +} +int restore_node_summary (struct f2fs_sb_info *sbi,unsigned int segno,struct f2fs_summary_block *sum) {struct f2fs_node *rn;struct f2fs_summary *sum_entry; -struct page *page; +struct page *page, *tmp;block_t addr; -int i, last_offset; - -/* alloc temporal page for read node */ - page =alloc_page (GFP_NOFS | __GFP_ZERO); -if (!page) -return -ENOMEM ; -lock_page (page); +int bio_blocks =MAX_BIO_BLOCKS (max_hw_blocks (sbi)); +int i, last_offset, nrpages, err =0 ; +LIST_HEAD (page_list);/* scan the node segment */ last_offset = sbi->blocks_per_seg; addr =START_BLOCK (sbi, segno); sum_entry = &sum->entries[0 ]; -for (i =0 ; i < last_offset; i++, sum_entry++) { -/* -* In order to read next node page, -* we must clear PageUptodate flag. -*/ -ClearPageUptodate (page); +for (i =0 ; i < last_offset; i += nrpages, addr += nrpages) { -if (f2fs_readpage (sbi, page, addr,READ_SYNC )) - goto out; + nrpages =min (last_offset - i, bio_blocks); +/* read ahead node pages */ + err =ra_sum_pages (sbi, &page_list, addr, nrpages); +if (err) +return err; -lock_page (page); - rn =F2FS_NODE (page); - sum_entry->nid = rn->footer.nid; - sum_entry->version =0 ; - sum_entry->ofs_in_node =0 ; - addr++; +list_for_each_entry_safe (page, tmp, &page_list, lru) { + +lock_page (page); +if (PageUptodate (page)) { + rn =F2FS_NODE (page); + sum_entry->nid = rn->footer.nid; + sum_entry->version =0 ; + sum_entry->ofs_in_node =0 ; + sum_entry++; + }else { + err = -EIO ; + } + +list_del (&page->lru); +unlock_page (page); +__free_pages (page,0 );fs/f2fs/node.c int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page) · line 1655
Quoted 10 lines
fs/f2fs/node.c +2
-4+ } } -unlock_page (page); -out: -__free_pages (page,0 ); -return 0 ; +return err; }static bool flush_nats_in_journal (struct f2fs_sb_info *sbi)--
Jaegeuk Kim
Samsung
Signature · 7 lines
Jaegeuk Kim Samsung -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Kim,
Quoted 26 lines
-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Wednesday, November 27, 2013 4:19 PM
To: Chao Yu
Cc: [email protected]; [email protected]; [email protected]; '谭姝'
Subject: RE: [f2fs-dev] [PATCH] f2fs: readahead contiguous pages forrestore_node_summaryHi,
2013-11-27 (수), 15:58 +0800, Chao Yu:
Quoted 16 lines
Hi Kim,
Quoted 13 lines
-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Wednesday, November 27, 2013 1:30 PM
To: Chao Yu
Cc: [email protected]; [email protected]; [email protected]; 谭姝
Subject: Re: [f2fs-dev] [PATCH] f2fs: readahead contiguous pages forrestore_node_summaryHi Chao,
It seems that we already have a readahed function for node pages,
ra_node_page().
So, we don't make a page list for this, but can use the node_inode's page cache.
Quoted 4 lines
Quoted 2 lines
So you mean it's waste to release page list with updated data after we finish work in
restore_node_summary, right?Right.
So how about add all pages of page list to node_inode's address space by add_to_page_cache_lru() with arg sum_entry->nid?
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
So how about writing
ra_node_pages()which use the node_inode's page cache?
Quoted 8 lines
Quoted 2 lines
Hmm, so
ra_node_pagesis introduced for read node_inode's pages which are logical contiguously? and it also could take place ofra_node_page?Ah. The
ra_node_page()read a node page ahead for a given node id. So it doesn't match exactly betweenra_node_page()andra_node_pages()that I suggested.
So how about reading node pages and then caching some of them in the page cache, node_inode's address space?
Got it,
If we do not use the method above, we should search the NAT for nid number as the index of node_inode's page by the specified node page blkaddr, that costs a lot.
How do you think?
Quoted 139 lines
Thanks,
Quoted 129 lines
Quoted 129 lines
Thanks,
2013-11-22 (금), 15:48 +0800, Chao Yu:
Quoted 123 lines
If cp has no
CP_UMOUNT_FLAG, we will read all pages in whole node segment one by one, it makes low performance. So let's merge contiguous pages and readahead for better performance.Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/node.c | 89 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 63 insertions(+), 26 deletions(-)fs/f2fs/node.c +63
-26@@ -1572,47 +1572,84 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)return 0 ; } +/* +* ra_sum_pages() merge contiguous pages into one bio and submit. +* these pre-readed pages are linked in pages list. +*/ +static int ra_sum_pages (struct f2fs_sb_info *sbi,struct list_head *pages, +int start,int nrpages) +{ +struct page *page; +int page_idx = start; + +for (; page_idx < start + nrpages; page_idx++) { +/* alloc temporal page for read node summary info*/ + page =alloc_page (GFP_NOFS | __GFP_ZERO); +if (!page) { +struct page *tmp; +list_for_each_entry_safe (page, tmp, pages, lru) { +list_del (&page->lru); +unlock_page (page); +__free_pages (page,0 ); + } +return -ENOMEM ; + } + +lock_page (page); + page->index = page_idx; +list_add_tail (&page->lru, pages); + } + +list_for_each_entry (page, pages, lru) +submit_read_page (sbi, page, page->index,READ_SYNC ); + +f2fs_submit_read_bio (sbi,READ_SYNC ); +return 0 ; +} +int restore_node_summary (struct f2fs_sb_info *sbi,unsigned int segno,struct f2fs_summary_block *sum) {struct f2fs_node *rn;struct f2fs_summary *sum_entry; -struct page *page; +struct page *page, *tmp;block_t addr; -int i, last_offset; - -/* alloc temporal page for read node */ - page =alloc_page (GFP_NOFS | __GFP_ZERO); -if (!page) -return -ENOMEM ; -lock_page (page); +int bio_blocks =MAX_BIO_BLOCKS (max_hw_blocks (sbi)); +int i, last_offset, nrpages, err =0 ; +LIST_HEAD (page_list);/* scan the node segment */ last_offset = sbi->blocks_per_seg; addr =START_BLOCK (sbi, segno); sum_entry = &sum->entries[0 ]; -for (i =0 ; i < last_offset; i++, sum_entry++) { -/* -* In order to read next node page, -* we must clear PageUptodate flag. -*/ -ClearPageUptodate (page); +for (i =0 ; i < last_offset; i += nrpages, addr += nrpages) { -if (f2fs_readpage (sbi, page, addr,READ_SYNC )) - goto out; + nrpages =min (last_offset - i, bio_blocks); +/* read ahead node pages */ + err =ra_sum_pages (sbi, &page_list, addr, nrpages); +if (err) +return err; -lock_page (page); - rn =F2FS_NODE (page); - sum_entry->nid = rn->footer.nid; - sum_entry->version =0 ; - sum_entry->ofs_in_node =0 ; - addr++; +list_for_each_entry_safe (page, tmp, &page_list, lru) { + +lock_page (page); +if (PageUptodate (page)) { + rn =F2FS_NODE (page); + sum_entry->nid = rn->footer.nid; + sum_entry->version =0 ; + sum_entry->ofs_in_node =0 ; + sum_entry++; + }else { + err = -EIO ; + } + +list_del (&page->lru); +unlock_page (page); +__free_pages (page,0 ); + } } -unlock_page (page); -out: -__free_pages (page,0 ); -return 0 ; +return err; }Quoted 6 lines
Quoted 5 lines
fs/f2fs/node.c int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page) · line 1655
Quoted 1 line
fs/f2fs/node.c +0
-0static bool flush_nats_in_journal (struct f2fs_sb_info *sbi)--
Jaegeuk Kim
Samsung
Quoted 3 lines
--
Jaegeuk Kim
Samsung
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Hi,
2013-11-28 (목), 09:26 +0800, Chao Yu:
Quoted 28 lines
Hi Kim,
Quoted 26 lines
-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Wednesday, November 27, 2013 4:19 PM
To: Chao Yu
Cc: [email protected]; [email protected]; [email protected]; '谭姝'
Subject: RE: [f2fs-dev] [PATCH] f2fs: readahead contiguous pages forrestore_node_summaryHi,
2013-11-27 (수), 15:58 +0800, Chao Yu:
Quoted 16 lines
Hi Kim,
Quoted 13 lines
-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Wednesday, November 27, 2013 1:30 PM
To: Chao Yu
Cc: [email protected]; [email protected]; [email protected]; 谭姝
Subject: Re: [f2fs-dev] [PATCH] f2fs: readahead contiguous pages forrestore_node_summaryHi Chao,
It seems that we already have a readahed function for node pages,
ra_node_page().
So, we don't make a page list for this, but can use the node_inode's page cache.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
So you mean it's waste to release page list with updated data after we finish work in
restore_node_summary, right?Right.
So how about add all pages of page list to node_inode's address space by
add_to_page_cache_lru()with argsum_entry->nid?
I don't think it's proper way to use add_to_page_cache_lru() directly.
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
So how about writing
ra_node_pages()which use the node_inode's page cache?Quoted 8 lines
Quoted 2 lines
Hmm, so
ra_node_pagesis introduced for read node_inode's pages which are logical contiguously? and it also could take place ofra_node_page?Ah. The
ra_node_page()read a node page ahead for a given node id. So it doesn't match exactly betweenra_node_page()andra_node_pages()that I suggested.
So how about reading node pages and then caching some of them in the page cache, node_inode's address space?
Quoted 5 lines
Got it,
If we do not use the method above, we should search the NAT for nid number as the index of node_inode's page by the specified node page blkaddr, that costs a lot.
How do you think?
1. grab_cache_page(node_footer->nid);
2. memcpy();
3. SetPageUptodate();
4. f2fs_put_page();
Thanks,
Quoted 144 lines
Quoted 143 lines
Thanks,
Quoted 129 lines
Quoted 129 lines
Thanks,
2013-11-22 (금), 15:48 +0800, Chao Yu:
Quoted 123 lines
If cp has no
CP_UMOUNT_FLAG, we will read all pages in whole node segment one by one, it makes low performance. So let's merge contiguous pages and readahead for better performance.Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/node.c | 89 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 63 insertions(+), 26 deletions(-)fs/f2fs/node.c +63
-26@@ -1572,47 +1572,84 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)return 0 ; } +/* +* ra_sum_pages() merge contiguous pages into one bio and submit. +* these pre-readed pages are linked in pages list. +*/ +static int ra_sum_pages (struct f2fs_sb_info *sbi,struct list_head *pages, +int start,int nrpages) +{ +struct page *page; +int page_idx = start; + +for (; page_idx < start + nrpages; page_idx++) { +/* alloc temporal page for read node summary info*/ + page =alloc_page (GFP_NOFS | __GFP_ZERO); +if (!page) { +struct page *tmp; +list_for_each_entry_safe (page, tmp, pages, lru) { +list_del (&page->lru); +unlock_page (page); +__free_pages (page,0 ); + } +return -ENOMEM ; + } + +lock_page (page); + page->index = page_idx; +list_add_tail (&page->lru, pages); + } + +list_for_each_entry (page, pages, lru) +submit_read_page (sbi, page, page->index,READ_SYNC ); + +f2fs_submit_read_bio (sbi,READ_SYNC ); +return 0 ; +} +int restore_node_summary (struct f2fs_sb_info *sbi,unsigned int segno,struct f2fs_summary_block *sum) {struct f2fs_node *rn;struct f2fs_summary *sum_entry; -struct page *page; +struct page *page, *tmp;block_t addr; -int i, last_offset; - -/* alloc temporal page for read node */ - page =alloc_page (GFP_NOFS | __GFP_ZERO); -if (!page) -return -ENOMEM ; -lock_page (page); +int bio_blocks =MAX_BIO_BLOCKS (max_hw_blocks (sbi)); +int i, last_offset, nrpages, err =0 ; +LIST_HEAD (page_list);/* scan the node segment */ last_offset = sbi->blocks_per_seg; addr =START_BLOCK (sbi, segno); sum_entry = &sum->entries[0 ]; -for (i =0 ; i < last_offset; i++, sum_entry++) { -/* -* In order to read next node page, -* we must clear PageUptodate flag. -*/ -ClearPageUptodate (page); +for (i =0 ; i < last_offset; i += nrpages, addr += nrpages) { -if (f2fs_readpage (sbi, page, addr,READ_SYNC )) - goto out; + nrpages =min (last_offset - i, bio_blocks); +/* read ahead node pages */ + err =ra_sum_pages (sbi, &page_list, addr, nrpages); +if (err) +return err; -lock_page (page); - rn =F2FS_NODE (page); - sum_entry->nid = rn->footer.nid; - sum_entry->version =0 ; - sum_entry->ofs_in_node =0 ; - addr++; +list_for_each_entry_safe (page, tmp, &page_list, lru) { + +lock_page (page); +if (PageUptodate (page)) { + rn =F2FS_NODE (page); + sum_entry->nid = rn->footer.nid; + sum_entry->version =0 ; + sum_entry->ofs_in_node =0 ; + sum_entry++; + }else { + err = -EIO ; + } + +list_del (&page->lru); +unlock_page (page); +__free_pages (page,0 ); + } } -unlock_page (page); -out: -__free_pages (page,0 ); -return 0 ; +return err; }Quoted 6 lines
Quoted 5 lines
fs/f2fs/node.c int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page) · line 1655
Quoted 1 line
fs/f2fs/node.c +0
-0static bool flush_nats_in_journal (struct f2fs_sb_info *sbi)--
Jaegeuk Kim
Samsung--
Jaegeuk Kim
Samsung
Signature · 2 lines
Jaegeuk Kim Samsung
Hi,
Quoted 41 lines
-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Thursday, November 28, 2013 11:33 AM
To: Chao Yu
Cc: [email protected]; [email protected]; [email protected]; '谭姝'
Subject: RE: [f2fs-dev] [PATCH] f2fs: readahead contiguous pages forrestore_node_summaryHi,
2013-11-28 (목), 09:26 +0800, Chao Yu:
Quoted 31 lines
Hi Kim,
Quoted 29 lines
-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Wednesday, November 27, 2013 4:19 PM
To: Chao Yu
Cc: [email protected]; [email protected]; [email protected]; '谭姝'
Subject: RE: [f2fs-dev] [PATCH] f2fs: readahead contiguous pages forrestore_node_summaryHi,
2013-11-27 (수), 15:58 +0800, Chao Yu:
Quoted 18 lines
Hi Kim,
Quoted 7 lines
-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Wednesday, November 27, 2013 1:30 PM
To: Chao Yu
Cc: [email protected]; [email protected]; [email protected]; 谭姝
Subject: Re: [f2fs-dev] [PATCH] f2fs: readahead contiguous pages forrestore_node_summaryQuoted 6 lines
Hi Chao,
It seems that we already have a readahed function for node pages,
ra_node_page().
So, we don't make a page list for this, but can use the node_inode's page cache.So you mean it's waste to release page list with updated data after we finish work in
restore_node_summary, right?
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Right.
So how about add all pages of page list to node_inode's address space by
add_to_page_cache_lru()with argsum_entry->nid?I don't think it's proper way to use
add_to_page_cache_lru()directly.
This is the way used in VM readahead(i.e. read_pages/mpage_readpages/ read_cache_pages).
So what you worry about is that using lonely add_to_page_cache_lru() may cause exception, is it?
Quoted 23 lines
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
So how about writing
ra_node_pages()which use the node_inode's page cache?Quoted 8 lines
Quoted 2 lines
Hmm, so
ra_node_pagesis introduced for read node_inode's pages which are logical contiguously? and it also could take place ofra_node_page?Ah. The
ra_node_page()read a node page ahead for a given node id. So it doesn't match exactly betweenra_node_page()andra_node_pages()that I suggested.
So how about reading node pages and then caching some of them in the page cache, node_inode's address space?Quoted 5 lines
Got it,
If we do not use the method above, we should search the NAT for nid number as the index of node_inode's page by the specified node page blkaddr, that costs a lot.
How do you think?
Quoted 4 lines
1.
grab_cache_page(node_footer->nid);
2.memcpy();
3.SetPageUptodate();
4.f2fs_put_page();
It could be.
This make ra_node_pages() synchronized, because we should read node_footer->nid from updated node page before we cache node pages, and we will still use page list to pass the updated page.
Why not introduce f2fs_cache_node_pages() include your code to cache node pages after ra_node_pages()?
Thanks,
Yu
Quoted 143 lines
Thanks,
Quoted 140 lines
Quoted 140 lines
Thanks,
Quoted 135 lines
Quoted 134 lines
Thanks,
2013-11-22 (금), 15:48 +0800, Chao Yu:
Quoted 114 lines
If cp has no
CP_UMOUNT_FLAG, we will read all pages in whole node segment one by one, it makes low performance. So let's merge contiguous pages and readahead for better performance.Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/node.c | 89 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 63 insertions(+), 26 deletions(-)fs/f2fs/node.c +61
-22@@ -1572,47 +1572,84 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)return 0 ; } +/* +* ra_sum_pages() merge contiguous pages into one bio and submit. +* these pre-readed pages are linked in pages list. +*/ +static int ra_sum_pages (struct f2fs_sb_info *sbi,struct list_head *pages, +int start,int nrpages) +{ +struct page *page; +int page_idx = start; + +for (; page_idx < start + nrpages; page_idx++) { +/* alloc temporal page for read node summary info*/ + page =alloc_page (GFP_NOFS | __GFP_ZERO); +if (!page) { +struct page *tmp; +list_for_each_entry_safe (page, tmp, pages, lru) { +list_del (&page->lru); +unlock_page (page); +__free_pages (page,0 ); + } +return -ENOMEM ; + } + +lock_page (page); + page->index = page_idx; +list_add_tail (&page->lru, pages); + } + +list_for_each_entry (page, pages, lru) +submit_read_page (sbi, page, page->index,READ_SYNC ); + +f2fs_submit_read_bio (sbi,READ_SYNC ); +return 0 ; +} +int restore_node_summary (struct f2fs_sb_info *sbi,unsigned int segno,struct f2fs_summary_block *sum) {struct f2fs_node *rn;struct f2fs_summary *sum_entry; -struct page *page; +struct page *page, *tmp;block_t addr; -int i, last_offset; - -/* alloc temporal page for read node */ - page =alloc_page (GFP_NOFS | __GFP_ZERO); -if (!page) -return -ENOMEM ; -lock_page (page); +int bio_blocks =MAX_BIO_BLOCKS (max_hw_blocks (sbi)); +int i, last_offset, nrpages, err =0 ; +LIST_HEAD (page_list);/* scan the node segment */ last_offset = sbi->blocks_per_seg; addr =START_BLOCK (sbi, segno); sum_entry = &sum->entries[0 ]; -for (i =0 ; i < last_offset; i++, sum_entry++) { -/* -* In order to read next node page, -* we must clear PageUptodate flag. -*/ -ClearPageUptodate (page); +for (i =0 ; i < last_offset; i += nrpages, addr += nrpages) { -if (f2fs_readpage (sbi, page, addr,READ_SYNC )) - goto out; + nrpages =min (last_offset - i, bio_blocks); +/* read ahead node pages */ + err =ra_sum_pages (sbi, &page_list, addr, nrpages); +if (err) +return err; -lock_page (page); - rn =F2FS_NODE (page); - sum_entry->nid = rn->footer.nid; - sum_entry->version =0 ; - sum_entry->ofs_in_node =0 ; - addr++; +list_for_each_entry_safe (page, tmp, &page_list, lru) { + +lock_page (page); +if (PageUptodate (page)) { + rn =F2FS_NODE (page); + sum_entry->nid = rn->footer.nid; + sum_entry->version =0 ; + sum_entry->ofs_in_node =0 ; + sum_entry++; + }else { + err = -EIO ; + } + +list_del (&page->lru); +unlock_page (page); +__free_pages (page,0 );fs/f2fs/node.c int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page) · line 1655
Quoted 10 lines
fs/f2fs/node.c +2
-4+ } } -unlock_page (page); -out: -__free_pages (page,0 ); -return 0 ; +return err; }static bool flush_nats_in_journal (struct f2fs_sb_info *sbi)--
Jaegeuk Kim
Samsung
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
--
Jaegeuk Kim
Samsung--
Jaegeuk Kim
Samsung
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Hi,
[snip]
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
So how about add all pages of page list to node_inode's address space by
add_to_page_cache_lru()with argsum_entry->nid?I don't think it's proper way to use
add_to_page_cache_lru()directly.This is the way used in VM readahead(i.e. read_pages/mpage_readpages/
read_cache_pages).
So what you worry about is that using lonelyadd_to_page_cache_lru()may cause exception, is it?
Right, what I meant was that, IMO, we should avoid copy and paste MM codes, but use its wrappers, exported symbols, as much as possible.
Quoted 24 lines
Quoted 19 lines
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
So how about writing
ra_node_pages()which use the node_inode's page cache?Quoted 8 lines
Quoted 2 lines
Hmm, so
ra_node_pagesis introduced for read node_inode's pages which are logical contiguously? and it also could take place ofra_node_page?Ah. The
ra_node_page()read a node page ahead for a given node id. So it doesn't match exactly betweenra_node_page()andra_node_pages()that I suggested.
So how about reading node pages and then caching some of them in the page cache, node_inode's address space?Quoted 5 lines
Got it,
If we do not use the method above, we should search the NAT for nid number as the index of node_inode's page by the specified node page blkaddr, that costs a lot.
How do you think?Quoted 4 lines
1.
grab_cache_page(node_footer->nid);
2.memcpy();
3.SetPageUptodate();
4.f2fs_put_page();
Quoted 8 lines
It could be.
This make
ra_node_pages()synchronized, because we should readnode_footer->nidfrom updated node page before we cache node pages, and we will still use page list to pass the updated page.Why not introduce
f2fs_cache_node_pages()include your code to cache node pages afterra_node_pages()?
Ok, right.
I'll test again and then merge this patch. :)
Signature · 2 lines
Jaegeuk Kim Samsung