All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 1/9] f2fs: convert f2fs_compress_ctx_add_page() to use folio
Date: Wed, 14 Aug 2024 11:17:03 +0800	[thread overview]
Message-ID: <cb4e93f9-1a60-4f98-9690-263fbbe7a99e@kernel.org> (raw)
In-Reply-To: <ZrvdD6EVJAik1b5w@google.com>

On 2024/8/14 6:24, Jaegeuk Kim wrote:
> Could you please test this series? I hit kernel hang along with refcount warning
> in f2fs_put_dic, when running fsstress. You can reproduce it quickly.

---
  fs/f2fs/data.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 9e21cfe11cc7..4f4e76c33611 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2322,7 +2322,7 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret,
  			}
  		}

-		if (bio_add_folio(bio, folio, blocksize, 0) < blocksize)
+		if (!bio_add_folio(bio, folio, blocksize, 0))
  			goto submit_and_realloc;

  		ctx = get_post_read_ctx(bio);
-- 
2.40.1

After applying this, it doesn't complain now.

Thanks,

> 
> On 08/13, Chao Yu wrote:
>> onvert to use folio, so that we can get rid of 'page->index' to
>> prepare for removal of 'index' field in structure page [1].
>>
>> [1] https://lore.kernel.org/all/Zp8fgUSIBGQ1TN0D@casper.infradead.org/
>>
>> Cc: Matthew Wilcox <willy@infradead.org>
>> Signed-off-by: Chao Yu <chao@kernel.org>
>> ---
>>   fs/f2fs/compress.c | 14 +++++++-------
>>   fs/f2fs/data.c     |  4 ++--
>>   fs/f2fs/f2fs.h     |  2 +-
>>   3 files changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
>> index 990b93689b46..eb5cd1457ffc 100644
>> --- a/fs/f2fs/compress.c
>> +++ b/fs/f2fs/compress.c
>> @@ -160,17 +160,17 @@ void f2fs_destroy_compress_ctx(struct compress_ctx *cc, bool reuse)
>>   		cc->cluster_idx = NULL_CLUSTER;
>>   }
>>   
>> -void f2fs_compress_ctx_add_page(struct compress_ctx *cc, struct page *page)
>> +void f2fs_compress_ctx_add_page(struct compress_ctx *cc, struct folio *folio)
>>   {
>>   	unsigned int cluster_ofs;
>>   
>> -	if (!f2fs_cluster_can_merge_page(cc, page->index))
>> +	if (!f2fs_cluster_can_merge_page(cc, folio->index))
>>   		f2fs_bug_on(F2FS_I_SB(cc->inode), 1);
>>   
>> -	cluster_ofs = offset_in_cluster(cc, page->index);
>> -	cc->rpages[cluster_ofs] = page;
>> +	cluster_ofs = offset_in_cluster(cc, folio->index);
>> +	cc->rpages[cluster_ofs] = folio_page(folio, 0);
>>   	cc->nr_rpages++;
>> -	cc->cluster_idx = cluster_idx(cc, page->index);
>> +	cc->cluster_idx = cluster_idx(cc, folio->index);
>>   }
>>   
>>   #ifdef CONFIG_F2FS_FS_LZO
>> @@ -1093,7 +1093,7 @@ static int prepare_compress_overwrite(struct compress_ctx *cc,
>>   		if (PageUptodate(page))
>>   			f2fs_put_page(page, 1);
>>   		else
>> -			f2fs_compress_ctx_add_page(cc, page);
>> +			f2fs_compress_ctx_add_page(cc, page_folio(page));
>>   	}
>>   
>>   	if (!f2fs_cluster_is_empty(cc)) {
>> @@ -1123,7 +1123,7 @@ static int prepare_compress_overwrite(struct compress_ctx *cc,
>>   		}
>>   
>>   		f2fs_wait_on_page_writeback(page, DATA, true, true);
>> -		f2fs_compress_ctx_add_page(cc, page);
>> +		f2fs_compress_ctx_add_page(cc, page_folio(page));
>>   
>>   		if (!PageUptodate(page)) {
>>   release_and_retry:
>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>> index e9570f4e0f21..100b6526717f 100644
>> --- a/fs/f2fs/data.c
>> +++ b/fs/f2fs/data.c
>> @@ -2429,7 +2429,7 @@ static int f2fs_mpage_readpages(struct inode *inode,
>>   		if (ret)
>>   			goto set_error_page;
>>   
>> -		f2fs_compress_ctx_add_page(&cc, &folio->page);
>> +		f2fs_compress_ctx_add_page(&cc, folio);
>>   
>>   		goto next_page;
>>   read_single_page:
>> @@ -3161,7 +3161,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
>>   #ifdef CONFIG_F2FS_FS_COMPRESSION
>>   			if (f2fs_compressed_file(inode)) {
>>   				folio_get(folio);
>> -				f2fs_compress_ctx_add_page(&cc, &folio->page);
>> +				f2fs_compress_ctx_add_page(&cc, folio);
>>   				continue;
>>   			}
>>   #endif
>> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
>> index 51fd5063a69c..df436dd3aac1 100644
>> --- a/fs/f2fs/f2fs.h
>> +++ b/fs/f2fs/f2fs.h
>> @@ -4322,7 +4322,7 @@ bool f2fs_cluster_can_merge_page(struct compress_ctx *cc, pgoff_t index);
>>   bool f2fs_all_cluster_page_ready(struct compress_ctx *cc, struct page **pages,
>>   				int index, int nr_pages, bool uptodate);
>>   bool f2fs_sanity_check_cluster(struct dnode_of_data *dn);
>> -void f2fs_compress_ctx_add_page(struct compress_ctx *cc, struct page *page);
>> +void f2fs_compress_ctx_add_page(struct compress_ctx *cc, struct folio *folio);
>>   int f2fs_write_multi_pages(struct compress_ctx *cc,
>>   						int *submitted,
>>   						struct writeback_control *wbc,
>> -- 
>> 2.40.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

WARNING: multiple messages have this Message-ID (diff)
From: Chao Yu <chao@kernel.org>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/9] f2fs: convert f2fs_compress_ctx_add_page() to use folio
Date: Wed, 14 Aug 2024 11:17:03 +0800	[thread overview]
Message-ID: <cb4e93f9-1a60-4f98-9690-263fbbe7a99e@kernel.org> (raw)
In-Reply-To: <ZrvdD6EVJAik1b5w@google.com>

On 2024/8/14 6:24, Jaegeuk Kim wrote:
> Could you please test this series? I hit kernel hang along with refcount warning
> in f2fs_put_dic, when running fsstress. You can reproduce it quickly.

---
  fs/f2fs/data.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 9e21cfe11cc7..4f4e76c33611 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2322,7 +2322,7 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret,
  			}
  		}

-		if (bio_add_folio(bio, folio, blocksize, 0) < blocksize)
+		if (!bio_add_folio(bio, folio, blocksize, 0))
  			goto submit_and_realloc;

  		ctx = get_post_read_ctx(bio);
-- 
2.40.1

After applying this, it doesn't complain now.

Thanks,

> 
> On 08/13, Chao Yu wrote:
>> onvert to use folio, so that we can get rid of 'page->index' to
>> prepare for removal of 'index' field in structure page [1].
>>
>> [1] https://lore.kernel.org/all/Zp8fgUSIBGQ1TN0D@casper.infradead.org/
>>
>> Cc: Matthew Wilcox <willy@infradead.org>
>> Signed-off-by: Chao Yu <chao@kernel.org>
>> ---
>>   fs/f2fs/compress.c | 14 +++++++-------
>>   fs/f2fs/data.c     |  4 ++--
>>   fs/f2fs/f2fs.h     |  2 +-
>>   3 files changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
>> index 990b93689b46..eb5cd1457ffc 100644
>> --- a/fs/f2fs/compress.c
>> +++ b/fs/f2fs/compress.c
>> @@ -160,17 +160,17 @@ void f2fs_destroy_compress_ctx(struct compress_ctx *cc, bool reuse)
>>   		cc->cluster_idx = NULL_CLUSTER;
>>   }
>>   
>> -void f2fs_compress_ctx_add_page(struct compress_ctx *cc, struct page *page)
>> +void f2fs_compress_ctx_add_page(struct compress_ctx *cc, struct folio *folio)
>>   {
>>   	unsigned int cluster_ofs;
>>   
>> -	if (!f2fs_cluster_can_merge_page(cc, page->index))
>> +	if (!f2fs_cluster_can_merge_page(cc, folio->index))
>>   		f2fs_bug_on(F2FS_I_SB(cc->inode), 1);
>>   
>> -	cluster_ofs = offset_in_cluster(cc, page->index);
>> -	cc->rpages[cluster_ofs] = page;
>> +	cluster_ofs = offset_in_cluster(cc, folio->index);
>> +	cc->rpages[cluster_ofs] = folio_page(folio, 0);
>>   	cc->nr_rpages++;
>> -	cc->cluster_idx = cluster_idx(cc, page->index);
>> +	cc->cluster_idx = cluster_idx(cc, folio->index);
>>   }
>>   
>>   #ifdef CONFIG_F2FS_FS_LZO
>> @@ -1093,7 +1093,7 @@ static int prepare_compress_overwrite(struct compress_ctx *cc,
>>   		if (PageUptodate(page))
>>   			f2fs_put_page(page, 1);
>>   		else
>> -			f2fs_compress_ctx_add_page(cc, page);
>> +			f2fs_compress_ctx_add_page(cc, page_folio(page));
>>   	}
>>   
>>   	if (!f2fs_cluster_is_empty(cc)) {
>> @@ -1123,7 +1123,7 @@ static int prepare_compress_overwrite(struct compress_ctx *cc,
>>   		}
>>   
>>   		f2fs_wait_on_page_writeback(page, DATA, true, true);
>> -		f2fs_compress_ctx_add_page(cc, page);
>> +		f2fs_compress_ctx_add_page(cc, page_folio(page));
>>   
>>   		if (!PageUptodate(page)) {
>>   release_and_retry:
>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>> index e9570f4e0f21..100b6526717f 100644
>> --- a/fs/f2fs/data.c
>> +++ b/fs/f2fs/data.c
>> @@ -2429,7 +2429,7 @@ static int f2fs_mpage_readpages(struct inode *inode,
>>   		if (ret)
>>   			goto set_error_page;
>>   
>> -		f2fs_compress_ctx_add_page(&cc, &folio->page);
>> +		f2fs_compress_ctx_add_page(&cc, folio);
>>   
>>   		goto next_page;
>>   read_single_page:
>> @@ -3161,7 +3161,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
>>   #ifdef CONFIG_F2FS_FS_COMPRESSION
>>   			if (f2fs_compressed_file(inode)) {
>>   				folio_get(folio);
>> -				f2fs_compress_ctx_add_page(&cc, &folio->page);
>> +				f2fs_compress_ctx_add_page(&cc, folio);
>>   				continue;
>>   			}
>>   #endif
>> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
>> index 51fd5063a69c..df436dd3aac1 100644
>> --- a/fs/f2fs/f2fs.h
>> +++ b/fs/f2fs/f2fs.h
>> @@ -4322,7 +4322,7 @@ bool f2fs_cluster_can_merge_page(struct compress_ctx *cc, pgoff_t index);
>>   bool f2fs_all_cluster_page_ready(struct compress_ctx *cc, struct page **pages,
>>   				int index, int nr_pages, bool uptodate);
>>   bool f2fs_sanity_check_cluster(struct dnode_of_data *dn);
>> -void f2fs_compress_ctx_add_page(struct compress_ctx *cc, struct page *page);
>> +void f2fs_compress_ctx_add_page(struct compress_ctx *cc, struct folio *folio);
>>   int f2fs_write_multi_pages(struct compress_ctx *cc,
>>   						int *submitted,
>>   						struct writeback_control *wbc,
>> -- 
>> 2.40.1


  parent reply	other threads:[~2024-08-14  3:17 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-13 14:13 [f2fs-dev] [PATCH 1/9] f2fs: convert f2fs_compress_ctx_add_page() to use folio Chao Yu
2024-08-13 14:13 ` Chao Yu
2024-08-13 14:13 ` [f2fs-dev] [PATCH 2/9] f2fs: convert f2fs_vm_page_mkwrite() " Chao Yu
2024-08-13 14:13   ` Chao Yu
2024-08-13 14:13 ` [f2fs-dev] [PATCH 3/9] f2fs: convert f2fs_clear_page_cache_dirty_tag() " Chao Yu
2024-08-13 14:13   ` Chao Yu
2024-08-13 14:13 ` [f2fs-dev] [PATCH 4/9] f2fs: convert f2fs_write_inline_data() " Chao Yu
2024-08-13 14:13   ` Chao Yu
2024-08-13 14:13 ` [f2fs-dev] [PATCH 5/9] f2fs: convert f2fs_write_single_data_page() " Chao Yu
2024-08-13 14:13   ` Chao Yu
2024-08-13 14:13 ` [f2fs-dev] [PATCH 6/9] f2fs: convert f2fs_do_write_meta_page() " Chao Yu
2024-08-13 14:13   ` Chao Yu
2024-08-13 14:13 ` [f2fs-dev] [PATCH 7/9] f2fs: convert __f2fs_write_meta_page() " Chao Yu
2024-08-13 14:13   ` Chao Yu
2024-08-13 14:13 ` [f2fs-dev] [PATCH 8/9] f2fs: convert f2fs_read_multi_pages() " Chao Yu
2024-08-13 14:13   ` Chao Yu
2024-08-13 14:13 ` [f2fs-dev] [PATCH 9/9] f2fs: convert f2fs_handle_page_eio() " Chao Yu
2024-08-13 14:13   ` Chao Yu
2024-08-13 22:24 ` [f2fs-dev] [PATCH 1/9] f2fs: convert f2fs_compress_ctx_add_page() " Jaegeuk Kim
2024-08-13 22:24   ` Jaegeuk Kim
2024-08-14  0:58   ` [f2fs-dev] " Chao Yu
2024-08-14  0:58     ` Chao Yu
2024-08-14  3:17   ` Chao Yu [this message]
2024-08-14  3:17     ` Chao Yu
2024-08-30 20:51 ` [f2fs-dev] " patchwork-bot+f2fs--- via Linux-f2fs-devel
2024-08-30 20:51   ` patchwork-bot+f2fs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb4e93f9-1a60-4f98-9690-263fbbe7a99e@kernel.org \
    --to=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.