Re: [PATCH 00/15] btrfs: Hot spare and Auto replace

2015-11-15 Thread Christoph Anton Mitterer
Hey. You guys may want to update: https://btrfs.wiki.kernel.org/index.php/Project_ideas#Hot_spare_support Cheers, Chris. smime.p7s Description: S/MIME cryptographic signature

BUG: failure at fs/btrfs/ctree.h:337/btrfs_chunk_item_size()!

2015-11-15 Thread Vegard Nossum
Hi, With the attached btrfs image, I get the following splat when mounting: """ # mount -o loop -t btrfs ./btrfs.0 /mnt/0/ BTRFS: device fsid 9006933e-2a9a-44f0-917f-514252aeec2c devid 1 transid 7 /dev/loop0 BTRFS info (device loop0): disk space caching is enabled BUG: failure at

Re: BTRFS Error - Rockstor

2015-11-15 Thread Qu Wenruo
Oh, before really doing some coding to allow btrfs-find-root to search under chunk tree broken case, It occurs to me that we have already a better recovery tool for it. You can use 'btrfs rescue chunk-recovery' to recovery your chunk tree. It may has some risk, but the overall work flow is much

Re: Where is the disk space?

2015-11-15 Thread Qu Wenruo
Liu Bo wrote on 2015/11/14 22:35 -0800: Hi, On Fri, Nov 13, 2015 at 09:41:01AM -0800, Marc MERLIN wrote: root@polgara:/mnt/btrfs_root# du -sh * 28G @ 28G @_hourly.20151113_08:04:01 4.0K@_last 4.0K@_last_rw 28G @_rw.20151113_00:02:01 root@polgara:/mnt/btrfs_root# df -h .

[PATCH V9 01/12] Btrfs: __btrfs_buffered_write: Reserve/release extents aligned to block size

2015-11-15 Thread Chandan Rajendra
Currently, the code reserves/releases extents in multiples of PAGE_CACHE_SIZE units. Fix this by doing reservation/releases in block size units. Reviewed-by: Josef Bacik Signed-off-by: Chandan Rajendra --- fs/btrfs/ctree.h | 3 +++ fs/btrfs/file.c |

[PATCH V9 00/12] Btrfs: Pre subpagesize-blocksize cleanups

2015-11-15 Thread Chandan Rajendra
The patches posted along with this cover letter are cleanups made during the development of subpagesize-blocksize patchset. I believe that they can be integrated with the mainline kernel. Hence I have posted them separately from the subpagesize-blocksize patchset. I have tested the patchset by

[RFC PATCH V12 08/14] Btrfs: subpagesize-blocksize: Deal with partial ordered extent allocations.

2015-11-15 Thread Chandan Rajendra
In subpagesize-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 V9 06/12] Btrfs: Search for all ordered extents that could span across a page

2015-11-15 Thread Chandan Rajendra
In subpagesize-blocksize scenario it is not sufficient to search using the first byte of the page to make sure that there are no ordered extents present across the page. Fix this. Signed-off-by: Chandan Rajendra --- fs/btrfs/extent_io.c | 3 ++- fs/btrfs/inode.c

[PATCH V9 05/12] Btrfs: btrfs_page_mkwrite: Reserve space in sectorsized units

2015-11-15 Thread Chandan Rajendra
In subpagesize-blocksize scenario, if i_size occurs in a block which is not the last block in the page, then the space to be reserved should be calculated appropriately. Reviewed-by: Liu Bo Signed-off-by: Chandan Rajendra --- fs/btrfs/inode.c |

[PATCH V9 07/12] Btrfs: Use (eb->start, seq) as search key for tree modification log

2015-11-15 Thread Chandan Rajendra
In subpagesize-blocksize a page can map multiple extent buffers and hence using (page index, seq) as the search key is incorrect. For example, searching through tree modification log tree can return an entry associated with the first extent buffer mapped by the page (if such an entry exists), when

[PATCH V9 08/12] Btrfs: btrfs_submit_direct_hook: Handle map_length < bio vector length

2015-11-15 Thread Chandan Rajendra
In subpagesize-blocksize scenario, map_length can be less than the length of a bio vector. Such a condition may cause btrfs_submit_direct_hook() to submit a zero length bio. Fix this by comparing map_length against block size rather than with bv_len. Signed-off-by: Chandan Rajendra

[PATCH V9 12/12] Btrfs: prepare_pages: Retry adding a page to the page cache

2015-11-15 Thread Chandan Rajendra
When reading the page from the disk, we can race with Direct I/O which can get the page lock (before prepare_uptodate_page() gets it) and can go ahead and invalidate the page. Hence if the page is not found in the inode's address space, retry the operation of getting a page. Reported-by: Jakub

[PATCH V9 10/12] Btrfs: Fix block size returned to user space

2015-11-15 Thread Chandan Rajendra
btrfs_getattr() returns PAGE_CACHE_SIZE as the block size. Since generic_fillattr() already does the right thing (by obtaining block size from inode->i_blkbits), just remove the statement from btrfs_getattr. Reviewed-by: Josef Bacik Signed-off-by: Chandan Rajendra

[PATCH V9 04/12] Btrfs: fallocate: Work with sectorsized blocks

2015-11-15 Thread Chandan Rajendra
While at it, this commit changes btrfs_truncate_page() to truncate sectorsized blocks instead of pages. Hence the function has been renamed to btrfs_truncate_block(). Signed-off-by: Chandan Rajendra --- fs/btrfs/ctree.h | 2 +- fs/btrfs/file.c | 44

[PATCH V9 02/12] Btrfs: Compute and look up csums based on sectorsized blocks

2015-11-15 Thread Chandan Rajendra
Checksums are applicable to sectorsize units. The current code uses bio->bv_len units to compute and look up checksums. This works on machines where sectorsize == PAGE_SIZE. This patch makes the checksum computation and look up code to work with sectorsize units. Reviewed-by: Liu Bo

[PATCH V9 09/12] Btrfs: Limit inline extents to root->sectorsize

2015-11-15 Thread Chandan Rajendra
cow_file_range_inline() limits the size of an inline extent to PAGE_CACHE_SIZE. This breaks in subpagesize-blocksize scenarios. Fix this by comparing against root->sectorsize. Reviewed-by: Josef Bacik Signed-off-by: Chandan Rajendra ---

[PATCH V9 11/12] Btrfs: Clean pte corresponding to page straddling i_size

2015-11-15 Thread Chandan Rajendra
When extending a file by either "truncate up" or by writing beyond i_size, the page which had i_size needs to be marked "read only" so that future writes to the page via mmap interface causes btrfs_page_mkwrite() to be invoked. If not, a write performed after extending the file via the mmap

[RFC PATCH V12 05/14] Btrfs: subpagesize-blocksize: Read tree blocks whose size is < PAGE_SIZE.

2015-11-15 Thread Chandan Rajendra
In the case of subpagesize-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 | 62 +--

[RFC PATCH V12 13/14] Btrfs: subpagesize-blocksize: Fix file defragmentation code

2015-11-15 Thread Chandan Rajendra
This commit gets file defragmentation code to work in subpagesize-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

[RFC PATCH V12 04/14] Btrfs: subpagesize-blocksize: Define extent_buffer_head.

2015-11-15 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'

[RFC PATCH V12 02/14] Btrfs: subpagesize-blocksize: Fix whole page write

2015-11-15 Thread Chandan Rajendra
For the subpagesize-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

[RFC PATCH V12 14/14] Btrfs: subpagesize-blocksize: extent_clear_unlock_delalloc: Prevent page from being unlocked more than once

2015-11-15 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

[RFC PATCH V12 11/14] Btrfs: subpagesize-blocksize: Prevent writes to an extent buffer when PG_writeback flag is set.

2015-11-15 Thread Chandan Rajendra
In non-subpagesize-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 subpagesize-blocksize scenario, since we have more than one extent buffer mapped to

[RFC PATCH V12 07/14] Btrfs: subpagesize-blocksize: Allow mounting filesystems where sectorsize != PAGE_SIZE

2015-11-15 Thread Chandan Rajendra
This patch allows mounting filesystems with blocksize smaller than the PAGE_SIZE. Signed-off-by: Chandan Rajendra --- fs/btrfs/disk-io.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index

[RFC PATCH V12 06/14] Btrfs: subpagesize-blocksize: Write only dirty extent buffers belonging to a page

2015-11-15 Thread Chandan Rajendra
For the subpagesize-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 | 19 ++-- fs/btrfs/extent_io.c | 277 +-- 2

[RFC PATCH V12 09/14] Btrfs: subpagesize-blocksize: Explicitly track I/O status of blocks of an ordered extent.

2015-11-15 Thread Chandan Rajendra
In subpagesize-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 ---

[RFC PATCH V12 00/14] Btrfs: Subpagesize-blocksize: Allow I/O on blocks whose size is less than page size.

2015-11-15 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

[RFC PATCH V12 10/14] Btrfs: subpagesize-blocksize: btrfs_punch_hole: Use EXTENT_UPTODATE bit to check for the presence of block in page cache

2015-11-15 Thread Chandan Rajendra
In subpagesize-blocksize, we have multiple blocks in a page. Checking for existence of a page in the page cache isn't a sufficient check, since we could be truncating a subset of the blocks mapped by the page. So if the blocks that are neighboring the truncated block exist in the page cache,

[RFC PATCH V12 12/14] Revert "btrfs: fix lockups from btrfs_clear_path_blocking"

2015-11-15 Thread Chandan Rajendra
This reverts commit f82c458a2c3ffb94b431fc6ad791a79df1b3713e. --- fs/btrfs/ctree.c | 14 -- fs/btrfs/locking.c | 24 +++- fs/btrfs/locking.h | 2 -- 3 files changed, 15 insertions(+), 25 deletions(-) diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index

[RFC PATCH V12 01/14] Btrfs: subpagesize-blocksize: Fix whole page read.

2015-11-15 Thread Chandan Rajendra
For the subpagesize-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 page->private. Signed-off-by: Chandan Rajendra

[RFC PATCH V12 03/14] Btrfs: subpagesize-blocksize: Make sure delalloc range intersects with the locked page's range

2015-11-15 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

Re: More memory more jitters?

2015-11-15 Thread Patrik Lundquist
On 14 November 2015 at 15:11, CHENG Yuk-Pong, Daniel wrote: > > Background info: > > I am running a heavy-write database server with 96GB ram. In the worse > case it cause multi minutes of high cpu loads. Systemd keeping kill > and restarting services, and old job don't die