Re: Bug Report: Btrfs prompts "can't allocate space for delete" when block size arounds 512M

2019-08-02 Thread Hongzhi, Song
Add linux-ker...@vger.kernel.org. Ping... Thanks, --Hongzhi On 7/17/19 4:34 PM, Hongzhi, Song wrote: Hi friends, *Description:*     One LTP testcase, fs_fill.c, fails on btrfs with kernel error when unlink files on Btrfs device:     "BTRFS warning (device loop0): could not allocate sp

Re: [RFC] BTRFS_DEV_REPLACE_ITEM_STATE_* doesn't match with on disk

2019-08-02 Thread David Sterba
On Mon, Nov 12, 2018 at 09:50:36AM +0200, Nikolay Borisov wrote: > On 12.11.18 г. 6:58 ч., Anand Jain wrote: > > The dev_replace_state defines are miss matched between the > > BTRFS_IOCTL_DEV_REPLACE_STATE_* and BTRFS_DEV_REPLACE_ITEM_STATE_* [1]. > > > > [1] > > - > >

The btrfs 'label' property: device or filesystem-wide?

2019-08-02 Thread Hans van Kranenburg
Hi, I was just looking at btrfs property and what it can do. Now, I notice that the man page contains: label: label of device When I look at a device and ask what properties I can set, I see: -# btrfs property list -t device /dev/xvdb label Set/get label of device. But, when I

Re: The btrfs 'label' property: device or filesystem-wide?

2019-08-02 Thread Anand Jain
On 8/2/19 5:42 PM, Hans van Kranenburg wrote: Hi, I was just looking at btrfs property and what it can do. Now, I notice that the man page contains: label: label of device When I look at a device and ask what properties I can set, I see: -# btrfs property list -t device /dev/xvdb label

[PATCH] btrfs-progs: add a --check-bg-usage option to fsck

2019-08-02 Thread Josef Bacik
Sometimes when messing with the chunk allocator code we can end up over-allocating chunks. Generally speaking I'll notice this when a random xfstest fails with ENOSPC when it shouldn't, but I'm super worried that I won't catch a problem until somebody has a fs completely filled up with empty block

[PATCH 03/13] btrfs: factor sysfs code out of link_block_group

2019-08-02 Thread David Sterba
The part of link_block_group that just creates the sysfs object is independent and can be factored out to a helper. Signed-off-by: David Sterba --- fs/btrfs/extent-tree.c | 18 ++ fs/btrfs/sysfs.c | 27 +++ fs/btrfs/sysfs.h | 1 + 3 files chan

[PATCH 01/13] btrfs: move sysfs declarations out of ctree.h

2019-08-02 Thread David Sterba
As the header for sysfs code already exists, use it to clean up ctree.h. Signed-off-by: David Sterba --- fs/btrfs/ctree.h | 13 - fs/btrfs/super.c | 1 + fs/btrfs/sysfs.h | 12 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/

[PATCH 11/13] btrfs: cleanup kobject.h includes

2019-08-02 Thread David Sterba
The kobject should be pulled in via sysfs.h and that needs to include it because it needs various definitions like kobj_attribute or kobject. Signed-off-by: David Sterba --- fs/btrfs/ctree.h | 1 - fs/btrfs/sysfs.c | 1 - fs/btrfs/sysfs.h | 2 ++ 3 files changed, 2 insertions(+), 2 deletions(-)

[PATCH 09/13] btrfs: factor out sysfs code for deleting block group and space infos

2019-08-02 Thread David Sterba
The helpers to create block group and space info directories already live in sysfs.c, move the deletion part there too. Signed-off-by: David Sterba --- fs/btrfs/extent-tree.c | 14 +- fs/btrfs/sysfs.c | 22 ++ fs/btrfs/sysfs.h | 1 + 3 files changed,

[PATCH 02/13] btrfs: move btrfs_add_raid_kobjects to sysfs.c

2019-08-02 Thread David Sterba
The function manipulates sysfs entries so this belongs to sysfs.c. Signed-off-by: David Sterba --- fs/btrfs/ctree.h | 1 - fs/btrfs/extent-tree.c | 27 --- fs/btrfs/sysfs.c | 27 +++ fs/btrfs/sysfs.h | 1 + 4 files changed, 28 i

