Re: Unable to open ctree

2016-10-02 Thread Leonidas Spyropoulos
Hello, After the command to rebuild the extent tree # btrfs check --init-extent-tree --repair /dev/sda3 I was able to mount and run successfully a scrub (not sure if it would detect something though). Next was reboot and try to boot which was successful as well. I'll keep an eye on the dmesh

Re: Unable to open ctree

2016-10-02 Thread Leonidas Spyropoulos
Hi Roman, On 03/10/16, Roman Mamedov wrote: > On Sun, 2 Oct 2016 13:29:56 -0600 > Chris Murphy wrote: > > > Well short of a bug, the problem aren't the checksums. The problem is > > the metadata is wrong, so if you recalculate checksums you're likely > > end up with an

Re: Unable to open ctree

2016-10-02 Thread Chris Murphy
On Sun, Oct 2, 2016 at 2:22 PM, Roman Mamedov wrote: > On Sun, 2 Oct 2016 13:29:56 -0600 > Chris Murphy wrote: > >> Well short of a bug, the problem aren't the checksums. The problem is >> the metadata is wrong, so if you recalculate checksums you're

Re: Unable to open ctree

2016-10-02 Thread Roman Mamedov
On Sun, 2 Oct 2016 13:29:56 -0600 Chris Murphy wrote: > Well short of a bug, the problem aren't the checksums. The problem is > the metadata is wrong, so if you recalculate checksums you're likely > end up with an even more corrupted file system because it'll start out >

Re: Unable to open ctree

2016-10-02 Thread Leonidas Spyropoulos
Hi Chris, Thanks for your suggestions On 02/10/16, Chris Murphy wrote: > Well short of a bug, the problem aren't the checksums. The problem is > the metadata is wrong, so if you recalculate checksums you're likely > end up with an even more corrupted file system because it'll start out >

Re: Unable to open ctree

2016-10-02 Thread Chris Murphy
On Sun, Oct 2, 2016 at 12:17 PM, Leonidas Spyropoulos wrote: > Hi all, > > I'm a everyday user of btrfs. The system is a laptop with UEFI partition > and the following partition scheme: > # blkid > /dev/sda1: UUID="." TYPE="vfat" PARTUUID="." > /dev/sda2: UUID="." TYPE="swap"

Unable to open ctree

2016-10-02 Thread Leonidas Spyropoulos
Hi all, I'm a everyday user of btrfs. The system is a laptop with UEFI partition and the following partition scheme: # blkid /dev/sda1: UUID="." TYPE="vfat" PARTUUID="." /dev/sda2: UUID="." TYPE="swap" PARTUUID="." /dev/sda3: LABEL="root" UUID="." UUID_SUB="." TYPE="btrfs" PARTUUID="."

[PATCH V21 18/19] Btrfs: subpage-blocksize: __btrfs_lookup_bio_sums: Set offset when moving to a new bio_vec

2016-10-02 Thread Chandan Rajendra
In __btrfs_lookup_bio_sums() we set the file offset value at the beginning of every iteration of the while loop. This is incorrect since the blocks mapped by the current bvec->bv_page might not yet have been completely processed. This commit fixes the issue by setting the file offset value when

[PATCH V21 19/19] Btrfs: subpage-blocksize: Disable compression

2016-10-02 Thread Chandan Rajendra
The subpage-blocksize patchset does not yet support compression. Hence, the kernel might crash when executing compression code in subpage-blocksize scenario. This commit disables enabling compression feature during 'mount' and also when the user invokes 'chattr +c ' command. Signed-off-by:

[PATCH V21 17/19] Btrfs: subpage-blocksize: Make file extent relocate code subpage blocksize aware

2016-10-02 Thread Chandan Rajendra
The file extent relocation code currently assumes blocksize to be same as PAGE_SIZE. This commit adds code to support subpage blocksize scenario. Signed-off-by: Chandan Rajendra --- fs/btrfs/relocation.c | 90 --- 1

[PATCH V21 16/19] Btrfs: subpage-blocksize: btrfs_clone: Flush dirty blocks of a page that do not map the clone range

2016-10-02 Thread Chandan Rajendra
After cloning the required extents, we truncate all the pages that map the file range being cloned. In subpage-blocksize scenario, we could have dirty blocks before and/or after the clone range in the leading/trailing pages. Truncating these pages would lead to data loss. Hence this commit forces

[PATCH V21 13/19] Btrfs: subpage-blocksize: btrfs_punch_hole: Fix uptodate blocks check

2016-10-02 Thread Chandan Rajendra
In case of subpage-blocksize, the file blocks to be punched may map only part of a page. For file blocks inside such pages, we need to check for the presence of BLK_STATE_UPTODATE flag. Signed-off-by: Chandan Rajendra --- fs/btrfs/file.c | 89

[PATCH V21 12/19] Btrfs: subpage-blocksize: Explicitly track I/O status of blocks of an ordered extent.

2016-10-02 Thread Chandan Rajendra
In subpage-blocksize scenario a page can have more than one block. So in addition to PagePrivate2 flag, we would have to track the I/O status of each block of a page to reliably mark the ordered extent as complete. Signed-off-by: Chandan Rajendra ---

[PATCH V21 06/19] Btrfs: subpage-blocksize: Fix whole page write

2016-10-02 Thread Chandan Rajendra
For the subpage-blocksize scenario, a page can contain multiple blocks. In such cases, this patch handles writing data to files. Also, When setting EXTENT_DELALLOC, we no longer set EXTENT_UPTODATE bit on the extent_io_tree since uptodate status is being tracked either by the bitmap pointed to by

