Re: Why do we need these mount options?

2021-01-15 Thread waxhead
Zygo Blaxell wrote: commit space_cache / nospace_cache sdd / ssd_spread / nossd / no_ssdspread How could those be anything other than filesystem-wide options? Well being me, I tend to live in a fantasy world where BTRFS have complete world domination and has become the VFS layer. As I hav

Re: Why do we need these mount options?

2021-01-15 Thread David Sterba
On Fri, Jan 15, 2021 at 01:02:12AM +0100, waxhead wrote: > > I don't think the per-subvolume storage options were ever tracked on > > wiki, the closest match is per-subvolume mount options that's still > > there > > > > https://btrfs.wiki.kernel.org/index.php/Project_ideas#Per-subvolume_mount_opti

Btrfs progs pre-release 5.10-rc1

2021-01-15 Thread David Sterba
Hi, this is a pre-release of btrfs-progs, 5.10-rc1. The proper release is scheduled to Monday, +3 days (2021-01-18). Changelog: * scrub status: * print percentage of progress * add size unit options * fi usage: also print free space from statfs * convert: copy full 64 bit timestam

[PATCH v3] btrfs: fix possible free space tree corruption with online conversion

2021-01-15 Thread Josef Bacik
While running btrfs/011 in a loop I would often ASSERT() while trying to add a new free space entry that already existed, or get an -EEXIST while adding a new block to the extent tree, which is another indication of double allocation. This occurs because when we do the free space tree population,

[PATCH v3 1/2] btrfs: handle ->total_bytes_pinned inside the delayed ref itself

2021-01-15 Thread Josef Bacik
Currently we pass things around to figure out if we maybe free'ing data based on the state of the delayed refs head. This makes the accounting sort of confusing and hard to follow, as it's distinctly separate from the delayed ref heads stuff, but also depends on it entirely. Fix this by explicitl

[PATCH v3 0/2] ->total_bytes_pinned fixes for early ENOSPC issues

2021-01-15 Thread Josef Bacik
v2->v3: - Updated the changelog in patch 2 to refer to the patchset that inspired the change. - Added Nik's reviewed-by for patch 2. v1->v2: - Rebase onto latest misc-next. - Added Nikolay's reviewed-by for the first patch. --- Original email --- Hello, Nikolay discovered a regression with gene

[PATCH v3 2/2] btrfs: account for new extents being deleted in total_bytes_pinned

2021-01-15 Thread Josef Bacik
My recent patch set "A variety of lock contention fixes", found here https://github.com/btrfs/linux/issues/86 that reduce lock contention on the extent root by running delayed refs less often resulted in a regression in generic/371. This test fallocate()'s the fs until it's full, deletes all the

[PATCH v2] btrfs: allow single disk devices to mount with older generations

2021-01-15 Thread Josef Bacik
We have this check to make sure we don't accidentally add older devices that may have disappeared and re-appeared with an older generation from being added to an fs_devices. This makes sense, we don't want stale disks in our file system. However for single disks this doesn't really make sense. I

Re: [PATCH v12 01/41] block: add bio_add_zone_append_page

2021-01-15 Thread Josef Bacik
On 1/15/21 1:53 AM, Naohiro Aota wrote: From: Johannes Thumshirn Add bio_add_zone_append_page(), a wrapper around bio_add_hw_page() which is intended to be used by file systems that directly add pages to a bio instead of using bio_iov_iter_get_pages(). Cc: Jens Axboe Reviewed-by: Christoph He

Re: [PATCH v12 08/41] btrfs: allow zoned mode on non-zoned block devices

2021-01-15 Thread Josef Bacik
On 1/15/21 1:53 AM, Naohiro Aota wrote: From: Johannes Thumshirn Run zoned btrfs mode on non-zoned devices. This is done by "slicing up" the block-device into static sized chunks and fake a conventional zone on each of them. The emulated zone size is determined from the size of device extent.

