linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <yuchao0@huawei.com>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH 4/4] f2fs: fix to spread clear_cold_data()
Date: Sun, 29 Jul 2018 10:19:26 +0800	[thread overview]
Message-ID: <b7d39e79-dfb0-17c3-1eee-6afb969008a4@kernel.org> (raw)
In-Reply-To: <20180729020013.GG83620@jaegeuk-macbookpro.roam.corp.google.com>

On 2018/7/29 10:00, Jaegeuk Kim wrote:
> On 07/27, Chao Yu wrote:
>> We need to drop PG_checked flag on page as well when we clear PG_uptodate
>> flag, in order to avoid treating the page as GCing one later.
> 
> What do you mean "treating the page as GCing one"?

I mean if PG_checked flag in page is not cleared, allocator will make it goes
into cold area.

static int __get_segment_type_6(struct f2fs_io_info *fio)
...
		if (is_cold_data(fio->page) || file_is_cold(inode))
			return CURSEG_COLD_DATA;

Thanks,

> 
>>
>> Signed-off-by: Weichao Guo <guoweichao@huawei.com>
>> Signed-off-by: Chao Yu <yuchao0@huawei.com>
>> ---
>>  fs/f2fs/data.c    | 8 +++++++-
>>  fs/f2fs/dir.c     | 1 +
>>  fs/f2fs/segment.c | 4 +++-
>>  3 files changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>> index a29f3162b887..2817e2f4eb17 100644
>> --- a/fs/f2fs/data.c
>> +++ b/fs/f2fs/data.c
>> @@ -1768,6 +1768,7 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio)
>>  	/* This page is already truncated */
>>  	if (fio->old_blkaddr == NULL_ADDR) {
>>  		ClearPageUptodate(page);
>> +		clear_cold_data(page);
>>  		goto out_writepage;
>>  	}
>>  got_it:
>> @@ -1943,8 +1944,10 @@ static int __write_data_page(struct page *page, bool *submitted,
>>  
>>  out:
>>  	inode_dec_dirty_pages(inode);
>> -	if (err)
>> +	if (err) {
>>  		ClearPageUptodate(page);
>> +		clear_cold_data(page);
>> +	}
>>  
>>  	if (wbc->for_reclaim) {
>>  		f2fs_submit_merged_write_cond(sbi, inode, 0, page->index, DATA);
>> @@ -2534,6 +2537,8 @@ void f2fs_invalidate_page(struct page *page, unsigned int offset,
>>  		}
>>  	}
>>  
>> +	clear_cold_data(page);
>> +
>>  	/* This is atomic written page, keep Private */
>>  	if (IS_ATOMIC_WRITTEN_PAGE(page))
>>  		return f2fs_drop_inmem_page(inode, page);
>> @@ -2552,6 +2557,7 @@ int f2fs_release_page(struct page *page, gfp_t wait)
>>  	if (IS_ATOMIC_WRITTEN_PAGE(page))
>>  		return 0;
>>  
>> +	clear_cold_data(page);
>>  	set_page_private(page, 0);
>>  	ClearPagePrivate(page);
>>  	return 1;
>> diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
>> index 7f955c4e86a4..1e4a4122eb0c 100644
>> --- a/fs/f2fs/dir.c
>> +++ b/fs/f2fs/dir.c
>> @@ -734,6 +734,7 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page,
>>  		clear_page_dirty_for_io(page);
>>  		ClearPagePrivate(page);
>>  		ClearPageUptodate(page);
>> +		clear_cold_data(page);
>>  		inode_dec_dirty_pages(dir);
>>  		f2fs_remove_dirty_inode(dir);
>>  	}
>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>> index 58abbdc53561..4d83961745e6 100644
>> --- a/fs/f2fs/segment.c
>> +++ b/fs/f2fs/segment.c
>> @@ -267,8 +267,10 @@ static int __revoke_inmem_pages(struct inode *inode,
>>  		}
>>  next:
>>  		/* we don't need to invalidate this in the sccessful status */
>> -		if (drop || recover)
>> +		if (drop || recover) {
>>  			ClearPageUptodate(page);
>> +			clear_cold_data(page);
>> +		}
>>  		set_page_private(page, 0);
>>  		ClearPagePrivate(page);
>>  		f2fs_put_page(page, 1);
>> -- 
>> 2.18.0.rc1

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

  reply	other threads:[~2018-07-29  2:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-27 10:15 [PATCH 1/4] f2fs: don't keep meta pages used for block migration Chao Yu
2018-07-27 10:15 ` [PATCH 2/4] f2fs: fix to active page in lru list for read path Chao Yu
2018-07-27 10:15 ` [PATCH 3/4] f2fs: fix avoid race between truncate and background GC Chao Yu
2018-07-29  1:58   ` Jaegeuk Kim
2018-07-29  6:02     ` Chao Yu
2018-07-29  6:13       ` Jaegeuk Kim
2018-07-29  6:16         ` Chao Yu
2018-07-27 10:15 ` [PATCH 4/4] f2fs: fix to spread clear_cold_data() Chao Yu
2018-07-29  2:00   ` Jaegeuk Kim
2018-07-29  2:19     ` Chao Yu [this message]
2018-07-29  2:44       ` Jaegeuk Kim
2018-07-29  3:19         ` Chao Yu

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=b7d39e79-dfb0-17c3-1eee-6afb969008a4@kernel.org \
    --to=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yuchao0@huawei.com \
    /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 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).