From: David Sterba <dsterba@suse.cz>
To: Su Yue <suy.fnst@cn.fujitsu.com>
Cc: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 3/3] btrfs-progs: fi defrag: extend -c to drop nocompress flag on files
Date: Thu, 30 Nov 2017 19:30:16 +0100 [thread overview]
Message-ID: <20171130183016.GR3553@twin.jikos.cz> (raw)
In-Reply-To: <42224432-6a27-ea55-f6ee-660adb48e7f0@cn.fujitsu.com>
On Wed, Nov 29, 2017 at 09:54:01AM +0800, Su Yue wrote:
> On 11/29/2017 12:07 AM, David Sterba wrote:
> > On Tue, Nov 28, 2017 at 05:14:50PM +0800, Su Yue wrote:
> >> Now, files which have nocompress flag also will be defraged
> >> with compression. However, nocompress flag is still existed
> >> and have to be cleared manually.
> >>
> >> So add an option '--clear-nocompress' to extend -c to drop
> >> nocompress flag after defragement.
> >
> >> Suggested-by: David Sterba <dsterba@suse.com>
> >> Suggested-by: Anand Jain <anand.jain@oracle.com>
> >
> > Do you have the pointer to the discussion? The whole idea sounds
> > familiar and seeing my name here means I must have been involved, but I
> > have only vague memories.
> >
>
> Here is the link:
> https://www.spinics.net/lists/linux-btrfs/msg67529.html
Thanks.
> >> +static int clear_nocompress_flag(int fd)
> >> +{
> >> + unsigned int flags;
> >> + int ret = 0;
> >> +
> >> + ret = ioctl(fd, FS_IOC_GETFLAGS, &flags);
> >> + if (ret < 0) {
> >> + ret = -errno;
> >> + error("failed to get flags: %s", strerror(-ret));
> >> + goto out;
> >> + }
> >> +
> >> + if (!(flags & FS_NOCOMP_FL)) {
> >> + ret = 0;
> >> + goto out;
> >> + }
> >> + flags &= ~FS_NOCOMP_FL;
> >> + ret = ioctl(fd, FS_IOC_SETFLAGS, &flags);
> >
> > This is inherently racy, but the inode flags do not change that often so
> > concurrent change is unlikely.
> >
>
> I don't quite understand what you mean.
> Could you explain some details?
If the inode flags change externally between the set and get calls, but
there's not much we can do about it now.
next prev parent reply other threads:[~2017-11-30 18:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-28 9:14 [PATCH v2 1/3] btrfs-progs: fi defrag: clean up duplicate code if find errors Su Yue
2017-11-28 9:14 ` [PATCH v2 2/3] btrfs-progs: fi defrag: do not exit if defrag range ioctl is unsupported Su Yue
2017-11-28 15:57 ` David Sterba
2017-11-28 9:14 ` [PATCH v2 3/3] btrfs-progs: fi defrag: extend -c to drop nocompress flag on files Su Yue
2017-11-28 16:07 ` David Sterba
2017-11-29 1:54 ` Su Yue
2017-11-30 18:30 ` David Sterba [this message]
2017-11-28 16:07 ` [PATCH v2 1/3] btrfs-progs: fi defrag: clean up duplicate code if find errors David Sterba
2017-11-29 2:12 ` [PATCH v3 2/3] btrfs-progs: fi defrag: do not exit if defrag range ioctl is unsupported Su Yue
2017-11-30 6:37 ` Qu Wenruo
2017-11-30 6:49 ` Qu Wenruo
2017-11-30 6:47 ` [PATCH v2 1/3] btrfs-progs: fi defrag: clean up duplicate code if find errors Qu Wenruo
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=20171130183016.GR3553@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=suy.fnst@cn.fujitsu.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;
as well as URLs for NNTP newsgroup(s).