linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: no need lock_op in f2fs_write_inline_data
@ 2017-02-23 12:31 Yunlei He
  2017-02-23 19:45 ` Jaegeuk Kim
  0 siblings, 1 reply; 7+ messages in thread
From: Yunlei He @ 2017-02-23 12:31 UTC (permalink / raw)
  To: jaegeuk, yuchao0, linux-f2fs-devel

Similar as f2fs_write_inode, f2fs_write_inline_data just
mark inode page dirty, so it's no need to write inline data
under read lock of cp_rwsem.

Signed-off-by: Yunlei He <heyunlei@huawei.com>
---
 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 5f3bc98..836a15a 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1414,9 +1414,9 @@ static int __write_data_page(struct page *page, bool *submitted,
 		goto redirty_out;
 
 	err = -EAGAIN;
-	f2fs_lock_op(sbi);
 	if (f2fs_has_inline_data(inode))
 		err = f2fs_write_inline_data(inode, page);
+	f2fs_lock_op(sbi);
 	if (err == -EAGAIN)
 		err = do_write_data_page(&fio);
 	if (F2FS_I(inode)->last_disk_size < psize)
-- 
2.10.1


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

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

* Re: [PATCH] f2fs: no need lock_op in f2fs_write_inline_data
  2017-02-23 12:31 [PATCH] f2fs: no need lock_op in f2fs_write_inline_data Yunlei He
@ 2017-02-23 19:45 ` Jaegeuk Kim
  2017-02-24  3:29   ` heyunlei
  0 siblings, 1 reply; 7+ messages in thread
From: Jaegeuk Kim @ 2017-02-23 19:45 UTC (permalink / raw)
  To: Yunlei He; +Cc: linux-f2fs-devel

Hi Yunlei,

On 02/23, Yunlei He wrote:
> Similar as f2fs_write_inode, f2fs_write_inline_data just
> mark inode page dirty, so it's no need to write inline data
> under read lock of cp_rwsem.

We count # of dirty inodes that we need to flush through f2fs_write_inode, so
it's fine to go without f2fs_lock_op. In this case, however, I don't think we
can do like this.

Thanks,

> 
> Signed-off-by: Yunlei He <heyunlei@huawei.com>
> ---
>  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 5f3bc98..836a15a 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -1414,9 +1414,9 @@ static int __write_data_page(struct page *page, bool *submitted,
>  		goto redirty_out;
>  
>  	err = -EAGAIN;
> -	f2fs_lock_op(sbi);
>  	if (f2fs_has_inline_data(inode))
>  		err = f2fs_write_inline_data(inode, page);
> +	f2fs_lock_op(sbi);
>  	if (err == -EAGAIN)
>  		err = do_write_data_page(&fio);
>  	if (F2FS_I(inode)->last_disk_size < psize)
> -- 
> 2.10.1

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

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

* Re: [PATCH] f2fs: no need lock_op in f2fs_write_inline_data
  2017-02-23 19:45 ` Jaegeuk Kim
@ 2017-02-24  3:29   ` heyunlei
  2017-02-24 19:58     ` Jaegeuk Kim
  0 siblings, 1 reply; 7+ messages in thread
From: heyunlei @ 2017-02-24  3:29 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-f2fs-devel

Hi Jaegeuk,

	Can you explain more about this? Besides, how about inplace update?
	

On 2017/2/24 3:45, Jaegeuk Kim wrote:
> In this case, however, I don't think we
> can do like this.


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

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

