linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] f2fs: avoid __GFP_NOFAIL in f2fs_bio_alloc
@ 2020-02-18 10:21 Chao Yu
  2020-02-18 10:21 ` [PATCH 2/3] f2fs: fix to avoid triggering IO in write path Chao Yu
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Chao Yu @ 2020-02-18 10:21 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, chao, Chao Yu

__f2fs_bio_alloc() won't fail due to memory pool backend, remove unneeded
__GFP_NOFAIL flag in __f2fs_bio_alloc().

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fs/f2fs/data.c | 12 ++++--------
 fs/f2fs/f2fs.h |  2 +-
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index baf12318ec64..3a4ece26928c 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -54,17 +54,13 @@ static inline struct bio *__f2fs_bio_alloc(gfp_t gfp_mask,
 	return bio_alloc_bioset(gfp_mask, nr_iovecs, &f2fs_bioset);
 }
 
-struct bio *f2fs_bio_alloc(struct f2fs_sb_info *sbi, int npages, bool no_fail)
+struct bio *f2fs_bio_alloc(struct f2fs_sb_info *sbi, int npages, bool noio)
 {
-	struct bio *bio;
-
-	if (no_fail) {
+	if (noio) {
 		/* No failure on bio allocation */
-		bio = __f2fs_bio_alloc(GFP_NOIO, npages);
-		if (!bio)
-			bio = __f2fs_bio_alloc(GFP_NOIO | __GFP_NOFAIL, npages);
-		return bio;
+		return __f2fs_bio_alloc(GFP_NOIO, npages);
 	}
+
 	if (time_to_inject(sbi, FAULT_ALLOC_BIO)) {
 		f2fs_show_injection_info(sbi, FAULT_ALLOC_BIO);
 		return NULL;
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 5316ac3eacdf..65f569949d42 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -3343,7 +3343,7 @@ void f2fs_destroy_checkpoint_caches(void);
  */
 int __init f2fs_init_bioset(void);
 void f2fs_destroy_bioset(void);
-struct bio *f2fs_bio_alloc(struct f2fs_sb_info *sbi, int npages, bool no_fail);
+struct bio *f2fs_bio_alloc(struct f2fs_sb_info *sbi, int npages, bool noio);
 int f2fs_init_bio_entry_cache(void);
 void f2fs_destroy_bio_entry_cache(void);
 void f2fs_submit_bio(struct f2fs_sb_info *sbi,
-- 
2.18.0.rc1


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

* [PATCH 2/3] f2fs: fix to avoid triggering IO in write path
  2020-02-18 10:21 [PATCH 1/3] f2fs: avoid __GFP_NOFAIL in f2fs_bio_alloc Chao Yu
@ 2020-02-18 10:21 ` Chao Yu
  2020-02-18 10:21 ` [PATCH 3/3] f2fs: avoid unneeded barrier in do_checkpoint() Chao Yu
  2020-02-19  2:49 ` [PATCH 1/3] f2fs: avoid __GFP_NOFAIL in f2fs_bio_alloc Jaegeuk Kim
  2 siblings, 0 replies; 9+ messages in thread
From: Chao Yu @ 2020-02-18 10:21 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, chao, Chao Yu