[PATCH 07/13] btrfs: sysfs: replace direct access to feature set names with a helper

2019-08-02 Thread David Sterba
In order to unexport the feature type array, add a helper for the enum-to-string conversion. Signed-off-by: David Sterba --- fs/btrfs/ioctl.c | 2 +- fs/btrfs/sysfs.c | 7 ++- fs/btrfs/sysfs.h | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/

[PATCH 13/13] btrfs: sysfs: move type conversion helpers to sysfs.c

2019-08-02 Thread David Sterba
Signed-off-by: David Sterba --- fs/btrfs/sysfs.c | 17 + fs/btrfs/sysfs.h | 18 -- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index e306e6e173cf..335450ad9d2d 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sys

[PATCH 08/13] btrfs: factor out sysfs code for sending device uevent

2019-08-02 Thread David Sterba
The device uevent belongs to the sysfs API. Signed-off-by: David Sterba --- fs/btrfs/sysfs.c | 11 +++ fs/btrfs/sysfs.h | 1 + fs/btrfs/volumes.c | 13 - 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index 0d37403a47

[PATCH 06/13] btrfs: sysfs: unexport space_info_ktype

2019-08-02 Thread David Sterba
The last non-sysfs usage of space_info_ktype has been moved to a private helper in previous patch so the variable can be made static. Signed-off-by: David Sterba --- fs/btrfs/sysfs.c | 2 +- fs/btrfs/sysfs.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/btrfs/sysfs.c b/

[PATCH 05/13] btrfs: factor out sysfs code for creating space infos

2019-08-02 Thread David Sterba
Move creation of data/metadata/system space info directories to sysfs.c. Signed-off-by: David Sterba --- fs/btrfs/space-info.c | 25 ++--- fs/btrfs/sysfs.c | 37 + fs/btrfs/sysfs.h | 2 ++ 3 files changed, 41 insertions(+), 23 de

[PATCH 12/13] btrfs: sysfs: move helper macros to sysfs.c

2019-08-02 Thread David Sterba
None of the macros is used outside of sysfs.c. Signed-off-by: David Sterba --- fs/btrfs/sysfs.c | 49 +++ fs/btrfs/sysfs.h | 50 2 files changed, 49 insertions(+), 50 deletions(-) diff --git a/fs/btrfs/

[PATCH 00/13] Sysfs cleanups

2019-08-02 Thread David Sterba
Handful of almost trivial changes that clean up the sysfs structures and helpers so the sysfs-related api is used only inside sysfs.c and that the API facing btrfs is minimized. David Sterba (13): btrfs: move sysfs declarations out of ctree.h btrfs: move btrfs_add_raid_kobjects to sysfs.c bt

[PATCH 10/13] btrfs: factor out sysfs code for updating sprout fsid

2019-08-02 Thread David Sterba
Wrap the fsid renaming code and move it to sysfs.c. Signed-off-by: David Sterba --- fs/btrfs/sysfs.c | 15 +++ fs/btrfs/sysfs.h | 2 ++ fs/btrfs/volumes.c | 12 ++-- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c inde

[PATCH 04/13] btrfs: sysfs: unexport btrfs_raid_ktype

2019-08-02 Thread David Sterba
The last non-sysfs usage of btrfs_raid_ktype has been moved to a private helper in previous patch so the variable can be made static. Signed-off-by: David Sterba --- fs/btrfs/sysfs.c | 2 +- fs/btrfs/sysfs.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/btrfs/sysfs.c b/

Re: The btrfs 'label' property: device or filesystem-wide?

2019-08-02 Thread Hans van Kranenburg
Hi, On 8/2/19 2:54 PM, Anand Jain wrote: > > So at both, btrfs fi label and btrfs prop set the label works on the > mount-point or the device path if its unmounted. And even if the device > path is used the label is for the whole filesystem. Aha, clear. Thanks! Hans

Re: [PATCH] btrfs-progs: add a --check-bg-usage option to fsck

2019-08-02 Thread Qu Wenruo
On 2019/8/2 下午9:06, Josef Bacik wrote: > Sometimes when messing with the chunk allocator code we can end up > over-allocating chunks. Generally speaking I'll notice this when a > random xfstest fails with ENOSPC when it shouldn't, but I'm super > worried that I won't catch a problem until somebo

