[PATCH V20 14/19] Btrfs: subpage-blocksize: Enable dedupe ioctl

2016-07-03 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 V20 19/19] Btrfs: subpage-blocksize: Rate limit scrub error message

2016-07-03 Thread Chandan Rajendra
btrfs/073 invokes scrub ioctl in a tight loop. In subpage-blocksize scenario this results in a lot of "scrub: size assumption sectorsize != PAGE_SIZE " messages being printed on the console. To reduce the number of such messages this commit uses btrfs_err_rl() instead of btrfs_err().

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

2016-07-03 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 V20 10/19] Btrfs: subpage-blocksize: btrfs_punch_hole: Fix uptodate blocks check

2016-07-03 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 V20 12/19] Revert "btrfs: fix lockups from btrfs_clear_path_blocking"

2016-07-03 Thread Chandan Rajendra
The patch "Btrfs: subpage-blocksize: Prevent writes to an extent buffer when PG_writeback flag is set" requires btrfs_try_tree_write_lock() to be a true try lock w.r.t to both spinning and blocking locks. During 2015's Vault Conference Btrfs meetup, Chris Mason had suggested that he will write up

[PATCH V20 13/19] Btrfs: subpage-blocksize: Fix file defragmentation code

2016-07-03 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 V20 17/19] Btrfs: subpage-blocksize: __btrfs_lookup_bio_sums: Set offset when moving to a new bio_vec

2016-07-03 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 V20 15/19] Btrfs: subpage-blocksize: btrfs_clone: Flush dirty blocks of a page that do not map the clone range

2016-07-03 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 V20 16/19] Btrfs: subpage-blocksize: Make file extent relocate code subpage blocksize aware

2016-07-03 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 | 89 --- 1

[PATCH V20 11/19] Btrfs: subpage-blocksize: Prevent writes to an extent buffer when PG_writeback flag is set

2016-07-03 Thread Chandan Rajendra
In non-subpage-blocksize scenario, BTRFS_HEADER_FLAG_WRITTEN flag prevents Btrfs code from writing into an extent buffer whose pages are under writeback. This facility isn't sufficient for achieving the same in subpage-blocksize scenario, since we have more than one extent buffer mapped to a page.

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

2016-07-03 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 V20 03/19] Btrfs: subpage-blocksize: Make sure delalloc range intersects with the locked page's range

2016-07-03 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 V20 07/19] Btrfs: subpage-blocksize: Allow mounting filesystems where sectorsize < PAGE_SIZE

2016-07-03 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 V20 08/19] Btrfs: subpage-blocksize: Deal with partial ordered extent allocations.

2016-07-03 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 V20 02/19] Btrfs: subpage-blocksize: Fix whole page write

2016-07-03 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 by the bitmap pointed to by

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

2016-07-03 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

[PATCH V20 04/19] Btrfs: subpage-blocksize: Define extent_buffer_head

2016-07-03 Thread Chandan Rajendra
In order to handle multiple extent buffers per page, first we need to create a way to handle all the extent buffers that are attached to a page. This patch creates a new data structure 'struct extent_buffer_head', and moves fields that are common to all extent buffers from 'struct extent_buffer'

[PATCH V20 05/19] Btrfs: subpage-blocksize: Read tree blocks whose size is < PAGE_SIZE

2016-07-03 Thread Chandan Rajendra
In the case of subpage-blocksize, this patch makes it possible to read only a single metadata block from the disk instead of all the metadata blocks that map into a page. Signed-off-by: Chandan Rajendra --- fs/btrfs/disk-io.c | 52 -

[PATCH V20 01/19] Btrfs: subpage-blocksize: Fix whole page read.

2016-07-03 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 V20 06/19] Btrfs: subpage-blocksize: Write only dirty extent buffers belonging to a page

2016-07-03 Thread Chandan Rajendra
For the subpage-blocksize scenario, this patch adds the ability to write a single extent buffer to the disk. Signed-off-by: Chandan Rajendra --- fs/btrfs/disk-io.c | 32 +++--- fs/btrfs/extent_io.c | 277 +-- 2 files

Re: [PATCH v9 2/5] btrfs-progs: dedupe: Add enable command for dedupe command group

2016-07-03 Thread Qu Wenruo
At 06/30/2016 05:24 PM, Qu Wenruo wrote: Add enable subcommand for dedupe commmand group. Signed-off-by: Qu Wenruo --- Documentation/btrfs-dedupe-inband.asciidoc | 114 ++- btrfs-completion | 6 +- cmds-dedupe-ib.c

[PATCH] btrfs-progs: use the correct struct for BTRFS_IOC_LOGICAL_INO

2016-07-03 Thread Hans van Kranenburg
BTRFS_IOC_LOGICAL_INO takes a btrfs_ioctl_logical_ino_args as argument, not a btrfs_ioctl_ino_path_args. The lines were probably copy/pasted when the code was written. Since btrfs_ioctl_logical_ino_args and btrfs_ioctl_ino_path_args have the same size, the actual IOCTL definition here does not

[PATCH] Btrfs: use the correct struct for BTRFS_IOC_LOGICAL_INO

2016-07-03 Thread Hans van Kranenburg
BTRFS_IOC_LOGICAL_INO takes a btrfs_ioctl_logical_ino_args as argument, not a btrfs_ioctl_ino_path_args. The lines were probably copy/pasted when the code was written. Since btrfs_ioctl_logical_ino_args and btrfs_ioctl_ino_path_args have the same size, the actual IOCTL definition here does not

Re: btrfs defrag questions

2016-07-03 Thread Adam Borowski
On Sun, Jul 03, 2016 at 04:15:02PM +0200, Henk Slager wrote: > >> Provided that Dropbox is running in the system, does it mean that it > >> cannot be defagmented? > > > > That is probably true. Files that are mapped into memory (like running > > executables) cannot be changed on disk. You could

Re: btrfs defrag questions

2016-07-03 Thread Henk Slager
On Sun, Jul 3, 2016 at 12:33 PM, Kai Krakow wrote: > Am Fri, 1 Jul 2016 22:14:00 +0200 > schrieb Dmitry Katsubo : > >> Hello everyone, >> >> Question #1: >> >> While doing defrag I got the following message: >> >> # btrfs fi defrag -r /home >> ERROR: defrag

Re: btrfs defrag questions

2016-07-03 Thread Kai Krakow
Am Fri, 1 Jul 2016 22:14:00 +0200 schrieb Dmitry Katsubo : > Hello everyone, > > Question #1: > > While doing defrag I got the following message: > > # btrfs fi defrag -r /home > ERROR: defrag failed on /home/user/.dropbox-dist/dropbox: Success > total 1 failures > > I feel