Re: Subvolumes and /proc/self/mountinfo

2012-06-19 Thread Fajar A. Nugraha
On Wed, Jun 20, 2012 at 10:22 AM, H. Peter Anvin wrote: > a. Make a snapshot of the current root; > b. Mount said snapshot; > c. Install the new distro on the snapshot; > d. Change the bootloader configuration *inside* the snapshot to point >   to the snapshot as the root; > e. Install the bootloa

Re: Subvolumes and /proc/self/mountinfo

2012-06-19 Thread H. Peter Anvin
On 06/19/2012 06:16 PM, cwillu wrote: >>> The big reason it isn't here yet is because Kay had this neat patch >>> to blkid and udev to just put all the info you need into /dev/btrfs >>> (or some other suitable location). It would allow you to see which >>> devices belong to which filesystems etc.

Re: Subvolumes and /proc/self/mountinfo

2012-06-19 Thread Fajar A. Nugraha
On Wed, Jun 20, 2012 at 6:35 AM, H. Peter Anvin wrote: > On 06/19/2012 07:22 AM, Calvin Walton wrote: >> >> All subvolumes are accessible from the volume mounted when you use -o >> subvolid=0. (Note that 0 is not the real ID of the root volume, it's >> just a shortcut for mounting it.) >> > > Coul

Re: Subvolumes and /proc/self/mountinfo

2012-06-19 Thread cwillu
>> The big reason it isn't here yet is because Kay had this neat patch >> to blkid and udev to just put all the info you need into /dev/btrfs >> (or some other suitable location).  It would allow you to see which >> devices belong to which filesystems etc. > > "btrfs" should work even without any "

[PATCH] btrfs: ignore unfragmented file checks in defrag when compression enabled - rebased

2012-06-19 Thread Andrew Mahone
Rebased on btrfs-next and retested. Inform should_defrag_range if BTRFS_DEFRAG_RANGE_COMPRESS is set. If so, skip checks for adjacent extents and extent size when deciding whether to defrag, as these can prevent an uncompressed and unfragmented file from being compressed as requested. Signed-off-

Re: Subvolumes and /proc/self/mountinfo

2012-06-19 Thread Helmut Hullen
Hallo, Chris, Du meintest am 19.06.12: >> I'm trying to figure out an algorithm from taking an arbitrary >> mounted btrfs directory and break it down into: >> >> >> >> where, keep in mind, may not actually be part of the >> mount. > Do you want an API for this, or is it enough to wander throug

Re: Subvolumes and /proc/self/mountinfo

2012-06-19 Thread H. Peter Anvin
On 06/19/2012 04:49 PM, Chris Mason wrote: > On Mon, Jun 18, 2012 at 06:39:31PM -0600, H. Peter Anvin wrote: >> I'm trying to figure out an algorithm from taking an arbitrary mounted >> btrfs directory and break it down into: >> >> >> >> where, keep in mind, may not actually be part of the mount.

Re: Device names

2012-06-19 Thread H. Peter Anvin
On 06/19/2012 04:51 PM, Chris Mason wrote: > > At mount time, we go through and verify the path names still belong to > the filesystem you thought they belonged to. The bdev is locked during > the verification, so it won't be able to go away or change. > > This is a long way of saying right we d

Re: Device names

2012-06-19 Thread Chris Mason
On Mon, Jun 18, 2012 at 06:29:59PM -0600, H. Peter Anvin wrote: > I just found out that all the device handling in btrfs is based on > pathnames, but shorter pathnames (1024) that PATH_MAX (4096). > > This is confusing, and concerning for multiple reasons: > > 1. pathnames are namespace-specific;

Re: Subvolumes and /proc/self/mountinfo

2012-06-19 Thread Chris Mason
On Mon, Jun 18, 2012 at 06:39:31PM -0600, H. Peter Anvin wrote: > I'm trying to figure out an algorithm from taking an arbitrary mounted > btrfs directory and break it down into: > > > > where, keep in mind, may not actually be part of the mount. Do you want an API for this, or is it enough to

Re: Subvolumes and /proc/self/mountinfo

2012-06-19 Thread H. Peter Anvin
On 06/19/2012 07:22 AM, Calvin Walton wrote: > > All subvolumes are accessible from the volume mounted when you use -o > subvolid=0. (Note that 0 is not the real ID of the root volume, it's > just a shortcut for mounting it.) > Could you clarify this bit? Specifically, what is the real ID of th

Re: [PATCH] btrfs: ignore unfragmented file checks in defrag when compression enabled

2012-06-19 Thread Josef Bacik
On Mon, Jun 18, 2012 at 01:27:37PM -0400, Andrew Mahone wrote: > Inform should_defrag_range if BTRFS_DEFRAG_RANGE_COMPRESS is set. If so, skip > checks for adjacent extents and extent size when deciding whether to defrag, > as these can prevent an uncompressed and unfragmented file from being > com

[PATCH] Btrfs: fix dio write vs buffered read race

2012-06-19 Thread Josef Bacik
Miao pointed out there's a problem with mixing dio writes and buffered reads. If the read happens between us invalidating the page range and actually locking the extent we can bring in pages into page cache. Then once the write finishes if somebody tries to read again it will just find uptodate p

Re: Subvolumes and /proc/self/mountinfo

2012-06-19 Thread Calvin Walton
On Mon, 2012-06-18 at 17:39 -0700, H. Peter Anvin wrote: > I'm trying to figure out an algorithm from taking an arbitrary mounted > btrfs directory and break it down into: > > > > where, keep in mind, may not actually be part of the mount. > > /proc/self/mountinfo seems to have some of that in

[PATCH 2/2] Btrfs: don't assume to be on the correct extent in add_all_parents

2012-06-19 Thread Alexander Block
add_all_parents did assume that path is already at a correct extent data item, which may not be true in case of data extents that were partly rewritten and splitted. We need to check if we're on a matching extent for every item and only for the ones after the first. The loop is changed to do this

[PATCH 1/2] Btrfs: introduce btrfs_next_old_item

2012-06-19 Thread Alexander Block
We introduce btrfs_next_old_item that uses btrfs_next_old_leaf instead of btrfs_next_leaf. btrfs_next_item is also changed to simply call btrfs_next_old_item with time_seq being 0. Signed-off-by: Alexander Block --- fs/btrfs/ctree.h |9 +++-- 1 file changed, 7 insertions(+), 2 deletions(

[PATCH 0/2] Fix bugs in backref resolving code

2012-06-19 Thread Alexander Block
This bug popped up while working on btrfs send. This patchset contains two patches. The first one introduces btrfs_next_old_leaf which is needed in the second patch which is the actual fix. Both patches should probably go into 3.5 as they fix wrongly resolved backrefs and a crash. Big thanks to

Re: [RFC PATCH] Btrfs: fix old data problem caused by aio vs dio

2012-06-19 Thread Chris Mason
On Tue, Jun 19, 2012 at 06:39:47AM -0600, Miao Xie wrote: > The 209th case of xfstests failed because of the race between aio and dio. The > detail reason is following: > Task1 Task2 Btrfs-worker > invalidate pages > read pages >

[RFC PATCH] Btrfs: fix old data problem caused by aio vs dio

2012-06-19 Thread Miao Xie
The 209th case of xfstests failed because of the race between aio and dio. The detail reason is following: Task1 Task2 Btrfs-worker invalidate pages read pages do direct io invalidate

[patch] Btrfs: small naming cleanup in join_transaction()

2012-06-19 Thread Dan Carpenter
"root->fs_info" and "fs_info" are the same, but "fs_info" is prefered because it is shorter and that's what is used in the rest of the function. Signed-off-by: Dan Carpenter --- Also, Smatch doesn't understand that they are the same so it complains about the locking. diff --git a/fs/btrfs/transa