linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: release discard bio after sending discard commands
       [not found] <CGME20170801022917epcas2p49ee3e7d5ac5cba8746253429888b6d1c@epcas2p4.samsung.com>
@ 2017-08-01  2:29 ` Daeho Jeong
  2017-08-01  9:09   ` Jan Kara
       [not found]   ` <CGME20170801022917epcas2p49ee3e7d5ac5cba8746253429888b6d1c@epcms1p4>
  0 siblings, 2 replies; 4+ messages in thread
From: Daeho Jeong @ 2017-08-01  2:29 UTC (permalink / raw)
  To: jack, tytso, linux-ext4; +Cc: Daeho Jeong

We've changed the discard command handling into parallel manner.
But, in this change, I forgot decreasing the usage count of the bio
which was used to send discard request. I'm sorry about that.

Signed-off-by: Daeho Jeong <daeho.jeong@samsung.com>
Fixes: a015434480dc ("ext4: send parallel discards on commit
completions")
---
 fs/ext4/mballoc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index ab70b69e644c..88317b0cf7b8 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2892,8 +2892,10 @@ void ext4_process_freed_data(struct super_block *sb, tid_t commit_tid)
 				break;
 		}
 
-		if (discard_bio)
+		if (discard_bio) {
 			submit_bio_wait(discard_bio);
+			bio_put(discard_bio);
+		}
 	}
 
 	list_for_each_entry_safe(entry, tmp, &freed_data_list, efd_list)
-- 
2.13.0

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

* Re: [PATCH] ext4: release discard bio after sending discard commands
  2017-08-01  2:29 ` [PATCH] ext4: release discard bio after sending discard commands Daeho Jeong
@ 2017-08-01  9:09   ` Jan Kara
       [not found]   ` <CGME20170801022917epcas2p49ee3e7d5ac5cba8746253429888b6d1c@epcms1p4>
  1 sibling, 0 replies; 4+ messages in thread
From: Jan Kara @ 2017-08-01  9:09 UTC (permalink / raw)
  To: Daeho Jeong; +Cc: jack, tytso, linux-ext4

On Tue 01-08-17 11:29:28, Daeho Jeong wrote:
> We've changed the discard command handling into parallel manner.
> But, in this change, I forgot decreasing the usage count of the bio
> which was used to send discard request. I'm sorry about that.
> 
> Signed-off-by: Daeho Jeong <daeho.jeong@samsung.com>
> Fixes: a015434480dc ("ext4: send parallel discards on commit
> completions")

Why do you think this is needed? submit_bio_wait() consumes the reference
that you've got from __blkdev_issue_discard()...

								Honza
> ---
>  fs/ext4/mballoc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index ab70b69e644c..88317b0cf7b8 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -2892,8 +2892,10 @@ void ext4_process_freed_data(struct super_block *sb, tid_t commit_tid)
>  				break;
>  		}
>  
> -		if (discard_bio)
> +		if (discard_bio) {
>  			submit_bio_wait(discard_bio);
> +			bio_put(discard_bio);
> +		}
>  	}
>  
>  	list_for_each_entry_safe(entry, tmp, &freed_data_list, efd_list)
> -- 
> 2.13.0
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

* Re: Re: [PATCH] ext4: release discard bio after sending discard commands
       [not found]   ` <CGME20170801022917epcas2p49ee3e7d5ac5cba8746253429888b6d1c@epcms1p4>
@ 2017-08-01 23:31     ` Daeho Jeong
  2017-08-02  8:18       ` Jan Kara
  0 siblings, 1 reply; 4+ messages in thread
From: Daeho Jeong @ 2017-08-01 23:31 UTC (permalink / raw)
  To: Jan Kara, Daeho Jeong
  Cc: jack@suse.com, tytso@mit.edu, linux-ext4@vger.kernel.org


> > We've changed the discard command handling into parallel manner.

> > But, in this change, I forgot decreasing the usage count of the bio

> > which was used to send discard request. I'm sorry about that.

> > 

> > Signed-off-by: Daeho Jeong <daeho.jeong@samsung.com>

> > Fixes: a015434480dc ("ext4: send parallel discards on commit

> > completions")

 

> Why do you think this is needed? submit_bio_wait() consumes the reference

> that you've got from __blkdev_issue_discard()...

>  

>                                                                Honza



Hi Jan,



I thought like you, but submit_bio_wait() doesn't consume the reference

of the bio and the bio cannot be released after the I/O has been completed.

The caller of submit_bio_wait() should invoke bio_put() in person.

You can see what we have to do after calling submit_bio_wait() in

fs/crypto/bio.c.



Actually, in our device, I can see that the slab memory grows gradually

because of the unreleased discard bios.

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

* Re: Re: [PATCH] ext4: release discard bio after sending discard commands
  2017-08-01 23:31     ` Daeho Jeong
@ 2017-08-02  8:18       ` Jan Kara
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2017-08-02  8:18 UTC (permalink / raw)
  To: Daeho Jeong
  Cc: Jan Kara, jack@suse.com, tytso@mit.edu,
	linux-ext4@vger.kernel.org

On Tue 01-08-17 23:31:38, Daeho Jeong wrote:
> 
> > > We've changed the discard command handling into parallel manner.
> > > But, in this change, I forgot decreasing the usage count of the bio
> > > which was used to send discard request. I'm sorry about that.
> > > 
> > > Signed-off-by: Daeho Jeong <daeho.jeong@samsung.com>
> > > Fixes: a015434480dc ("ext4: send parallel discards on commit
> > > completions")
>  
> > Why do you think this is needed? submit_bio_wait() consumes the reference
> > that you've got from __blkdev_issue_discard()...
> >  
> >                                                                Honza
> 
> Hi Jan,
> 
> I thought like you, but submit_bio_wait() doesn't consume the reference
> of the bio and the bio cannot be released after the I/O has been completed.
> The caller of submit_bio_wait() should invoke bio_put() in person.
> You can see what we have to do after calling submit_bio_wait() in
> fs/crypto/bio.c.
> 
> Actually, in our device, I can see that the slab memory grows gradually
> because of the unreleased discard bios.

Ah, good point. I had a deeper look now and indeed submit_bio_wait() uses
it's own end_io function which does not drop the bio reference. So I
retract my objection and feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

end of thread, other threads:[~2017-08-02  8:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20170801022917epcas2p49ee3e7d5ac5cba8746253429888b6d1c@epcas2p4.samsung.com>
2017-08-01  2:29 ` [PATCH] ext4: release discard bio after sending discard commands Daeho Jeong
2017-08-01  9:09   ` Jan Kara
     [not found]   ` <CGME20170801022917epcas2p49ee3e7d5ac5cba8746253429888b6d1c@epcms1p4>
2017-08-01 23:31     ` Daeho Jeong
2017-08-02  8:18       ` Jan Kara

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