From: Mitch Harder <mitch.harder@sabayonlinux.org>
To: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Defragmentation Not Working with Directory as Argument
Date: Mon, 24 Jan 2011 12:11:07 -0600 [thread overview]
Message-ID: <AANLkTi=AtFgMoES1z7jXwwXkZynbBjYbPTJK_4_iULSF@mail.gmail.com> (raw)
Defragmentation is not working when a directory is supplied as the
argument. When a file name is supplied as the argument,
defragmentation works well.
This can be demonstrated as follows:
# mount /dev/sdb2 /mnt/btrfs
# cd /mnt/btrfs/
# cp /usr/src/linux/fs/btrfs/zlib.c . (any suitable file will do,
small text files seemed appropriate)
# cp zlib.c fragmented-zlib.c
# btrfs fi sync /mnt/btrfs
# cat zlib.c >> fragmented-zlib.c
# btrfs fi sync /mnt/btrfs
# filefrag zlib.c fragmented-zlib.c
zlib.c: 1 extent found
fragmented-zlib.c: 2 extents found
# btrfs filesystem defragment /mnt/btrfs/
# btrfs fi sync /mnt/btrfs
# filefrag zlib.c fragmented-zlib.c
zlib.c: 1 extent found
fragmented-zlib.c: 2 extents found
Now, supply a filename as the argument
# btrfs filesystem defragment /mnt/btrfs/fragmented-zlib.c
# btrfs fi sync /mnt/btrfs
# filefrag zlib.c fragmented-zlib.c
zlib.c: 1 extent found
fragmented-zlib.c: 1 extent found
I've also tested defragmentation on my normal btrfs filesystems, and
have seen the same results. I've never seen a file defragmented when
using a directory as the argument.
Also, I was wondering if one of the Btrfs developers could clarify the
intended scope of defragmentation when a directory is supplied as the
argument.
I have seen comments on the mailing list indicating that only the
directory supplied is intended to be defragmented, and defragmentation
will not recurse to subdirectories below.
However, if I look at the code, and read the documentation for the
older btrfsctl command (which seems to be the basis for the current
btrfs command), it seems like the intention is to recursively
defragment the entire tree below the directory supplied in the
argument.
next reply other threads:[~2011-01-24 18:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-24 18:11 Mitch Harder [this message]
2011-01-24 18:21 ` Defragmentation Not Working with Directory as Argument Hubert Kario
2011-01-25 20:54 ` Mitch Harder
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='AANLkTi=AtFgMoES1z7jXwwXkZynbBjYbPTJK_4_iULSF@mail.gmail.com' \
--to=mitch.harder@sabayonlinux.org \
--cc=linux-btrfs@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).