[PATCH V21 08/19] Btrfs: subpage-blocksize: Execute sanity tests on all possible block sizes

2016-10-02 Thread Chandan Rajendra
This commit executes sanity tests for all valid sectorsize/nodesize combinations. Signed-off-by: Chandan Rajendra --- fs/btrfs/tests/btrfs-tests.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/tests/btrfs-tests.c

[PATCH V21 05/19] Btrfs: subpage-blocksize: Fix whole page read.

2016-10-02 Thread Chandan Rajendra
For the subpage-blocksize scenario, a page can contain multiple blocks. In such cases, this patch handles reading data from files. To track the status of individual blocks of a page, this patch makes use of a bitmap pointed to by the newly introduced per-page 'struct btrfs_page_private'. The

[PATCH V21 14/19] Btrfs: subpage-blocksize: Fix file defragmentation code

2016-10-02 Thread Chandan Rajendra
This commit gets file defragmentation code to work in subpage-blocksize scenario. It does this by keeping track of page offsets that mark block boundaries and passing them as arguments to the functions that implement the defragmentation logic. Signed-off-by: Chandan Rajendra

[PATCH V21 04/19] Btrfs: Remove extent_io_tree's track_uptodate member

2016-10-02 Thread Chandan Rajendra
We now track block uptodate status using a page's PG_Uptodate flag. Hence this commit removes the now unused extent_io_tree->track_uptodate member. Signed-off-by: Chandan Rajendra --- fs/btrfs/disk-io.c | 1 - fs/btrfs/extent_io.h | 1 - fs/btrfs/inode.c | 2 --

[PATCH V21 15/19] Btrfs: subpage-blocksize: Enable dedupe ioctl

2016-10-02 Thread Chandan Rajendra
The function implementing the dedupe ioctl i.e. btrfs_ioctl_file_extent_same(), returns with an error in subpage-blocksize scenario. This was done due to the fact that Btrfs did not have code to deal with block size < page size. This commit removes this restriction since we now support "block size

[PATCH V21 11/19] Btrfs: subpage-blocksize: Deal with partial ordered extent allocations.

2016-10-02 Thread Chandan Rajendra
In subpage-blocksize scenario, extent allocations for only some of the dirty blocks of a page can succeed, while allocation for rest of the blocks can fail. This patch allows I/O against such pages to be submitted. Signed-off-by: Chandan Rajendra ---

[PATCH V21 09/19] Btrfs: subpage-blocksize: Compute free space tree BITMAP_RANGE based on sectorsize

2016-10-02 Thread Chandan Rajendra
The default bitmap length computation in free space tree sanity tests assumes PAGE_SIZE as the sectorsize. This commit fixes this by using a variable sectorsize to calculate BITMAP_RANGE. Signed-off-by: Chandan Rajendra --- fs/btrfs/tests/free-space-tree-tests.c | 79

[PATCH V21 10/19] Btrfs: subpage-blocksize: Allow mounting filesystems where sectorsize < PAGE_SIZE

2016-10-02 Thread Chandan Rajendra
This commit allows mounting filesystem instances with sectorsize smaller than the PAGE_SIZE. Since the code assumes that the super block is either equal to or larger than sectorsize, this commit brings back the nodesize argument for btrfs_find_create_tree_block() function. This change allows us

[PATCH V21 07/19] Btrfs: subpage-blocksize: Use kmalloc()-ed memory to hold metadata blocks

2016-10-02 Thread Chandan Rajendra
For subpage-blocksizes this commit uses kmalloc()-ed memory to buffer metadata blocks in memory. When reading/writing metadata blocks, We now track the first extent buffer using bio->bi_private. With kmalloc()-ed memory we cannot use page->private. Hence when writing dirty extent buffers in

[PATCH V21 01/19] Btrfs: subpage-blocksize: extent_clear_unlock_delalloc: Prevent page from being unlocked more than once

2016-10-02 Thread Chandan Rajendra
extent_clear_unlock_delalloc() can unlock a page more than once as shown below (assume 4k as the block size and 64k as the page size). cow_file_range create 4k ordered extent corresponding to page offsets 0 - 4095 extent_clear_unlock_delalloc corresponding to page offsets 0 - 4095 unlock

[PATCH V21 03/19] Btrfs: subpage-blocksize: Use PG_Uptodate flag to track block uptodate status

2016-10-02 Thread Chandan Rajendra
This commit causes a block's uptodate status to be tracked using struct page's PG_Uptodate flag instead of extent_io_tree's EXTENT_UPTODATE flag. This is in preparation for subpage-blocksize patchset which will use a per-page bitmap for tracking individual block's uptodate status in the case of

[PATCH V21 02/19] Btrfs: subpage-blocksize: Make sure delalloc range intersects with the locked page's range

2016-10-02 Thread Chandan Rajendra
find_delalloc_range indirectly depends on EXTENT_UPTODDATE to make sure that the delalloc range returned intersects with the file range mapped by the page. Since we now track "uptodate" state in a per-page bitmap (i.e. in btrfs_page_private->bstate), this commit makes an explicit check to make

[PATCH V21 00/19] Allow I/O on blocks whose size is less than page size

2016-10-02 Thread Chandan Rajendra
Btrfs assumes block size to be the same as the machine's page size. This would mean that a Btrfs instance created on a 4k page size machine (e.g. x86) will not be mountable on machines with larger page sizes (e.g. PPC64/AARCH64). This patchset aims to resolve this incompatibility. This patchset