All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Hyunchul Lee <hyc.lee@gmail.com>
Cc: Chao Yu <yuchao0@huawei.com>,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	kernel-team@lge.com, Jens Axboe <axboe@kernel.dk>,
	Hyunchul Lee <cheol.lee@lge.com>
Subject: Re: [PATCH 1/2] f2fs: pass down write hints to block layer for bufferd write
Date: Thu, 14 Dec 2017 13:18:31 -0800	[thread overview]
Message-ID: <20171214211831.GE35234@jaegeuk-macbookpro.roam.corp.google.com> (raw)
In-Reply-To: <5A2117C3.804@gmail.com>

Hello,

On 12/01, Hyunchul Lee wrote:
> Hi Jaegeuk,
> 
> On 12/01/2017 04:28 PM, Jaegeuk Kim wrote:
> > On 11/30, Chao Yu wrote:
> >> On 2017/11/28 8:23, Hyunchul Lee wrote:
> >>> From: Hyunchul Lee <cheol.lee@lge.com>
> >>>
> >>> This implements which hint is passed down to block layer
> >>> for datas from the specific segment type.
> >>>
> >>> segment type                     hints
> >>> ------------                     -----
> >>> COLD_NODE & COLD_DATA            WRITE_LIFE_EXTREME
> >>> WARM_DATA                        WRITE_LIFE_NONE
> >>> HOT_NODE & WARM_NODE             WRITE_LIFE_LONG
> >>> HOT_DATA                         WRITE_LIFE_MEDIUM
> >>> META_DATA                        WRITE_LIFE_SHORT
> >>
> >> The correspondence looks good to me.
> > 
> > Still, I don't fully get the point. Why do we have to assign WRITE_LIFE_NONE
> > to WARM_DATA? Why not using WRITE_LIFE_NOT_SET?
> > 
> 
> I think LIFE_NONE and LIFE_NOT_SET are the same. So I chose LIFE_NONE simply.

Same in what way?

WRITE_LIFE_NOT_SET = 0,
WRITE_LIFE_NONE = 1,

Still, you didn't answer why we have to assign LIFE_NONE to WARM_DATA?

Thanks,

