All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] f2fs: put allocate_segment after refresh_sit_entry
@ 2017-02-21  8:59 ` Yunlong Song
  0 siblings, 0 replies; 4+ messages in thread
From: Yunlong Song @ 2017-02-21  8:59 UTC (permalink / raw)
  To: jaegeuk, cm224.lee, yuchao0, chao, sylinux, yunlong.song, miaoxie
  Cc: bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel

SIT information should be updated before segment allocation, since SSR needs
latest valid block information. Current code does not update the old_blkaddr
info in sit_entry, so adjust the allocate_segment to its proper location. Commit
5e443818fa0b2a2845561ee25bec181424fb2889 ("f2fs: handle dirty segments inside
refresh_sit_entry") puts it into wrong location.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
---
 fs/f2fs/segment.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index df2ff5c..89052df 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1743,14 +1743,15 @@ void allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
 
 	stat_inc_block_count(sbi, curseg);
 
-	if (!__has_curseg_space(sbi, type))
-		sit_i->s_ops->allocate_segment(sbi, type, false);
 	/*
 	 * SIT information should be updated before segment allocation,
 	 * since SSR needs latest valid block information.
 	 */
 	refresh_sit_entry(sbi, old_blkaddr, *new_blkaddr);
 
+	if (!__has_curseg_space(sbi, type))
+		sit_i->s_ops->allocate_segment(sbi, type, false);
+
 	mutex_unlock(&sit_i->sentry_lock);
 
 	if (page && IS_NODESEG(type))
-- 
1.8.5.2

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

* [PATCH] f2fs: put allocate_segment after refresh_sit_entry
@ 2017-02-21  8:59 ` Yunlong Song
  0 siblings, 0 replies; 4+ messages in thread
From: Yunlong Song @ 2017-02-21  8:59 UTC (permalink / raw)
  To: jaegeuk, cm224.lee, yuchao0, chao, sylinux, yunlong.song, miaoxie
  Cc: bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel

SIT information should be updated before segment allocation, since SSR needs
latest valid block information. Current code does not update the old_blkaddr
info in sit_entry, so adjust the allocate_segment to its proper location. Commit
5e443818fa0b2a2845561ee25bec181424fb2889 ("f2fs: handle dirty segments inside
refresh_sit_entry") puts it into wrong location.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
---
 fs/f2fs/segment.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index df2ff5c..89052df 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1743,14 +1743,15 @@ void allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
 
 	stat_inc_block_count(sbi, curseg);
 
-	if (!__has_curseg_space(sbi, type))
-		sit_i->s_ops->allocate_segment(sbi, type, false);
 	/*
 	 * SIT information should be updated before segment allocation,
 	 * since SSR needs latest valid block information.
 	 */
 	refresh_sit_entry(sbi, old_blkaddr, *new_blkaddr);
 
+	if (!__has_curseg_space(sbi, type))
+		sit_i->s_ops->allocate_segment(sbi, type, false);
+
 	mutex_unlock(&sit_i->sentry_lock);
 
 	if (page && IS_NODESEG(type))
-- 
1.8.5.2

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

* Re: [PATCH] f2fs: put allocate_segment after refresh_sit_entry
  2017-02-21  8:59 ` Yunlong Song
@ 2017-02-24  1:33   ` Chao Yu
  -1 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2017-02-24  1:33 UTC (permalink / raw)
  To: Yunlong Song, jaegeuk, cm224.lee, chao, sylinux, miaoxie
  Cc: bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel

On 2017/2/21 16:59, Yunlong Song wrote:
> SIT information should be updated before segment allocation, since SSR needs
> latest valid block information. Current code does not update the old_blkaddr
> info in sit_entry, so adjust the allocate_segment to its proper location. Commit
> 5e443818fa0b2a2845561ee25bec181424fb2889 ("f2fs: handle dirty segments inside
> refresh_sit_entry") puts it into wrong location.

Not a big deal, because we only count invalid block which has been checkpointed,
so current order won't change the result of allocation with SSR.

Anyway, it's OK to me. :)

Reviewed-by: Chao Yu <yuchao0@huawei.com>

> 
> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
> ---
>  fs/f2fs/segment.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index df2ff5c..89052df 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -1743,14 +1743,15 @@ void allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
>  
>  	stat_inc_block_count(sbi, curseg);
>  
> -	if (!__has_curseg_space(sbi, type))
> -		sit_i->s_ops->allocate_segment(sbi, type, false);
>  	/*
>  	 * SIT information should be updated before segment allocation,
>  	 * since SSR needs latest valid block information.
>  	 */
>  	refresh_sit_entry(sbi, old_blkaddr, *new_blkaddr);
>  
> +	if (!__has_curseg_space(sbi, type))
> +		sit_i->s_ops->allocate_segment(sbi, type, false);
> +
>  	mutex_unlock(&sit_i->sentry_lock);
>  
>  	if (page && IS_NODESEG(type))
> 

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

* Re: [PATCH] f2fs: put allocate_segment after refresh_sit_entry
@ 2017-02-24  1:33   ` Chao Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2017-02-24  1:33 UTC (permalink / raw)
  To: Yunlong Song, jaegeuk, cm224.lee, chao, sylinux, miaoxie
  Cc: bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel

On 2017/2/21 16:59, Yunlong Song wrote:
> SIT information should be updated before segment allocation, since SSR needs
> latest valid block information. Current code does not update the old_blkaddr
> info in sit_entry, so adjust the allocate_segment to its proper location. Commit
> 5e443818fa0b2a2845561ee25bec181424fb2889 ("f2fs: handle dirty segments inside
> refresh_sit_entry") puts it into wrong location.

Not a big deal, because we only count invalid block which has been checkpointed,
so current order won't change the result of allocation with SSR.

Anyway, it's OK to me. :)

Reviewed-by: Chao Yu <yuchao0@huawei.com>

> 
> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
> ---
>  fs/f2fs/segment.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index df2ff5c..89052df 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -1743,14 +1743,15 @@ void allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
>  
>  	stat_inc_block_count(sbi, curseg);
>  
> -	if (!__has_curseg_space(sbi, type))
> -		sit_i->s_ops->allocate_segment(sbi, type, false);
>  	/*
>  	 * SIT information should be updated before segment allocation,
>  	 * since SSR needs latest valid block information.
>  	 */
>  	refresh_sit_entry(sbi, old_blkaddr, *new_blkaddr);
>  
> +	if (!__has_curseg_space(sbi, type))
> +		sit_i->s_ops->allocate_segment(sbi, type, false);
> +
>  	mutex_unlock(&sit_i->sentry_lock);
>  
>  	if (page && IS_NODESEG(type))
> 

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

end of thread, other threads:[~2017-02-24  1:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-21  8:59 [PATCH] f2fs: put allocate_segment after refresh_sit_entry Yunlong Song
2017-02-21  8:59 ` Yunlong Song
2017-02-24  1:33 ` Chao Yu
2017-02-24  1:33   ` Chao Yu

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.