Re: [PATCH v12 19/41] btrfs: extract page adding function

2021-01-15 Thread Josef Bacik
On 1/15/21 1:53 AM, Naohiro Aota wrote: This commit extract page adding to bio part from submit_extent_page(). The page is added only when bio_flags are the same, contiguous and the added page fits in the same stripe as pages in the bio. Condition checkings are reordered to allow early return to

Re: [PATCH v12 20/41] btrfs: use bio_add_zone_append_page for zoned btrfs

2021-01-15 Thread Josef Bacik
On 1/15/21 1:53 AM, Naohiro Aota wrote: Zoned device has its own hardware restrictions e.g. max_zone_append_size when using REQ_OP_ZONE_APPEND. To follow the restrictions, use bio_add_zone_append_page() instead of bio_add_page(). We need target device to use bio_add_zone_append_page(), so this co

Re: [PATCH v12 04/41] btrfs: use regular SB location on emulated zoned mode

2021-01-15 Thread Josef Bacik
On 1/15/21 1:53 AM, Naohiro Aota wrote: The zoned btrfs puts a superblock at the beginning of SB logging zones if the zone is conventional. This difference causes a chicken-and-egg problem for emulated zoned mode. Since the device is a regular (non-zoned) device, we cannot know if the btrfs is re

Re: [PATCH v12 05/41] btrfs: release path before calling into btrfs_load_block_group_zone_info

2021-01-15 Thread Josef Bacik
On 1/15/21 1:53 AM, Naohiro Aota wrote: From: Johannes Thumshirn Since we have no write pointer in conventional zones, we cannot determine the allocation offset from it. Instead, we set the allocation offset after the highest addressed extent. This is done by reading the extent tree in btrfs_lo

Re: [RFC][PATCH V4] btrfs: preferred_metadata: preferred device for metadata

2021-01-15 Thread Zygo Blaxell
On Sun, Jan 10, 2021 at 08:55:36PM +0100, Goffredo Baroncelli wrote: > On 1/9/21 10:23 PM, Zygo Blaxell wrote: > > > On a loaded test server, I observed 90th percentile fsync times > > drop from 7 seconds without preferred_metadata to 0.7 seconds with > > preferred_metadata when all the metadata i

Re: Why do we need these mount options?

2021-01-15 Thread Zygo Blaxell
On Fri, Jan 15, 2021 at 10:32:39AM +0100, waxhead wrote: > Zygo Blaxell wrote: > > > > > > commit > > > > space_cache / nospace_cache > > > > sdd / ssd_spread / nossd / no_ssdspread > > > > How could those be anything other than filesystem-wide options? > > > > Well being me, I tend to live in

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

2021-01-15 Thread Zygo Blaxell
On Sun, Jan 10, 2021 at 10:00:01AM +0100, Andrea Gelmini wrote: > Il giorno sab 9 gen 2021 alle ore 22:40 Zygo Blaxell > ha scritto: > > > > On Fri, Jan 08, 2021 at 08:29:45PM +0100, Andrea Gelmini wrote: > > > Il giorno ven 8 gen 2021 alle ore 09:36 ha > > > scritto: > > > > What happens when I

Re: Why do we need these mount options?

2021-01-15 Thread waxhead
David Sterba wrote: On Fri, Jan 15, 2021 at 01:02:12AM +0100, waxhead wrote: I don't think the per-subvolume storage options were ever tracked on wiki, the closest match is per-subvolume mount options that's still there https://btrfs.wiki.kernel.org/index.php/Project_ideas#Per-subvolume_moun

Re: Why do we need these mount options?

2021-01-15 Thread waxhead
Zygo Blaxell wrote: On Fri, Jan 15, 2021 at 10:32:39AM +0100, waxhead wrote: Zygo Blaxell wrote: commit space_cache / nospace_cache sdd / ssd_spread / nossd / no_ssdspread How could those be anything other than filesystem-wide options? Well being me, I tend to live in a fantasy world

