Re: synchronize btrfs snapshots over a unreliable, slow connection

2021-01-05 Thread Forza
On 2021-01-04 21:51, cedric.dew...@eclipso.eu wrote: ­I have a master NAS that makes one read only snapshot of my data per day. I want to transfer these snapshots to a slave NAS over a slow, unreliable internet connection. (it's a cheap provider). This rules out a "btrfs send -> ssh -> btrfs

Re: synchronize btrfs snapshots over a unreliable, slow connection

2021-01-05 Thread Graham Cobb
On 05/01/2021 08:34, Forza wrote: > > > On 2021-01-04 21:51, cedric.dew...@eclipso.eu wrote: >> ­I have a master NAS that makes one read only snapshot of my data per >> day. I want to transfer these snapshots to a slave NAS over a slow, >> unreliable internet connection. (it's a cheap provider).

Re: BTRFS partition corrupted after deleting files in /home

2021-01-05 Thread Sreyan Chakravarty
On Tue, Jan 5, 2021 at 5:27 AM Chris Murphy wrote: > > New new plan, ngompa built it for us in Fedora copr. > > sudo dnf install > https://download.copr.fedorainfracloud.org/results/ngompa/btrfsprogs-robustimg/fedora-33-x86_64/01858610-btrfs-progs/btrfs-progs-5.9+git20210104.5fa05dd-0.fc33.1.x86_6

Re: [PATCH v2] fs/btrfs: avoid null pointer dereference if reloc control has not been initialized

2021-01-05 Thread David Sterba
I'm keeping the rest of the mail as I received it, it's completely garbled and would need manual reformatting. The changelog and even the diff are completely on one line(!). On Tue, Jan 05, 2021 at 11:08:42AM +0800, bodefang wrote: > Similar to commmit<389305b2aa68>(“btrfs: relocation: Only remove

Re: synchronize btrfs snapshots over a unreliable, slow connection

2021-01-05 Thread Roman Mamedov
On Tue, 5 Jan 2021 11:24:24 + Graham Cobb wrote: > used that approach as the (old) NAS I was using had a very old linux > version and didn't even run btrfs. One anecdote -- I do use an old D-Link DNS-323 NAS with old kernel and distro (older Debian), and only ~60 MB of RAM to serve a 8 TB d

Re: synchronize btrfs snapshots over a unreliable, slow connection

2021-01-05 Thread Cerem Cem ASLAN
I also thought about a different approach in the past: 1. Take a snapshot and rsync it to the server. 2. When it succeeds, make it readonly and take a note on the remote site that indicates the Received_UUID and checksum of entire subvolume. 3. When you want to send your diff, run `btrfs send -p .

Re: Question about btrfs and XOR offloading

2021-01-05 Thread David Sterba
On Mon, Jan 04, 2021 at 02:56:59PM -0800, Rosen Penev wrote: > On Mon, Jan 4, 2021 at 6:46 AM David Sterba wrote: > > > > On Sat, Jan 02, 2021 at 07:50:38PM -0800, Rosen Penev wrote: > > > I've noticed that internally, btrfs' XOR code is CPU only. Does anyone > > > know if there is a performance a

Re: [PATCH] btrfs-progs: a bunch of typo fixes

2021-01-05 Thread David Sterba
On Fri, Dec 25, 2020 at 08:15:11PM +0100, Adam Borowski wrote: > Signed-off-by: Adam Borowski Thanks, added to devel.

Re: [PATCH] btrfs-progs: fix unterminated long opts for send

2021-01-05 Thread David Sterba
On Fri, Dec 25, 2020 at 08:15:30PM +0100, Adam Borowski wrote: > Any use of a long option would crash. > > Signed-off-by: Adam Borowski Omar sent this fix within another series, I've added it to devel some time ago. https://lore.kernel.org/linux-btrfs/e0aff7fddf35f0f18ff21d1e2e50a5d127254392.16

Re: [PATCH] btrfs-progs: btrfs-convert: copy ext4 extra timespec

2021-01-05 Thread David Sterba
On Fri, Dec 25, 2020 at 04:45:38PM +0900, Jiachen YANG wrote: > Currently btrfs-convert only copies ext2 inode timestamps > i_[cma]time from ext4, while filling 0 to nsec and crtime fields. > > This change copies nsec and crtime by parsing i_[cma]time_extra fields. Thanks, added to devel, with so

Re: Re: Raid1 of a slow hdd and a fast(er) SSD, howto to prioritize the SSD?

2021-01-05 Thread
>> I was expecting btrfs to do almost all reads from the fast SSD, as both the data and the metadata is on that drive, so the slow hdd is only really needed when there's a bitflip on the SSD, and the data has to be reconstructed. > IIRC there will be some read policy feature to do that, but not ye

Re: [PATCH] btrfs: relocation: fix wrong file extent type check to avoid false -ENOENT error

2021-01-05 Thread Stéphane Lesimple
FWIW, just recompiled with the patch to be 100% sure, as I still had the problematic FS around untouched: [ 199.722122] BTRFS info (device dm-10): balance: start -dvrange=34625344765952..34625344765953 [ 199.730267] BTRFS info (device dm-10): relocating block group 34625344765952 flags data|ra

Re: Raid1 of a slow hdd and a fast(er) SSD, howto to prioritize the SSD?

2021-01-05 Thread Stéphane Lesimple
January 5, 2021 7:20 PM, cedric.dew...@eclipso.eu wrote: >>> I was expecting btrfs to do almost all reads from the fast SSD, as both > > the data and the metadata is on that drive, so the slow hdd is only really > needed when there's a bitflip on the SSD, and the data has to be > reconstructed.

Re: [LSFMMBPF 2021] A status update

2021-01-05 Thread Joao Martins
On 12/12/20 5:29 PM, Matthew Wilcox wrote: > And most urgently, when should we have the GUP meeting? On the call, > I suggested Friday the 8th of January, but I'm happy to set something > up for next week if we'd like to talk more urgently. Please propose a > date & time. I know we have people i

[PATCH] btrfs-progs: properly exclude leaves for lowmem

2021-01-05 Thread Josef Bacik
The lowmem mode excludes all referenced blocks from the allocator in order to avoid accidentally overwriting blocks while fixing the file system. However for leaves it wouldn't exclude anything, it would just pin them down, which gets cleaned up on transaction commit. We're safe for the first mod

Re: Question about btrfs and XOR offloading

2021-01-05 Thread Rosen Penev
On Tue, Jan 5, 2021 at 7:35 AM David Sterba wrote: > > On Mon, Jan 04, 2021 at 02:56:59PM -0800, Rosen Penev wrote: > > On Mon, Jan 4, 2021 at 6:46 AM David Sterba wrote: > > > > > > On Sat, Jan 02, 2021 at 07:50:38PM -0800, Rosen Penev wrote: > > > > I've noticed that internally, btrfs' XOR code

[PATCH v3 05/22] btrfs: extent_io: merge PAGE_CLEAR_DIRTY and PAGE_SET_WRITEBACK into PAGE_START_WRITEBACK

2021-01-05 Thread Qu Wenruo
PAGE_CLEAR_DIRTY and PAGE_SET_WRITEBACK are two macros used in __process_pages_contig(), to inform the function to clear page dirty and then set page writeback. However page write back and dirty are two conflict status (at least for sector size == PAGE_SIZE case), this means those two macros are a

[PATCH v3 14/22] btrfs: extent_io: make set/clear_extent_buffer_uptodate() to support subpage size

2021-01-05 Thread Qu Wenruo
For those functions, to support subpage size they just need to call btrfs_page_set/clear_uptodate() wrappers. Signed-off-by: Qu Wenruo --- fs/btrfs/extent_io.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 3bd4b9

[PATCH v3 13/22] btrfs: subpage: introduce helper for subpage error status

2021-01-05 Thread Qu Wenruo
This patch introduce the following functions to handle btrfs subpage error status: - btrfs_subpage_set_error() - btrfs_subpage_clear_error() - btrfs_subpage_test_error() Those helpers can only be called when the range is ensured to be inside the page. - btrfs_page_set_error() - btrfs_page_clea

[PATCH v3 09/22] btrfs: extent_io: make grab_extent_buffer_from_page() to handle subpage case

2021-01-05 Thread Qu Wenruo
For subpage case, grab_extent_buffer() can't really get an extent buffer just from btrfs_subpage. Although we have btrfs_subpage::tree_block_bitmap, which can be used to grab the bytenr of an existing extent buffer, and can then go radix tree search to grab that existing eb. However we are still

[PATCH v3 16/22] btrfs: extent_io: implement try_release_extent_buffer() for subpage metadata support

2021-01-05 Thread Qu Wenruo
Unlike the original try_release_extent_buffer, try_release_subpage_extent_buffer() will iterate through btrfs_subpage::tree_block_bitmap, and try to release each extent buffer. Signed-off-by: Qu Wenruo --- fs/btrfs/extent_io.c | 76 1 file changed, 76

[PATCH v3 02/22] btrfs: extent_io: refactor __extent_writepage_io() to improve readability

2021-01-05 Thread Qu Wenruo
The refactor involves the following modifications: - iosize alignment In fact we don't really need to manually do alignment at all. All extent maps should already be aligned, thus basic ASSERT() check would be enough. - redundant variables We have extra variable like blocksize/pg_offset/en

[PATCH v3 19/22] btrfs: disk-io: introduce subpage metadata validation check

2021-01-05 Thread Qu Wenruo
For subpage metadata validation check, there are some difference: - Read must finish in one bvec Since we're just reading one subpage range in one page, it should never be split into two bios nor two bvecs. - How to grab the existing eb Instead of grabbing eb using page->private, we have to

[PATCH v3 18/22] btrfs: extent_io: make endio_readpage_update_page_status() to handle subpage case

2021-01-05 Thread Qu Wenruo
To handle subpage status update, add the following new tricks: - Use btrfs_page_*() helpers to update page status Now we can handle both cases well. - No page unlock for subpage metadata Since subpage metadata doesn't utilize page locking at all, skip it. For subpage data locking, it's handl

[PATCH v3 04/22] btrfs: extent_io: update locked page dirty/writeback/error bits in __process_pages_contig()

2021-01-05 Thread Qu Wenruo
When __process_pages_contig() get called for extent_clear_unlock_delalloc(), if we hit the locked page, only Private2 bit is updated, but dirty/writeback/error bits are all skiped. There are several call sites call extent_clear_unlock_delalloc() with @locked_page and PAGE_CLEAR_DIRTY/PAGE_SET_WRIT

[PATCH v3 11/22] btrfs: extent_io: attach private to dummy extent buffer pages

2021-01-05 Thread Qu Wenruo
Even for regular btrfs, there are locations where we allocate dummy extent buffers for temporary usage. Like tree_mod_log_rewind() and get_old_root(). Those dummy extent buffers will be handled by the same eb accessors, and if they don't have page::private subpage eb accessors can fail. To addre

[PATCH v3 10/22] btrfs: extent_io: support subpage for extent buffer page release

2021-01-05 Thread Qu Wenruo
In btrfs_release_extent_buffer_pages(), we need to add extra handling for subpage. To do so, introduce a new helper, detach_extent_buffer_page(), to do different handling for regular and subpage cases. For subpage case, the new trick is to clear the range of current extent buffer, and detach page

[PATCH v3 06/22] btrfs: extent_io: introduce a helper to grab an existing extent buffer from a page

2021-01-05 Thread Qu Wenruo
This patch will extract the code to grab an extent buffer from a page into a helper, grab_extent_buffer_from_page(). This reduces one indent level, and provides the work place for later expansion for subapge support. Reviewed-by: Johannes Thumshirn Signed-off-by: Qu Wenruo --- fs/btrfs/extent_

[PATCH v3 12/22] btrfs: subpage: introduce helper for subpage uptodate status

2021-01-05 Thread Qu Wenruo
This patch introduce the following functions to handle btrfs subpage uptodate status: - btrfs_subpage_set_uptodate() - btrfs_subpage_clear_uptodate() - btrfs_subpage_test_uptodate() Those helpers can only be called when the range is ensured to be inside the page. - btrfs_page_set_uptodate() -

[PATCH v3 00/22] btrfs: add read-only support for subpage sector size

2021-01-05 Thread Qu Wenruo
Patches can be fetched from github: https://github.com/adam900710/linux/tree/subpage Currently the branch also contains partial RW data support (still some out-of-sync subpage data page status). Great thanks to David for his effort reviewing and merging the preparation patches into misc-next. Now

[PATCH v3 01/22] btrfs: extent_io: rename @offset parameter to @disk_bytenr for submit_extent_page()

2021-01-05 Thread Qu Wenruo
The parameter @offset can't be more confusing. In fact that parameter is the disk bytenr for metadata/data. Rename it to @disk_bytenr and update the comment to reduce confusion. Since we're here, also rename all @offset passed into submit_extent_page() to @disk_bytenr. Reviewed-by: Josef Bacik

[PATCH v3 07/22] btrfs: extent_io: introduce the skeleton of btrfs_subpage structure

2021-01-05 Thread Qu Wenruo
For btrfs subpage support, we need a structure to record extra info for the status of each sectors of a page. This patch will introduce the skeleton structure for future btrfs subpage support. All subpage related code would go to subpage.[ch] to avoid populating the existing code base. Reviewed-b

[PATCH v3 08/22] btrfs: extent_io: make attach_extent_buffer_page() to handle subpage case

2021-01-05 Thread Qu Wenruo
For subpage case, we need to allocate new memory for each metadata page. So we need to: - Allow attach_extent_buffer_page() to return int To indicate allocation failure - Prealloc page->private for alloc_extent_buffer() We don't want to call memory allocation with spinlock hold, so do preal

[PATCH v3 20/22] btrfs: introduce btrfs_subpage for data inodes

2021-01-05 Thread Qu Wenruo
To support subpage sector size, data also need extra info to make sure which sectors in a page are uptodate/dirty/... This patch will make pages for data inodes to get btrfs_subpage structure attached, and detached when the page is freed. This patch also slightly changes the timing when set_page_

[PATCH v3 03/22] btrfs: file: update comment for btrfs_dirty_pages()

2021-01-05 Thread Qu Wenruo
The original comment is from the initial merge, which has several problems: - No holes check any more - No inline decision is made Update the out-of-date comment with more correct one. Signed-off-by: Qu Wenruo --- fs/btrfs/file.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-)

[PATCH v3 21/22] btrfs: integrate page status update for read path into begin/end_page_read()

2021-01-05 Thread Qu Wenruo
In btrfs data page read path, the page status update are handled in two different locations: btrfs_do_read_page() { while (cur <= end) { /* No need to read from disk */ if (HOLE/PREALLOC/INLINE){ memset();

[PATCH v3 22/22] btrfs: allow RO mount of 4K sector size fs on 64K page system

2021-01-05 Thread Qu Wenruo
This adds the basic RO mount ability for 4K sector size on 64K page system. Currently we only plan to support 4K and 64K page system. Signed-off-by: Qu Wenruo --- fs/btrfs/disk-io.c | 24 +--- fs/btrfs/super.c | 7 +++ 2 files changed, 28 insertions(+), 3 deletions(-)

[PATCH v3 15/22] btrfs: extent_io: make btrfs_clone_extent_buffer() to be subpage compatible

2021-01-05 Thread Qu Wenruo
For btrfs_clone_extent_buffer(), it's mostly the same code of __alloc_dummy_extent_buffer(), except it has extra page copy. So to make it subpage compatible, we only need to: - Call set_extent_buffer_uptodate() instead of SetPageUptodate() This will set correct uptodate bit for subpage and regul

[PATCH v3 17/22] btrfs: extent_io: introduce read_extent_buffer_subpage()

2021-01-05 Thread Qu Wenruo
Introduce a new helper, read_extent_buffer_subpage(), to do the subpage extent buffer read. The difference between regular and subpage routines are: - No page locking Here we completely rely on extent locking. Page locking can reduce the concurrency greatly, as if we lock one page to read on

Re: [PATCH] btrfs-progs: properly exclude leaves for lowmem

2021-01-05 Thread Su Yue
On Wed 06 Jan 2021 at 05:40, Josef Bacik wrote: The lowmem mode excludes all referenced blocks from the allocator in order to avoid accidentally overwriting blocks while fixing the file system. However for leaves it wouldn't exclude anything, it would just pin them down, which gets clean

Re: Raid1 of a slow hdd and a fast(er) SSD, howto to prioritize the SSD?

2021-01-05 Thread Anand Jain
­I have put a SSD and a slow laptop HDD in btrfs raid. This was a bad idea, my system does not feel responsive. When i load a program, dstat shows half of the program is loaded from the SSD, and the rest from the slow hard drive. The drive speeds are evolving. NVME introduced lower latency

Re: [PATCH v3 20/22] btrfs: introduce btrfs_subpage for data inodes

2021-01-05 Thread kernel test robot
Hi Qu, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on kdave/for-next] [also build test WARNING on v5.11-rc2 next-20210104] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documente

Re: [PATCH v3 20/22] btrfs: introduce btrfs_subpage for data inodes

2021-01-05 Thread Qu Wenruo
On 2021/1/6 下午1:04, kernel test robot wrote: Hi Qu, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on kdave/for-next] [also build test WARNING on v5.11-rc2 next-20210104] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitt

Re: [PATCH v3 20/22] btrfs: introduce btrfs_subpage for data inodes

2021-01-05 Thread Rong Chen
On 1/6/21 1:32 PM, Qu Wenruo wrote: On 2021/1/6 下午1:04, kernel test robot wrote: Hi Qu, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on kdave/for-next] [also build test WARNING on v5.11-rc2 next-20210104] [If your patch is applied to the wrong git tree,

Re: [PATCH v3 08/22] btrfs: extent_io: make attach_extent_buffer_page() to handle subpage case

2021-01-05 Thread Qu Wenruo
On 2021/1/6 上午9:01, Qu Wenruo wrote: For subpage case, we need to allocate new memory for each metadata page. So we need to: - Allow attach_extent_buffer_page() to return int To indicate allocation failure - Prealloc page->private for alloc_extent_buffer() We don't want to call memory

[PATCH] btrfs: fixup read_policy latency

2021-01-05 Thread Anand Jain
In the meantime, since I have sent the base patch as below [1], the block layer commit 0d02129e76ed (block: merge struct block_device and struct hd_struct) has changed the first argument in the function part_stat_read_all() to struct block_device in 5.11-rc1. So the compilation will fail. This patc