* Re: [PATCH] f2fs: no need lock_op in f2fs_write_inline_data
  2017-02-24  3:29   ` heyunlei
@ 2017-02-24 19:58     ` Jaegeuk Kim
  2017-02-25  0:59       ` Chao Yu
  0 siblings, 1 reply; 7+ messages in thread
From: Jaegeuk Kim @ 2017-02-24 19:58 UTC (permalink / raw)
  To: heyunlei; +Cc: linux-f2fs-devel

On 02/24, heyunlei wrote:
> Hi Jaegeuk,
> 
> 	Can you explain more about this? Besides, how about inplace update?

Oh, sorry. I confused it was the inline_data conversion. ;)
Yup, we can avoid entire f2fs_lock_op like this. And we can avoid IPU as well,
but it's quite difficult to detect that.

>From 146e4c1ca458b1e33bf7f658f8796a8763e67a4e Mon Sep 17 00:00:00 2001
From: Yunlei He <heyunlei@huawei.com>
Date: Thu, 23 Feb 2017 20:31:20 +0800
Subject: [PATCH] f2fs: no need lock_op in f2fs_write_inline_data

Similar as f2fs_write_inode, f2fs_write_inline_data just
mark inode page dirty, so it's no need to write inline data
under read lock of cp_rwsem.

Signed-off-by: Yunlei He <heyunlei@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/data.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 80f9863dc4b0..9e51c5e40ce1 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1414,9 +1414,12 @@ static int __write_data_page(struct page *page, bool *submitted,
 		goto redirty_out;
 
 	err = -EAGAIN;
-	f2fs_lock_op(sbi);
-	if (f2fs_has_inline_data(inode))
+	if (f2fs_has_inline_data(inode)) {
 		err = f2fs_write_inline_data(inode, page);
+		if (!err)
+			goto out;
+	}
+	f2fs_lock_op(sbi);
 	if (err == -EAGAIN)
 		err = do_write_data_page(&fio);
 	if (F2FS_I(inode)->last_disk_size < psize)
-- 
2.11.0


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

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

* Re: [PATCH] f2fs: no need lock_op in f2fs_write_inline_data
  2017-02-24 19:58     ` Jaegeuk Kim
@ 2017-02-25  0:59       ` Chao Yu
  2017-02-25  1:58         ` heyunlei
  2017-02-25  2:10         ` Jaegeuk Kim
  0 siblings, 2 replies; 7+ messages in thread
From: Chao Yu @ 2017-02-25  0:59 UTC (permalink / raw)
  To: Jaegeuk Kim, heyunlei; +Cc: linux-f2fs-devel

On 2017/2/25 3:58, Jaegeuk Kim wrote:
> On 02/24, heyunlei wrote:
>> Hi Jaegeuk,
>>
>> 	Can you explain more about this? Besides, how about inplace update?
> 
> Oh, sorry. I confused it was the inline_data conversion. ;)
> Yup, we can avoid entire f2fs_lock_op like this. And we can avoid IPU as well,
> but it's quite difficult to detect that.

Seems when there is a large number of dirty inline data in page cache, then
trigger intensively writeback and CP can run out of free space?

Thanks,

> 
>>From 146e4c1ca458b1e33bf7f658f8796a8763e67a4e Mon Sep 17 00:00:00 2001
> From: Yunlei He <heyunlei@huawei.com>
> Date: Thu, 23 Feb 2017 20:31:20 +0800
> Subject: [PATCH] f2fs: no need lock_op in f2fs_write_inline_data
> 
> Similar as f2fs_write_inode, f2fs_write_inline_data just
> mark inode page dirty, so it's no need to write inline data
> under read lock of cp_rwsem.
> 
> Signed-off-by: Yunlei He <heyunlei@huawei.com>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>  fs/f2fs/data.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 80f9863dc4b0..9e51c5e40ce1 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -1414,9 +1414,12 @@ static int __write_data_page(struct page *page, bool *submitted,
>  		goto redirty_out;
>  
>  	err = -EAGAIN;
> -	f2fs_lock_op(sbi);
> -	if (f2fs_has_inline_data(inode))
> +	if (f2fs_has_inline_data(inode)) {
>  		err = f2fs_write_inline_data(inode, page);
> +		if (!err)
> +			goto out;
> +	}
> +	f2fs_lock_op(sbi);
>  	if (err == -EAGAIN)
>  		err = do_write_data_page(&fio);
>  	if (F2FS_I(inode)->last_disk_size < psize)
> 


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

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

* Re: [PATCH] f2fs: no need lock_op in f2fs_write_inline_data
  2017-02-25  0:59       ` Chao Yu