Re: Why do we need these mount options?

2021-01-15 Thread Zygo Blaxell
On Sat, Jan 16, 2021 at 02:57:05AM +0100, waxhead wrote: > > > Zygo Blaxell wrote: > > On Fri, Jan 15, 2021 at 10:32:39AM +0100, waxhead wrote: > > > Zygo Blaxell wrote: > > > > > > > > > > commit > > > > > > space_cache / nospace_cache > > > > > > sdd / ssd_spread / nossd / no_ssdspread > > > >

[PATCH v4 08/18] btrfs: introduce helper for subpage uptodate status

2021-01-15 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 v4 00/18] btrfs: add read-only support for subpage sector size

2021-01-15 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 ordered extent and data csum mismatch problems) Great thanks to David/Nikolay/Josef for their effort reviewing and merging the preparation pat

[PATCH v4 09/18] btrfs: introduce helper for subpage error status

2021-01-15 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 v4 10/18] btrfs: make set/clear_extent_buffer_uptodate() to support subpage size

2021-01-15 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 7f94f0

[PATCH v4 13/18] btrfs: introduce read_extent_buffer_subpage()

2021-01-15 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

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

2021-01-15 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 v4 17/18] btrfs: integrate page status update for data read path into begin/end_page_read()

2021-01-15 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 v4 15/18] btrfs: disk-io: introduce subpage metadata validation check

2021-01-15 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 v4 18/18] btrfs: allow RO mount of 4K sector size fs on 64K page system

2021-01-15 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 v4 11/18] btrfs: make btrfs_clone_extent_buffer() to be subpage compatible

2021-01-15 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 v4 12/18] btrfs: implement try_release_extent_buffer() for subpage metadata support

2021-01-15 Thread Qu Wenruo
Unlike the original try_release_extent_buffer(), try_release_subpage_extent_buffer() will iterate through all the ebs in the page, and try to release each eb. And only if the page and no private attached, which implies we have released all ebs of the page, then we can release the full page. Signe

[PATCH v4 16/18] btrfs: introduce btrfs_subpage for data inodes

2021-01-15 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 v4 03/18] btrfs: introduce the skeleton of btrfs_subpage structure

2021-01-15 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 v4 04/18] btrfs: make attach_extent_buffer_page() to handle subpage case

2021-01-15 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 btrfs_subpage structure for alloc_extent_buffer() We don't want to call memory allocation with spinlock hold, so

[PATCH v4 02/18] btrfs: merge PAGE_CLEAR_DIRTY and PAGE_SET_WRITEBACK into PAGE_START_WRITEBACK

2021-01-15 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 v4 06/18] btrfs: support subpage for extent buffer page release

2021-01-15 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 about when to detach the page private. For unammped (dummy

[PATCH v4 01/18] btrfs: update locked page dirty/writeback/error bits in __process_pages_contig()

2021-01-15 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 skipped. There are several call sites call extent_clear_unlock_delalloc() with @locked_page and PAGE_CLEAR_DIRTY/PAGE_SET_WRI

[PATCH v4 05/18] btrfs: make grab_extent_buffer_from_page() to handle subpage case

2021-01-15 Thread Qu Wenruo
For subpage case, grab_extent_buffer() can't really get an extent buffer just from btrfs_subpage. Thankfully we have radix tree lock protecting us from inserting the same eb into the tree. Thus we don't really need to do the extra hassle, just let alloc_extent_buffer() to handle existing eb in ra

[PATCH v4 07/18] btrfs: attach private to dummy extent buffer pages

2021-01-15 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

Re: Why do we need these mount options?

2021-01-15 Thread Andrei Borzenkov
15.01.2021 06:54, Zygo Blaxell пишет: > > On the other hand, I'm in favor of deprecating the whole discard option > and going with fstrim instead. discard in its current form tends to > increase write wear rather than decrease it, especially on metadata-heavy > workloads. discard is roughly equi