Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1693365 > unrolled thread
| Started by | Chao Yu <yuchao0@huawei.com> |
|---|---|
| First post | 2017-07-21 05:40 +0200 |
| Last post | 2017-07-22 02:50 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] f2fs: let background GC being aware of freezing Chao Yu <yuchao0@huawei.com> - 2017-07-21 05:40 +0200
Re: [PATCH] f2fs: let background GC being aware of freezing Jaegeuk Kim <jaegeuk@kernel.org> - 2017-07-21 23:00 +0200
Re: [PATCH] f2fs: let background GC being aware of freezing Chao Yu <chao@kernel.org> - 2017-07-22 02:50 +0200
| From | Chao Yu <yuchao0@huawei.com> |
|---|---|
| Date | 2017-07-21 05:40 +0200 |
| Subject | [PATCH] f2fs: let background GC being aware of freezing |
| Message-ID | <u5wXg-7XN-3@gated-at.bofh.it> |
When ->freeze_fs is called from lvm for doing snapshot, it needs to
make sure there will be no more changes in filesystem's data, however,
previously, background GC wasn't aware of freezing, so in environment
with active background GC thread, data of snapshot becomes unstable.
This patch fixes this issue by adding sb_{start,end}_intwrite in GC
flow.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
fs/f2fs/gc.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 76ad2c3d88db..1c0117f60083 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -55,6 +55,8 @@ static int gc_thread_func(void *data)
}
#endif
+ sb_start_intwrite(sbi->sb);
+
/*
* [GC triggering condition]
* 0. GC is not conducted currently.
@@ -69,12 +71,12 @@ static int gc_thread_func(void *data)
* So, I'd like to wait some time to collect dirty segments.
*/
if (!mutex_trylock(&sbi->gc_mutex))
- continue;
+ goto next;
if (!is_idle(sbi)) {
increase_sleep_time(gc_th, &wait_ms);
mutex_unlock(&sbi->gc_mutex);
- continue;
+ goto next;
}
if (has_enough_invalid_blocks(sbi))
@@ -93,6 +95,8 @@ static int gc_thread_func(void *data)
/* balancing f2fs's metadata periodically */
f2fs_balance_fs_bg(sbi);
+next:
+ sb_end_intwrite(sbi->sb);
} while (!kthread_should_stop());
return 0;
--
2.13.1.388.g69e6b9b4f4a9
[toc] | [next] | [standalone]
| From | Jaegeuk Kim <jaegeuk@kernel.org> |
|---|---|
| Date | 2017-07-21 23:00 +0200 |
| Message-ID | <u5NbI-18q-37@gated-at.bofh.it> |
| In reply to | #1693365 |
Hi Chao,
On 07/21, Chao Yu wrote:
> When ->freeze_fs is called from lvm for doing snapshot, it needs to
> make sure there will be no more changes in filesystem's data, however,
> previously, background GC wasn't aware of freezing, so in environment
> with active background GC thread, data of snapshot becomes unstable.
What about flush/discard threads?
Thanks,
>
> This patch fixes this issue by adding sb_{start,end}_intwrite in GC
> flow.
>
> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> ---
> fs/f2fs/gc.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index 76ad2c3d88db..1c0117f60083 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -55,6 +55,8 @@ static int gc_thread_func(void *data)
> }
> #endif
>
> + sb_start_intwrite(sbi->sb);
> +
> /*
> * [GC triggering condition]
> * 0. GC is not conducted currently.
> @@ -69,12 +71,12 @@ static int gc_thread_func(void *data)
> * So, I'd like to wait some time to collect dirty segments.
> */
> if (!mutex_trylock(&sbi->gc_mutex))
> - continue;
> + goto next;
>
> if (!is_idle(sbi)) {
> increase_sleep_time(gc_th, &wait_ms);
> mutex_unlock(&sbi->gc_mutex);
> - continue;
> + goto next;
> }
>
> if (has_enough_invalid_blocks(sbi))
> @@ -93,6 +95,8 @@ static int gc_thread_func(void *data)
>
> /* balancing f2fs's metadata periodically */
> f2fs_balance_fs_bg(sbi);
> +next:
> + sb_end_intwrite(sbi->sb);
>
> } while (!kthread_should_stop());
> return 0;
> --
> 2.13.1.388.g69e6b9b4f4a9
[toc] | [prev] | [next] | [standalone]
| From | Chao Yu <chao@kernel.org> |
|---|---|
| Date | 2017-07-22 02:50 +0200 |
| Message-ID | <u5QMh-3me-1@gated-at.bofh.it> |
| In reply to | #1693984 |
Hi Jaegeuk,
On 2017/7/22 4:54, Jaegeuk Kim wrote:
> Hi Chao,
>
> On 07/21, Chao Yu wrote:
>> When ->freeze_fs is called from lvm for doing snapshot, it needs to
>> make sure there will be no more changes in filesystem's data, however,
>> previously, background GC wasn't aware of freezing, so in environment
>> with active background GC thread, data of snapshot becomes unstable.
>
> What about flush/discard threads?
Updated.
Thanks,
>
> Thanks,
>
>>
>> This patch fixes this issue by adding sb_{start,end}_intwrite in GC
>> flow.
>>
>> Signed-off-by: Chao Yu <yuchao0@huawei.com>
>> ---
>> fs/f2fs/gc.c | 8 ++++++--
>> 1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
>> index 76ad2c3d88db..1c0117f60083 100644
>> --- a/fs/f2fs/gc.c
>> +++ b/fs/f2fs/gc.c
>> @@ -55,6 +55,8 @@ static int gc_thread_func(void *data)
>> }
>> #endif
>>
>> + sb_start_intwrite(sbi->sb);
>> +
>> /*
>> * [GC triggering condition]
>> * 0. GC is not conducted currently.
>> @@ -69,12 +71,12 @@ static int gc_thread_func(void *data)
>> * So, I'd like to wait some time to collect dirty segments.
>> */
>> if (!mutex_trylock(&sbi->gc_mutex))
>> - continue;
>> + goto next;
>>
>> if (!is_idle(sbi)) {
>> increase_sleep_time(gc_th, &wait_ms);
>> mutex_unlock(&sbi->gc_mutex);
>> - continue;
>> + goto next;
>> }
>>
>> if (has_enough_invalid_blocks(sbi))
>> @@ -93,6 +95,8 @@ static int gc_thread_func(void *data)
>>
>> /* balancing f2fs's metadata periodically */
>> f2fs_balance_fs_bg(sbi);
>> +next:
>> + sb_end_intwrite(sbi->sb);
>>
>> } while (!kthread_should_stop());
>> return 0;
>> --
>> 2.13.1.388.g69e6b9b4f4a9
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web