@ 2017-02-25  1:58         ` heyunlei
  2017-02-25  2:10         ` Jaegeuk Kim
  1 sibling, 0 replies; 7+ messages in thread
From: heyunlei @ 2017-02-25  1:58 UTC (permalink / raw)
  To: Chao Yu, Jaegeuk Kim; +Cc: linux-f2fs-devel

Hi Chao,
	Can we add below to avoid this case?

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 80f9863..c4f3db0 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1695,6 +1695,7 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi,

         if (f2fs_has_inline_data(inode)) {
                 if (pos + len <= MAX_INLINE_DATA) {
+                       dn.node_changed = true;
                         read_inline_data(page, ipage);
                         set_inode_flag(inode, FI_DATA_EXIST);
                         if (inode->i_nlink)

Thanks.

On 2017/2/25 8:59, Chao Yu wrote:
> Seems when there is a large number of dirty inline data in page cache, then
> trigger intensively writeback and CP can run out of free space?


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

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

* Re: [PATCH] f2fs: no need lock_op in f2fs_write_inline_data
  2017-02-25  0:59       ` Chao Yu
  2017-02-25  1:58         ` heyunlei
@ 2017-02-25  2:10         ` Jaegeuk Kim
  1 sibling, 0 replies; 7+ messages in thread
From: Jaegeuk Kim @ 2017-02-25  2:10 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-f2fs-devel

On 02/25, Chao Yu wrote:
> On 2017/2/25 3:58, Jaegeuk Kim wrote:
> > On 02/24, heyunlei wrote:
> >> Hi Jaegeuk,
> >>
> >> 	Can you explain more about this? Besides, how about inplace update?
> > 
> > Oh, sorry. I confused it was the inline_data conversion. ;)
> > Yup, we can avoid entire f2fs_lock_op like this. And we can avoid IPU as well,
> > but it's quite difficult to detect that.
> 
> Seems when there is a large number of dirty inline data in page cache, then
> trigger intensively writeback and CP can run out of free space?

I expect that f2fs_balance_fs() will hopefully block them.

Thanks,

> 
> Thanks,
> 
> > 
> >>From 146e4c1ca458b1e33bf7f658f8796a8763e67a4e Mon Sep 17 00:00:00 2001
> > From: Yunlei He <heyunlei@huawei.com>
> > Date: Thu, 23 Feb 2017 20:31:20 +0800
> > Subject: [PATCH] f2fs: no need lock_op in f2fs_write_inline_data
> > 
> > Similar as f2fs_write_inode, f2fs_write_inline_data just
> > mark inode page dirty, so it's no need to write inline data
> > under read lock of cp_rwsem.
> > 
> > Signed-off-by: Yunlei He <heyunlei@huawei.com>
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >  fs/f2fs/data.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> > index 80f9863dc4b0..9e51c5e40ce1 100644
> > --- a/fs/f2fs/data.c
> > +++ b/fs/f2fs/data.c
> > @@ -1414,9 +1414,12 @@ static int __write_data_page(struct page *page, bool *submitted,
> >  		goto redirty_out;
> >  
> >  	err = -EAGAIN;
> > -	f2fs_lock_op(sbi);
> > -	if (f2fs_has_inline_data(inode))
> > +	if (f2fs_has_inline_data(inode)) {
> >  		err = f2fs_write_inline_data(inode, page);
> > +		if (!err)
> > +			goto out;
> > +	}
> > +	f2fs_lock_op(sbi);
> >  	if (err == -EAGAIN)
> >  		err = do_write_data_page(&fio);
> >  	if (F2FS_I(inode)->last_disk_size < psize)
> > 
> 
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

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

end of thread, other threads:[~2017-02-25  2:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-23 12:31 [PATCH] f2fs: no need lock_op in f2fs_write_inline_data Yunlei He
2017-02-23 19:45 ` Jaegeuk Kim
2017-02-24  3:29   ` heyunlei
2017-02-24 19:58     ` Jaegeuk Kim
2017-02-25  0:59       ` Chao Yu
2017-02-25  1:58         ` heyunlei
2017-02-25  2:10         ` Jaegeuk Kim

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).