If we are in write IO path, we need to avoid using GFP_KERNEL.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fs/f2fs/compress.c |  2 +-
 fs/f2fs/data.c     | 24 +++++++++++++-----------
 fs/f2fs/f2fs.h     |  2 +-
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
index b9ea531ffbb6..b1bc057ee266 100644
--- a/fs/f2fs/compress.c
+++ b/fs/f2fs/compress.c
@@ -653,7 +653,7 @@ static int prepare_compress_overwrite(struct compress_ctx *cc,
 		struct bio *bio = NULL;
 
 		ret = f2fs_read_multi_pages(cc, &bio, cc->cluster_size,
-						&last_block_in_bio, false);
+					&last_block_in_bio, false, true);
 		f2fs_destroy_compress_ctx(cc);
 		if (ret)
 			goto release_pages;
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 3a4ece26928c..716277d6be48 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -924,14 +924,15 @@ static inline bool f2fs_need_verity(const struct inode *inode, pgoff_t idx)
 
 static struct bio *f2fs_grab_read_bio(struct inode *inode, block_t blkaddr,
 				      unsigned nr_pages, unsigned op_flag,
-				      pgoff_t first_idx)
+				      pgoff_t first_idx, bool for_write)
 {
 	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
 	struct bio *bio;
 	struct bio_post_read_ctx *ctx;
 	unsigned int post_read_steps = 0;
 
-	bio = f2fs_bio_alloc(sbi, min_t(int, nr_pages, BIO_MAX_PAGES), false);
+	bio = f2fs_bio_alloc(sbi, min_t(int, nr_pages, BIO_MAX_PAGES),
+								for_write);
 	if (!bio)
 		return ERR_PTR(-ENOMEM);
 	f2fs_target_device(sbi, blkaddr, bio);
@@ -966,12 +967,12 @@ static void f2fs_release_read_bio(struct bio *bio)
 
 /* This can handle encryption stuffs */
 static int f2fs_submit_page_read(struct inode *inode, struct page *page,
-							block_t blkaddr)
+						block_t blkaddr, bool for_write)
 {
 	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
 	struct bio *bio;
 
-	bio = f2fs_grab_read_bio(inode, blkaddr, 1, 0, page->index);
+	bio = f2fs_grab_read_bio(inode, blkaddr, 1, 0, page->index, for_write);
 	if (IS_ERR(bio))
 		return PTR_ERR(bio);
 
@@ -1157,7 +1158,7 @@ struct page *f2fs_get_read_data_page(struct inode *inode, pgoff_t index,
 		return page;
 	}
 
-	err = f2fs_submit_page_read(inode, page, dn.data_blkaddr);
+	err = f2fs_submit_page_read(inode, page, dn.data_blkaddr, for_write);
 	if (err)
 		goto put_err;
 	return page;
@@ -1974,7 +1975,8 @@ static int f2fs_read_single_page(struct inode *inode, struct page *page,
 	}
 	if (bio == NULL) {
 		bio = f2fs_grab_read_bio(inode, block_nr, nr_pages,
-				is_readahead ? REQ_RAHEAD : 0, page->index);
+				is_readahead ? REQ_RAHEAD : 0, page->index,
+				false);
 		if (IS_ERR(bio)) {
 			ret = PTR_ERR(bio);
 			bio = NULL;
@@ -2009,7 +2011,7 @@ static int f2fs_read_single_page(struct inode *inode, struct page *page,
 #ifdef CONFIG_F2FS_FS_COMPRESSION
 int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret,
 				unsigned nr_pages, sector_t *last_block_in_bio,
-				bool is_readahead)
+				bool is_readahead, bool for_write)
 {
 	struct dnode_of_data dn;
 	struct inode *inode = cc->inode;
@@ -2103,7 +2105,7 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret,
 		if (!bio) {
 			bio = f2fs_grab_read_bio(inode, blkaddr, nr_pages,
 					is_readahead ? REQ_RAHEAD : 0,
-					page->index);
+					page->index, for_write);
 			if (IS_ERR(bio)) {
 				ret = PTR_ERR(bio);
 				bio = NULL;
@@ -2208,7 +2210,7 @@ int f2fs_mpage_readpages(struct address_space *mapping,
 				ret = f2fs_read_multi_pages(&cc, &bio,
 							max_nr_pages,
 							&last_block_in_bio,
-							is_readahead);
+							is_readahead, false);
 				f2fs_destroy_compress_ctx(&cc);
 				if (ret)
 					goto set_error_page;
@@ -2251,7 +2253,7 @@ int f2fs_mpage_readpages(struct address_space *mapping,
 				ret = f2fs_read_multi_pages(&cc, &bio,
 							max_nr_pages,
 							&last_block_in_bio,
-							is_readahead);
+							is_readahead, false);
 				f2fs_destroy_compress_ctx(&cc);
 			}
 		}
@@ -3291,7 +3293,7 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
 			err = -EFSCORRUPTED;
 			goto fail;
 		}