Re: [PATCH 00/25] btrfs: migrate the block group code

2019-08-02 Thread David Sterba
On Thu, Jun 20, 2019 at 03:37:42PM -0400, Josef Bacik wrote: > This is the series to migrate the block group code out of extent-tree.c. This > is a much larger series than the previous two series because things were much > more intertwined than block_rsv's and space_info. There is one code change

Re: [PATCH 3/3] btrfs: tree-log: use symbolic name for first replay stage

2019-08-02 Thread David Sterba
On Fri, Aug 02, 2019 at 11:50:26AM +0800, Anand Jain wrote: > > For whole series. > > Reviewed-by: Anand Jain > > One nit below. > > On 8/1/19 8:50 PM, David Sterba wrote: > > Signed-off-by: David Sterba > > --- > > fs/btrfs/tree-log.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion

Re: [PATCH] btrfs-progs: add a --check-bg-usage option to fsck

2019-08-02 Thread Josef Bacik
On Fri, Aug 02, 2019 at 09:54:12PM +0800, Qu Wenruo wrote: > > > On 2019/8/2 下午9:06, Josef Bacik wrote: > > Sometimes when messing with the chunk allocator code we can end up > > over-allocating chunks. Generally speaking I'll notice this when a > > random xfstest fails with ENOSPC when it shoul

Re: [PATCH 00/25] btrfs: migrate the block group code

2019-08-02 Thread Josef Bacik
On Fri, Aug 02, 2019 at 03:56:38PM +0200, David Sterba wrote: > On Thu, Jun 20, 2019 at 03:37:42PM -0400, Josef Bacik wrote: > > This is the series to migrate the block group code out of extent-tree.c. > > This > > is a much larger series than the previous two series because things were > > much

[PATCH][v2] btrfs-progs: add a --check-bg-usage option to fsck

2019-08-02 Thread Josef Bacik
Sometimes when messing with the chunk allocator code we can end up over-allocating chunks. Generally speaking I'll notice this when a random xfstest fails with ENOSPC when it shouldn't, but I'm super worried that I won't catch a problem until somebody has a fs completely filled up with empty block

[PATCH] btrfs: add an ioctl to force chunk allocation

2019-08-02 Thread Josef Bacik
In testing block group removal it's sometimes handy to be able to create block groups on demand. Add an ioctl to allow us to force allocation from userspace. Signed-off-by: Josef Bacik --- fs/btrfs/ioctl.c | 30 ++ include/uapi/linux/btrfs.h | 1 + 2 files

[PATCH] btrfs-progs: add a alloc-chunk command

2019-08-02 Thread Josef Bacik
This is so we can force chunk allocation to test various parts of the fs. I used this to test my btrfsck patch for checking for empty block groups, and a weird block group removal issue. Signed-off-by: Josef Bacik --- cmds/filesystem.c | 48 +++ ioctl

[GIT PULL] Btrfs fixes for 5.3-rc3

2019-08-02 Thread David Sterba
Hi, please pull the branch with the following fixes: * tiny race window during 2 transactions aborting at the same time can accidentally lead to a commit * regression fix, possible deadlock during fiemap * fix for an old bug when incremental send can fail on a file that has been deduplicate

Re: [PATCH 00/25] btrfs: migrate the block group code

2019-08-02 Thread David Sterba
On Fri, Aug 02, 2019 at 10:07:17AM -0400, Josef Bacik wrote: > On Fri, Aug 02, 2019 at 03:56:38PM +0200, David Sterba wrote: > > On Thu, Jun 20, 2019 at 03:37:42PM -0400, Josef Bacik wrote: > > > This is the series to migrate the block group code out of extent-tree.c. > > > This > > > is a much l

Non-existent qgroup in parent-child relation prevents makes qgroup commands fail

2019-08-02 Thread Andrei Borzenkov
bor@tw:~> sudo btrfs qgroup show . ERROR: cannot find the qgroup 0/789 bor@tw:~> Fine. This openSUSE with snapper which creates and automatically destroys snapshots and apparently either kernel or snapper now also remove corresponding qgroup. I played with snapshots and created several top level q

[PATCH v2 0/13] Btrfs iomap