> 
> Thanks.
> 
> >>>
> >>> Many thanks to Chao Yu and Jaegeuk Kim for comments to
> >>> implement this patch.
> >>>
> >>> Signed-off-by: Hyunchul Lee <cheol.lee@lge.com>
> >>> ---
> >>>  fs/f2fs/data.c    |  1 +
> >>>  fs/f2fs/f2fs.h    |  2 ++
> >>>  fs/f2fs/segment.c | 29 +++++++++++++++++++++++++++++
> >>>  fs/f2fs/super.c   |  2 ++
> >>>  4 files changed, 34 insertions(+)
> >>>
> >>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> >>> index a7ae418..0919a43 100644
> >>> --- a/fs/f2fs/data.c
> >>> +++ b/fs/f2fs/data.c
> >>> @@ -437,6 +437,7 @@ int f2fs_submit_page_write(struct f2fs_io_info *fio)
> >>>  		}
> >>>  		io->bio = __bio_alloc(sbi, fio->new_blkaddr,
> >>>  						BIO_MAX_PAGES, false);
> >>> +		io->bio->bi_write_hint = io->write_hint;
> >>
> >> Need to assign bi_write_hint for IPU path?
> >>
> >> - rewrite_data_page
> >>  - f2fs_submit_page_bio
> >>
> >>>  		io->fio = *fio;
> >>>  	}
> >>>  
> >>> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> >>> index 7bcd148..be3cb0c 100644
> >>> --- a/fs/f2fs/f2fs.h
> >>> +++ b/fs/f2fs/f2fs.h
> >>> @@ -969,6 +969,7 @@ struct f2fs_bio_info {
> >>>  	struct rw_semaphore io_rwsem;	/* blocking op for bio */
> >>>  	spinlock_t io_lock;		/* serialize DATA/NODE IOs */
> >>>  	struct list_head io_list;	/* track fios */
> >>> +	enum rw_hint write_hint;
> >>
> >> Add missing comment?
> >>
> >>>  };
> >>>  
> >>>  #define FDEV(i)				(sbi->devs[i])
> >>> @@ -2674,6 +2675,7 @@ int lookup_journal_in_cursum(struct f2fs_journal *journal, int type,
> >>>  int __init create_segment_manager_caches(void);
> >>>  void destroy_segment_manager_caches(void);
> >>>  int rw_hint_to_seg_type(enum rw_hint hint);
> >>> +enum rw_hint io_type_to_rw_hint(enum page_type page, enum temp_type temp);
> >>>  
> >>>  /*
> >>>   * checkpoint.c
> >>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> >>> index c117e09..0570db7 100644
> >>> --- a/fs/f2fs/segment.c
> >>> +++ b/fs/f2fs/segment.c
> >>> @@ -2446,6 +2446,35 @@ int rw_hint_to_seg_type(enum rw_hint hint)
> >>>  	}
> >>>  }
> >>>  
> >>
> >> It will be better to copy commit log here to declare correspondence
> >> more clearly.
> >>
> >> Thanks,
> >>
> >>> +enum rw_hint io_type_to_rw_hint(enum page_type page, enum temp_type temp)
> >>> +{
> >>> +	if (page == DATA) {
> >>> +		switch (temp) {
> >>> +		case WARM:
> >>> +			return WRITE_LIFE_NONE;
> >>> +		case COLD:
> >>> +			return WRITE_LIFE_EXTREME;
> >>> +		case HOT:
> >>> +			return WRITE_LIFE_MEDIUM;
> >>> +		default:
> >>> +			return WRITE_LIFE_NOT_SET;
> >>> +		}
> >>> +	} else if (page == NODE) {
> >>> +		switch (temp) {
> >>> +		case WARM:
> >>> +		case HOT:
> >>> +			return WRITE_LIFE_LONG;
> >>> +		case COLD:
> >>> +			return WRITE_LIFE_EXTREME;
> >>> +		default:
> >>> +			return WRITE_LIFE_NOT_SET;
> >>> +		}
> >>> +
> >>> +	} else {
> >>> +		return WRITE_LIFE_SHORT;
> >>> +	}
> >>> +}
> >>> +
> >>>  static int __get_segment_type_2(struct f2fs_io_info *fio)
> >>>  {
> >>>  	if (fio->type == DATA)
> >>> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> >>> index a6c5dd4..51c19a0 100644
> >>> --- a/fs/f2fs/super.c
> >>> +++ b/fs/f2fs/super.c
> >>> @@ -2508,6 +2508,8 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
> >>>  			sbi->write_io[i][j].bio = NULL;
> >>>  			spin_lock_init(&sbi->write_io[i][j].io_lock);
> >>>  			INIT_LIST_HEAD(&sbi->write_io[i][j].io_list);
> >>> +			sbi->write_io[i][j].write_hint =
> >>> +						io_type_to_rw_hint(i, j);
> >>>  		}
> >>>  	}
> >>>  
> >>>
> > 

  reply	other threads:[~2017-12-14 21:18 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-28  0:23 [PATCH 1/2] f2fs: pass down write hints to block layer for bufferd write Hyunchul Lee
2017-11-28  0:23 ` Hyunchul Lee
2017-11-28  0:23 ` [PATCH 2/2] f2fs: pass down write hints to block layer for direct write Hyunchul Lee
2017-11-30  6:32 ` [PATCH 1/2] f2fs: pass down write hints to block layer for bufferd write Chao Yu
2017-11-30  6:32   ` Chao Yu
2017-12-01  7:28   ` Jaegeuk Kim
2017-12-01  7:28     ` Jaegeuk Kim
2017-12-01  8:50     ` Hyunchul Lee
2017-12-14 21:18       ` Jaegeuk Kim [this message]
2017-11-30  7:06 ` Chao Yu
2017-11-30  7:06   ` Chao Yu
2017-12-01  8:28   ` Hyunchul Lee
2017-12-01  8:28     ` Hyunchul Lee
2017-12-11 13:15     ` [f2fs-dev] " Chao Yu
2017-12-12  2:15       ` Hyunchul Lee
2017-12-12  2:15         ` Hyunchul Lee
2017-12-12  2:45         ` [f2fs-dev] " Chao Yu
2017-12-12  2:45           ` Chao Yu
2017-12-14  1:33           ` Hyunchul Lee
2017-12-15  2:06             ` Jaegeuk Kim
2017-12-18  7:28               ` Hyunchul Lee
2017-12-18  7:28                 ` Hyunchul Lee
2017-12-23  9:44               ` [f2fs-dev] " Chao Yu
2017-12-23  9:44                 ` Chao Yu
2017-12-28  3:26                 ` [f2fs-dev] " Jaegeuk Kim
2017-12-28  3:26                   ` Jaegeuk Kim
2017-12-28  5:05                   ` [f2fs-dev] " Hyunchul Lee
2017-12-28  5:05                     ` Hyunchul Lee
2017-12-28 16:32                     ` [f2fs-dev] " Jaegeuk Kim

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=20171214211831.GE35234@jaegeuk-macbookpro.roam.corp.google.com \
    --to=jaegeuk@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=cheol.lee@lge.com \
    --cc=hyc.lee@gmail.com \
    --cc=kernel-team@lge.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --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 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.