linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Coly Li <coly.li@suse.de>
To: Jiaying Zhang <jiayingz@google.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH, RFC] support discard in non-journal ext4
Date: Thu, 13 May 2010 17:08:33 +0800	[thread overview]
Message-ID: <4BEBC191.7060305@suse.de> (raw)
In-Reply-To: <20100513050014.879651BC316@ruihe.smo.corp.google.com>



On 05/13/2010 01:00 PM, Jiaying Zhang Wrote:
> This patch issues discard request for freed blocks in ext4_free_blocks()
> if ext4 is mounted with discard option and without journal.
> 
> Author: Jiaying Zhang <jiayingz@google.com>
> Date:   Wed May 12 21:11:46 2010 -0700
> 
>     Issue discard request in ext4_free_blocks() when ext4 has no journal and
>     is mounted with discard option.
>     
>     Signed-off-by: Jiaying Zhang <jiayingz@google.com>
> 
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index a291cc3..d51b79a 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -2513,6 +2513,22 @@ int ext4_mb_release(struct super_block *sb)
>  	return 0;
>  }
>  
> +static void ext4_issue_discard(struct super_block *sb, ext4_group_t block_group,
> +		ext4_grpblk_t block, int count)
> +{
> +	int ret;
> +	ext4_fsblk_t discard_block;
> +
> +	discard_block = block + ext4_group_first_block_no(sb, block_group);
> +	trace_ext4_discard_blocks(sb,
> +			(unsigned long long) discard_block, count);
> +	ret = sb_issue_discard(sb, discard_block, count);
> +	if (ret == EOPNOTSUPP) {
> +		ext4_warning(sb, "discard not supported, disabling");
> +		clear_opt(EXT4_SB(sb)->s_mount_opt, DISCARD);
> +	}
> +}
> +

How about make it as an inline routine? Thanks.

-- 
Coly Li
SuSE Labs

  reply	other threads:[~2010-05-13  8:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-13  5:00 [PATCH, RFC] support discard in non-journal ext4 Jiaying Zhang
2010-05-13  9:08 ` Coly Li [this message]
2010-05-14  0:29   ` Jiaying Zhang
2010-05-14  4:03     ` Coly Li
2010-05-14  4:09     ` Coly Li

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=4BEBC191.7060305@suse.de \
    --to=coly.li@suse.de \
    --cc=jiayingz@google.com \
    --cc=linux-ext4@vger.kernel.org \
    /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 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).