From: Alex Elder <aelder@sgi.com>
To: Lukas Czerner <lczerner@redhat.com>
Cc: hch@infradead.org, xfs@oss.sgi.com
Subject: Re: [PATCH] xfs: check if device support discard in xfs_ioc_trim()
Date: Tue, 15 Feb 2011 12:54:06 -0600 [thread overview]
Message-ID: <1297796046.2435.28.camel@doink> (raw)
In-Reply-To: <1297789656-6088-1-git-send-email-lczerner@redhat.com>
On Tue, 2011-02-15 at 18:07 +0100, Lukas Czerner wrote:
> Right now we, are relying on the fact that when we attempt to actually do
> the discard, blkdev_issue_discar() returns -EOPNOTSUPP and the user is
> informed that the device does not support discard.
>
> However, in the case where the we do not hit any suitable free extent to
> trim in FITRIM code, it will finish without any error. This is very
> confusing, because it seems that FITRIM was successful even though the
> device does not actually supports discard.
>
> Solution: Check for the discard support before attempt to search for
> free extents.
>
> Signed-off-by: Lukas Czerner <lczerner@redhat.com>
> ---
> fs/xfs/linux-2.6/xfs_discard.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/fs/xfs/linux-2.6/xfs_discard.c b/fs/xfs/linux-2.6/xfs_discard.c
> index 05201ae..d61611c 100644
> --- a/fs/xfs/linux-2.6/xfs_discard.c
> +++ b/fs/xfs/linux-2.6/xfs_discard.c
> @@ -152,6 +152,8 @@ xfs_ioc_trim(
>
> if (!capable(CAP_SYS_ADMIN))
> return -XFS_ERROR(EPERM);
> + if (!blk_queue_discard(q))
> + return -XFS_ERROR(EOPNOTSUPP);
> if (copy_from_user(&range, urange, sizeof(range)))
> return -XFS_ERROR(EFAULT);
>
Looks good.
Reviewed-by: Alex Elder <aelder@sgi.com>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
prev parent reply other threads:[~2011-02-15 18:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-15 17:07 [PATCH] xfs: check if device support discard in xfs_ioc_trim() Lukas Czerner
2011-02-15 18:54 ` Alex Elder [this message]
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=1297796046.2435.28.camel@doink \
--to=aelder@sgi.com \
--cc=hch@infradead.org \
--cc=lczerner@redhat.com \
--cc=xfs@oss.sgi.com \
/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