2019-08-02 Thread Goldwyn Rodrigues
This is an effort to use iomap for btrfs. This would keep most responsibility of page handling during writes in iomap code, hence code reduction. For CoW support, changes are needed in iomap code to make sure we perform a copy before the write. This is in line with the discussion we had during addi

[PATCH 02/13] iomap: Read page from srcmap for IOMAP_COW

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues In case of a IOMAP_COW, read a page from the srcmap before performing a write on the page. Signed-off-by: Goldwyn Rodrigues --- fs/iomap/buffered-io.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/bu

[PATCH 01/13] iomap: Use a IOMAP_COW/srcmap for a read-modify-write I/O

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Introduces a new type IOMAP_COW, which means the data at offset must be read from a srcmap and copied before performing the write on the offset. The srcmap is used to identify where the read is to be performed from. This is passed to iomap->begin() of the respective files

[PATCH 03/13] btrfs: Eliminate PagePrivate for btrfs data pages

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues While most of the code works just eliminating page's private field and related code, there is a problem when we are cloning. The extent assumes the data is uptodate. Clear the EXTENT_UPTODATE flag for the extent so the next time the file is read, it is forced to be read fr

[PATCH 08/13] btrfs: Carve out btrfs_get_extent_map_write() out of btrfs_get_blocks_write()

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues This makes btrfs_get_extent_map_write() independent of Direct I/O code. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/ctree.h | 2 ++ fs/btrfs/inode.c | 40 +++- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/fs/btr

[PATCH 11/13] btrfs: Use iomap_dio_rw for performing direct I/O writes

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Since btrfs Direct I/O needs to perform operations before submission, use the submit_io function which operates on the bio to perform checksum calculations etc. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/ctree.h | 3 ++ fs/btrfs/file.c | 2 +- fs/btrfs/inode.c |

[PATCH 04/13] btrfs: Add a simple buffered iomap write

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Introduce a new btrfs_iomap structure which contains information about the filesystem between the iomap_begin() and iomap_end() calls. This contains information about reservations and extent locking. This one is a long patch. Most of the code is "inspired" by fs/btrfs/fil

[PATCH 09/13] btrfs: Rename __endio_write_update_ordered() to btrfs_update_ordered_extent()

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Since we will be calling from another file, use a better name to declare it non-static Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/ctree.h | 7 +-- fs/btrfs/inode.c | 14 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/fs/btrfs/ctr

[PATCH 13/13] btrfs: update inode size during bio completion

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Update the inode size for dio writes during bio completion. This ties the success of the underlying block layer whether to increase the size of the inode. Especially for in aio cases. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/inode.c | 6 +- 1 file changed, 5 in

[PATCH 10/13] iomap: use a function pointer for dio submits

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues This helps filesystems to perform tasks on the bio while submitting for I/O. Since btrfs requires the position we are working on, pass pos to iomap_dio_submit_bio() The correct place for submit_io() is not page_ops. Would it better to rename the structure to something lik