-		err = f2fs_submit_page_read(inode, page, blkaddr);
+		err = f2fs_submit_page_read(inode, page, blkaddr, true);
 		if (err)
 			goto fail;
 
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 65f569949d42..5d047c0bbbbb 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -3799,7 +3799,7 @@ int f2fs_write_multi_pages(struct compress_ctx *cc,
 int f2fs_is_compressed_cluster(struct inode *inode, pgoff_t index);
 int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret,
 				unsigned nr_pages, sector_t *last_block_in_bio,
-				bool is_readahead);
+				bool is_readahead, bool for_write);
 struct decompress_io_ctx *f2fs_alloc_dic(struct compress_ctx *cc);
 void f2fs_free_dic(struct decompress_io_ctx *dic);
 void f2fs_decompress_end_io(struct page **rpages,
-- 
2.18.0.rc1


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

* [PATCH 3/3] f2fs: avoid unneeded barrier in do_checkpoint()
  2020-02-18 10:21 [PATCH 1/3] f2fs: avoid __GFP_NOFAIL in f2fs_bio_alloc Chao Yu
  2020-02-18 10:21 ` [PATCH 2/3] f2fs: fix to avoid triggering IO in write path Chao Yu
@ 2020-02-18 10:21 ` Chao Yu
  2020-02-19  2:51   ` Jaegeuk Kim
  2020-02-19  2:49 ` [PATCH 1/3] f2fs: avoid __GFP_NOFAIL in f2fs_bio_alloc Jaegeuk Kim
  2 siblings, 1 reply; 9+ messages in thread
From: Chao Yu @ 2020-02-18 10:21 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, chao, Chao Yu

We don't need to wait all dirty page submitting IO twice,
remove unneeded wait step.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fs/f2fs/checkpoint.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 751815cb4c2b..9c88fb3d255a 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -1384,8 +1384,6 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 
 	/* Flush all the NAT/SIT pages */
 	f2fs_sync_meta_pages(sbi, META, LONG_MAX, FS_CP_META_IO);
-	/* Wait for all dirty meta pages to be submitted for IO */
-	f2fs_wait_on_all_pages(sbi, F2FS_DIRTY_META);
 
 	/*
 	 * modify checkpoint
-- 
2.18.0.rc1


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

* Re: [PATCH 1/3] f2fs: avoid __GFP_NOFAIL in f2fs_bio_alloc
  2020-02-18 10:21 [PATCH 1/3] f2fs: avoid __GFP_NOFAIL in f2fs_bio_alloc Chao Yu
  2020-02-18 10:21 ` [PATCH 2/3] f2fs: fix to avoid triggering IO in write path Chao Yu
  2020-02-18 10:21 ` [PATCH 3/3] f2fs: avoid unneeded barrier in do_checkpoint() Chao Yu
@ 2020-02-19  2:49 ` Jaegeuk Kim
  2020-02-19  3:12   ` Chao Yu
  2 siblings, 1 reply; 9+ messages in thread
From: Jaegeuk Kim @ 2020-02-19  2:49 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-f2fs-devel, linux-kernel, chao

On 02/18, Chao Yu wrote:
> __f2fs_bio_alloc() won't fail due to memory pool backend, remove unneeded
> __GFP_NOFAIL flag in __f2fs_bio_alloc().

It it safe for old kernels as well when thinking backports?

> 
> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> ---
>  fs/f2fs/data.c | 12 ++++--------
>  fs/f2fs/f2fs.h |  2 +-
>  2 files changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index baf12318ec64..3a4ece26928c 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -54,17 +54,13 @@ static inline struct bio *__f2fs_bio_alloc(gfp_t gfp_mask,
>  	return bio_alloc_bioset(gfp_mask, nr_iovecs, &f2fs_bioset);
>  }
>  
> -struct bio *f2fs_bio_alloc(struct f2fs_sb_info *sbi, int npages, bool no_fail)
> +struct bio *f2fs_bio_alloc(struct f2fs_sb_info *sbi, int npages, bool noio)
>  {
> -	struct bio *bio;
> -
> -	if (no_fail) {
> +	if (noio) {
>  		/* No failure on bio allocation */
> -		bio = __f2fs_bio_alloc(GFP_NOIO, npages);
> -		if (!bio)
> -			bio = __f2fs_bio_alloc(GFP_NOIO | __GFP_NOFAIL, npages);
> -		return bio;
> +		return __f2fs_bio_alloc(GFP_NOIO, npages);
>  	}
> +
>  	if (time_to_inject(sbi, FAULT_ALLOC_BIO)) {
>  		f2fs_show_injection_info(sbi, FAULT_ALLOC_BIO);
>  		return NULL;
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 5316ac3eacdf..65f569949d42 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -3343,7 +3343,7 @@ void f2fs_destroy_checkpoint_caches(void);
>   */
>  int __init f2fs_init_bioset(void);
>  void f2fs_destroy_bioset(void);
> -struct bio *f2fs_bio_alloc(struct f2fs_sb_info *sbi, int npages, bool no_fail);
> +struct bio *f2fs_bio_alloc(struct f2fs_sb_info *sbi, int npages, bool noio);
>  int f2fs_init_bio_entry_cache(void);
>  void f2fs_destroy_bio_entry_cache(void);
>  void f2fs_submit_bio(struct f2fs_sb_info *sbi,
> -- 
> 2.18.0.rc1

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

* Re: [PATCH 3/3] f2fs: avoid unneeded barrier in do_checkpoint()
  2020-02-18 10:21 ` [PATCH 3/3] f2fs: avoid unneeded barrier in do_checkpoint() Chao Yu
@ 2020-02-19  2:51   ` Jaegeuk Kim
  2020-02-19  3:18     ` Chao Yu
  0 siblings, 1 reply; 9+ messages in thread
From: Jaegeuk Kim @ 2020-02-19  2:51 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-f2fs-devel, linux-kernel, chao

On 02/18, Chao Yu wrote:
> We don't need to wait all dirty page submitting IO twice,
> remove unneeded wait step.

What happens if checkpoint and other meta writs are reordered?

> 
> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> ---
>  fs/f2fs/checkpoint.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
> index 751815cb4c2b..9c88fb3d255a 100644
> --- a/fs/f2fs/checkpoint.c
> +++ b/fs/f2fs/checkpoint.c
> @@ -1384,8 +1384,6 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
>  
>  	/* Flush all the NAT/SIT pages */
>  	f2fs_sync_meta_pages(sbi, META, LONG_MAX, FS_CP_META_IO);
> -	/* Wait for all dirty meta pages to be submitted for IO */
> -	f2fs_wait_on_all_pages(sbi, F2FS_DIRTY_META);
>  
>  	/*
>  	 * modify checkpoint
> -- 
> 2.18.0.rc1

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

* Re: [PATCH 1/3] f2fs: avoid __GFP_NOFAIL in f2fs_bio_alloc
  2020-02-19  2:49 ` [PATCH 1/3] f2fs: avoid __GFP_NOFAIL in f2fs_bio_alloc Jaegeuk Kim
@ 2020-02-19  3:12   ` Chao Yu
  0 siblings, 0 replies; 9+ messages in thread
From: Chao Yu @ 2020-02-19  3:12 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-f2fs-devel, linux-kernel, chao

On 2020/2/19 10:49, Jaegeuk Kim wrote:
> On 02/18, Chao Yu wrote:
>> __f2fs_bio_alloc() won't fail due to memory pool backend, remove unneeded
>> __GFP_NOFAIL flag in __f2fs_bio_alloc().
> 
> It it safe for old kernels as well when thinking backports?

^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  134)       struct bio *bio = mempool_alloc(bs->bio_pool, gfp_mask);

It looks if we have a backend mempool, we will never fail to allocate bio
for very long time, we don't need to backport to 2.6.x kernel, right?

Thanks,

> 
>>
>> Signed-off-by: Chao Yu <yuchao0@huawei.com>
>> ---
>>  fs/f2fs/data.c | 12 ++++--------
>>  fs/f2fs/f2fs.h |  2 +-
>>  2 files changed, 5 insertions(+), 9 deletions(-)
>>
>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>> index baf12318ec64..3a4ece26928c 100644
>> --- a/fs/f2fs/data.c
>> +++ b/fs/f2fs/data.c
>> @@ -54,17 +54,13 @@ static inline struct bio *__f2fs_bio_alloc(gfp_t gfp_mask,
>>  	return bio_alloc_bioset(gfp_mask, nr_iovecs, &f2fs_bioset);
>>  }
>>  
>> -struct bio *f2fs_bio_alloc(struct f2fs_sb_info *sbi, int npages, bool no_fail)
>> +struct bio *f2fs_bio_alloc(struct f2fs_sb_info *sbi, int npages, bool noio)
>>  {
>> -	struct bio *bio;
>> -
>> -	if (no_fail) {
>> +	if (noio) {
>>  		/* No failure on bio allocation */
>> -		bio = __f2fs_bio_alloc(GFP_NOIO, npages);
>> -		if (!bio)
>> -			bio = __f2fs_bio_alloc(GFP_NOIO | __GFP_NOFAIL, npages);
>> -		return bio;
>> +		return __f2fs_bio_alloc(GFP_NOIO, npages);
>>  	}
>> +
>>  	if (time_to_inject(sbi, FAULT_ALLOC_BIO)) {
>>  		f2fs_show_injection_info(sbi, FAULT_ALLOC_BIO);
>>  		return NULL;
>> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
>> index 5316ac3eacdf..65f569949d42 100644
>> --- a/fs/f2fs/f2fs.h
>> +++ b/fs/f2fs/f2fs.h
>> @@ -3343,7 +3343,7 @@ void f2fs_destroy_checkpoint_caches(void);
>>   */
>>  int __init f2fs_init_bioset(void);
>>  void f2fs_destroy_bioset(void);
>> -struct bio *f2fs_bio_alloc(struct f2fs_sb_info *sbi, int npages, bool no_fail);
>> +struct bio *f2fs_bio_alloc(struct f2fs_sb_info *sbi, int npages, bool noio);
>>  int f2fs_init_bio_entry_cache(void);
>>  void f2fs_destroy_bio_entry_cache(void);
>>  void f2fs_submit_bio(struct f2fs_sb_info *sbi,
>> -- 
>> 2.18.0.rc1
> .
> 

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

* Re: [PATCH 3/3] f2fs: avoid unneeded barrier in do_checkpoint()
  2020-02-19  2:51   ` Jaegeuk Kim
@ 2020-02-19  3:18     ` Chao Yu
  2020-02-24 22:00       ` Jaegeuk Kim
  0 siblings, 1 reply; 9+ messages in thread
From: Chao Yu @ 2020-02-19  3:18 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-f2fs-devel, linux-kernel, chao

On 2020/2/19 10:51, Jaegeuk Kim wrote:
> On 02/18, Chao Yu wrote:
>> We don't need to wait all dirty page submitting IO twice,
>> remove unneeded wait step.
> 
> What happens if checkpoint and other meta writs are reordered?

checkpoint can be done as following:

1. All meta except last cp-park of checkpoint area.
2. last cp-park of checkpoint area

So we only need to keep barrier in between step 1 and 2, we don't need
to care about the write order of meta in step 1, right?

Thanks,

> 
>>
>> Signed-off-by: Chao Yu <yuchao0@huawei.com>
>> ---
>>  fs/f2fs/checkpoint.c | 2 --
>>  1 file changed, 2 deletions(-)
>>
>> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
>> index 751815cb4c2b..9c88fb3d255a 100644
>> --- a/fs/f2fs/checkpoint.c
>> +++ b/fs/f2fs/checkpoint.c
>> @@ -1384,8 +1384,6 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
>>  
>>  	/* Flush all the NAT/SIT pages */
>>  	f2fs_sync_meta_pages(sbi, META, LONG_MAX, FS_CP_META_IO);
>> -	/* Wait for all dirty meta pages to be submitted for IO */
>> -	f2fs_wait_on_all_pages(sbi, F2FS_DIRTY_META);
>>  
>>  	/*
>>  	 * modify checkpoint
>> -- 
>> 2.18.0.rc1
> .
> 

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

* Re: [PATCH 3/3] f2fs: avoid unneeded barrier in do_checkpoint()
  2020-02-19  3:18     ` Chao Yu
@ 2020-02-24 22:00       ` Jaegeuk Kim
  2020-02-25  6:10         ` Chao Yu
  0 siblings, 1 reply; 9+ messages in thread
From: Jaegeuk Kim @ 2020-02-24 22:00 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-f2fs-devel, linux-kernel, chao

On 02/19, Chao Yu wrote:
> On 2020/2/19 10:51, Jaegeuk Kim wrote:
> > On 02/18, Chao Yu wrote:
> >> We don't need to wait all dirty page submitting IO twice,
> >> remove unneeded wait step.
> > 
> > What happens if checkpoint and other meta writs are reordered?
> 
> checkpoint can be done as following:
> 
> 1. All meta except last cp-park of checkpoint area.
> 2. last cp-park of checkpoint area
> 
> So we only need to keep barrier in between step 1 and 2, we don't need
> to care about the write order of meta in step 1, right?

Ah, let me integrate this patch into Sahitya's patch.

f2fs: fix the panic in do_checkpoint()

> 
> Thanks,
> 
> > 
> >>
> >> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> >> ---
> >>  fs/f2fs/checkpoint.c | 2 --
> >>  1 file changed, 2 deletions(-)
> >>
> >> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
> >> index 751815cb4c2b..9c88fb3d255a 100644
> >> --- a/fs/f2fs/checkpoint.c
> >> +++ b/fs/f2fs/checkpoint.c
> >> @@ -1384,8 +1384,6 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
> >>  
> >>  	/* Flush all the NAT/SIT pages */
> >>  	f2fs_sync_meta_pages(sbi, META, LONG_MAX, FS_CP_META_IO);
> >> -	/* Wait for all dirty meta pages to be submitted for IO */
> >> -	f2fs_wait_on_all_pages(sbi, F2FS_DIRTY_META);
> >>  
> >>  	/*
> >>  	 * modify checkpoint
> >> -- 
> >> 2.18.0.rc1
> > .
> > 

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

* Re: [PATCH 3/3] f2fs: avoid unneeded barrier in do_checkpoint()
  2020-02-24 22:00       ` Jaegeuk Kim
@ 2020-02-25  6:10         ` Chao Yu
  0 siblings, 0 replies; 9+ messages in thread
From: Chao Yu @ 2020-02-25  6:10 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-f2fs-devel, linux-kernel, chao

On 2020/2/25 6:00, Jaegeuk Kim wrote:
> On 02/19, Chao Yu wrote:
>> On 2020/2/19 10:51, Jaegeuk Kim wrote:
>>> On 02/18, Chao Yu wrote:
>>>> We don't need to wait all dirty page submitting IO twice,
>>>> remove unneeded wait step.
>>>
>>> What happens if checkpoint and other meta writs are reordered?
>>
>> checkpoint can be done as following:
>>
>> 1. All meta except last cp-park of checkpoint area.
>> 2. last cp-park of checkpoint area
>>
>> So we only need to keep barrier in between step 1 and 2, we don't need
>> to care about the write order of meta in step 1, right?
> 
> Ah, let me integrate this patch into Sahitya's patch.>
> f2fs: fix the panic in do_checkpoint()

No problem.

Thanks,

> 
>>
>> Thanks,
>>
>>>
>>>>
>>>> Signed-off-by: Chao Yu <yuchao0@huawei.com>
>>>> ---
>>>>  fs/f2fs/checkpoint.c | 2 --
>>>>  1 file changed, 2 deletions(-)
>>>>
>>>> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
>>>> index 751815cb4c2b..9c88fb3d255a 100644
>>>> --- a/fs/f2fs/checkpoint.c
>>>> +++ b/fs/f2fs/checkpoint.c
>>>> @@ -1384,8 +1384,6 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
>>>>  
>>>>  	/* Flush all the NAT/SIT pages */
>>>>  	f2fs_sync_meta_pages(sbi, META, LONG_MAX, FS_CP_META_IO);
>>>> -	/* Wait for all dirty meta pages to be submitted for IO */
>>>> -	f2fs_wait_on_all_pages(sbi, F2FS_DIRTY_META);
>>>>  
>>>>  	/*
>>>>  	 * modify checkpoint
>>>> -- 
>>>> 2.18.0.rc1
>>> .
>>>
> .
> 

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

end of thread, other threads:[~2020-02-25  6:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-18 10:21 [PATCH 1/3] f2fs: avoid __GFP_NOFAIL in f2fs_bio_alloc Chao Yu
2020-02-18 10:21 ` [PATCH 2/3] f2fs: fix to avoid triggering IO in write path Chao Yu
2020-02-18 10:21 ` [PATCH 3/3] f2fs: avoid unneeded barrier in do_checkpoint() Chao Yu
2020-02-19  2:51   ` Jaegeuk Kim
2020-02-19  3:18     ` Chao Yu
2020-02-24 22:00       ` Jaegeuk Kim
2020-02-25  6:10         ` Chao Yu
2020-02-19  2:49 ` [PATCH 1/3] f2fs: avoid __GFP_NOFAIL in f2fs_bio_alloc Jaegeuk Kim
2020-02-19  3:12   ` Chao Yu

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