[PATCH 06/13] btrfs: remove buffered write code made unnecessary

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Better done in a separate patch to keep the main patch short(er) Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/file.c | 463 1 file changed, 463 deletions(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 0

[PATCH 05/13] btrfs: Add CoW in iomap based writes

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Set iomap->type to IOMAP_COW and fill up the source map in case the I/O is not page aligned. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/iomap.c | 41 + 1 file changed, 41 insertions(+) diff --git a/fs/btrfs/iomap.c b/fs/btrfs/

[PATCH 07/13] btrfs: basic direct read operation

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Add btrfs_dio_iomap_ops for iomap.begin() function. In order to accomodate dio reads, add a new function btrfs_file_read_iter() which would call btrfs_dio_iomap_read() for DIO reads and fallback to generic_file_read_iter otherwise. Signed-off-by: Goldwyn Rodrigues --- f

[PATCH 12/13] btrfs: Remove btrfs_dio_data and __btrfs_direct_write

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues btrfs_dio_data is unnecessary since we are now storing all informaiton in btrfs_iomap. Advantage: We don't abuse current->journal_info anymore :) Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/file.c | 40 fs/btrfs/inode.c | 81 ++---

Re: [GIT PULL] Btrfs fixes for 5.3-rc3

2019-08-02 Thread pr-tracker-bot
The pull request you sent on Fri, 2 Aug 2019 18:50:19 +0200: > git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-5.3-rc2-tag has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/d38c3fa6f959b8b5b167f120d70d66418714dbe4 Thank you! -- Deet-doot-dot, I am a

Re: Non-existent qgroup in parent-child relation prevents makes qgroup commands fail

2019-08-02 Thread Qu Wenruo
On 2019/8/3 上午2:08, Andrei Borzenkov wrote: > bor@tw:~> sudo btrfs qgroup show . > ERROR: cannot find the qgroup 0/789 > bor@tw:~> > > Fine. This openSUSE with snapper which creates and automatically > destroys snapshots and apparently either kernel or snapper now also > remove corresponding qgr

Re: [PATCH 10/13] iomap: use a function pointer for dio submits

2019-08-02 Thread Darrick J. Wong
On Fri, Aug 02, 2019 at 05:00:45PM -0500, Goldwyn Rodrigues wrote: > From: Goldwyn Rodrigues > > This helps filesystems to perform tasks on the bio while > submitting for I/O. Since btrfs requires the position > we are working on, pass pos to iomap_dio_submit_bio() What /does/ btrfs_submit_direc

Re: [PATCH 02/13] iomap: Read page from srcmap for IOMAP_COW

2019-08-02 Thread Darrick J. Wong
On Fri, Aug 02, 2019 at 05:00:37PM -0500, Goldwyn Rodrigues wrote: > From: Goldwyn Rodrigues > > In case of a IOMAP_COW, read a page from the srcmap before > performing a write on the page. Looks ok, I think... Reviewed-by: Darrick J. Wong --D > > Signed-off-by: Goldwyn Rodrigues > --- > f

Re: [PATCH 01/13] iomap: Use a IOMAP_COW/srcmap for a read-modify-write I/O

2019-08-02 Thread Darrick J. Wong
On Fri, Aug 02, 2019 at 05:00:36PM -0500, Goldwyn Rodrigues wrote: > From: Goldwyn Rodrigues > > Introduces a new type IOMAP_COW, which means the data at offset > must be read from a srcmap and copied before performing the > write on the offset. > > The srcmap is used to identify where the read

Re: Non-existent qgroup in parent-child relation prevents makes qgroup commands fail

2019-08-02 Thread Andrei Borzenkov
03.08.2019 2:09, Qu Wenruo пишет: > > > On 2019/8/3 上午2:08, Andrei Borzenkov wrote: >> bor@tw:~> sudo btrfs qgroup show . >> ERROR: cannot find the qgroup 0/789 >> bor@tw:~> >> >> Fine. This openSUSE with snapper which creates and automatically >> destroys snapshots and apparently either kernel o

Re: Non-existent qgroup in parent-child relation prevents makes qgroup commands fail

2019-08-02 Thread Qu Wenruo
On 2019/8/3 下午1:31, Andrei Borzenkov wrote: > 03.08.2019 2:09, Qu Wenruo пишет: >> >> >> On 2019/8/3 上午2:08, Andrei Borzenkov wrote: >>> bor@tw:~> sudo btrfs qgroup show . >>> ERROR: cannot find the qgroup 0/789 >>> bor@tw:~> >>> >>> Fine. This openSUSE with snapper which creates and automaticall

[PATCH] btrfs: qgroup: Try our best to delete qgroup relations

2019-08-02 Thread Qu Wenruo
When we try to delete qgroups, we're pretty cautious, we make sure both qgroups exist and there is a relationship between them, then try to delete the relation. This behavior is OK, but the problem is we need to two relation items, and if we failed the first item deletion, we error out, leaving th

Re: Non-existent qgroup in parent-child relation prevents makes qgroup commands fail

2019-08-02 Thread Andrei Borzenkov
03.08.2019 9:17, Qu Wenruo пишет: > > > On 2019/8/3 下午1:31, Andrei Borzenkov wrote: >> 03.08.2019 2:09, Qu Wenruo пишет: >>> >>> >>> On 2019/8/3 上午2:08, Andrei Borzenkov wrote: bor@tw:~> sudo btrfs qgroup show . ERROR: cannot find the qgroup 0/789 bor@tw:~> Fine. This ope