[PATCH 1/1] btrfs: introduce feature to forget a btrfs device

2018-01-10 Thread Anand Jain
Support for a new command 'btrfs dev forget [dev]' is proposed here, to undo the effects of 'btrfs dev scan [dev]'. For this purpose, this patch proposes to use ioctl #5 as it was empty. IOW(BTRFS_IOCTL_MAGIC, 5, ..) This patch adds new ioctl BTRFS_IOC_FORGET_DEV which can be sent from the

Re: [PATCH] btrfs: tree-check: reduce stack consumption in check_dir_item

2018-01-10 Thread Qu Wenruo
On 2018年01月10日 22:28, David Sterba wrote: > I've noticed that the updated item checker stack consumption increased > dramatically in 542f5385e20cf97447 ("btrfs: tree-checker: Add checker > for dir item") > > tree-checker.c:check_leaf+552 (176 -> 728) > > The array is 255

[PATCH bpf-next v4 5/5] error-injection: Support fault injection framework

2018-01-10 Thread Masami Hiramatsu
Support in-kernel fault-injection framework via debugfs. This allows you to inject a conditional error to specified function using debugfs interfaces. Here is the result of test script described in Documentation/fault-injection/fault-injection.txt === # ./test_fail_function.sh 1+0

[PATCH bpf-next v4 4/5] error-injection: Add injectable error types

2018-01-10 Thread Masami Hiramatsu
Add injectable error types for each error-injectable function. One motivation of error injection test is to find software flaws, mistakes or mis-handlings of expectable errors. If we find such flaws by the test, that is a program bug, so we need to fix it. But if the tester miss input the error

[PATCH bpf-next v4 3/5] error-injection: Separate error-injection from kprobe

2018-01-10 Thread Masami Hiramatsu
Since error-injection framework is not limited to be used by kprobes, nor bpf. Other kernel subsystems can use it freely for checking safeness of error-injection, e.g. livepatch, ftrace etc. So this separate error-injection framework from kprobes. Some differences has been made: - "kprobe" word

[PATCH bpf-next v4 2/5] tracing/kprobe: bpf: Compare instruction pointer with original one

2018-01-10 Thread Masami Hiramatsu
Compare instruction pointer with original one on the stack instead using per-cpu bpf_kprobe_override flag. This patch also consolidates reset_current_kprobe() and preempt_enable_no_resched() blocks. Those can be done in one place. Signed-off-by: Masami Hiramatsu

[PATCH bpf-next v4 1/5] tracing/kprobe: bpf: Check error injectable event is on function entry

2018-01-10 Thread Masami Hiramatsu
Check whether error injectable event is on function entry or not. Currently it checks the event is ftrace-based kprobes or not, but that is wrong. It should check if the event is on the entry of target function. Since error injection will override a function to just return with modified return

[PATCH bpf-next v4 0/5] Separate error injection table from kprobes

2018-01-10 Thread Masami Hiramatsu
Hi, Here are the 4th version of patches to moving error injection table from kprobes. This series changes error-injection.h including points for ALLOW_ERROR_INJECTION macro and add Reviewed-by from Josef Bacik (except [3/5]). Here is the previous version:

[PATCH 3/4] btrfs: get device pointer from device_list_add()

2018-01-10 Thread Anand Jain
Instead of pointer to btrfs_fs_devices as an arg in device_list_add() better to get pointer to btrfs_device as return value, then we have both, pointer to btrfs_device and btrfs_fs_devices. btrfs_device is needed to handle reappearing missing device. Signed-off-by: Anand Jain

[PATCH v4 0/4] device_list_add() peparation to add reappearing missing device

2018-01-10 Thread Anand Jain
(Apply on top of my patchset [PATCH v4 0/6] preparatory work to add device forget for conflict free apply. They don't actually depend on each other though). v3->v4: @3/4: Just return device instead of PTR_ERR(ERR_PTR(device)); v2->v3: Fix device_list_add() fn description which was still

[PATCH 2/4] btrfs: set the total_devices in device_list_add()

2018-01-10 Thread Anand Jain
There is no other parent for device_list_add() except for btrfs_scan_one_device(), which would set btrfs_fs_devices::total_devices if device_list_add is successful and this can be done with in device_list_add() itself. Signed-off-by: Anand Jain Reviewed-by: Josef Bacik

[PATCH 4/4] btrfs: drop devid as device_list_add() arg

2018-01-10 Thread Anand Jain
As struct btrfs_disk_super is being passed, so it can get devid the same way its parent does. Signed-off-by: Anand Jain Reviewed-by: Josef Bacik --- fs/btrfs/volumes.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git

[PATCH 1/4] btrfs: move pr_info into device_list_add

2018-01-10 Thread Anand Jain
Commit 60999ca4b403 ("btrfs: make device scan less noisy") adds return value 1 to device_list_add(), so that parent function can call pr_info only when new device is added. Move the pr_info() part into device_list_add() so that this function can be kept simple. Signed-off-by: Anand Jain

Re: [PATCH bpf-next v3 3/5] error-injection: Separate error-injection from kprobe

2018-01-10 Thread Masami Hiramatsu
On Wed, 10 Jan 2018 10:36:15 -0500 Josef Bacik wrote: > On Wed, Jan 10, 2018 at 07:18:05PM +0900, Masami Hiramatsu wrote: > > Since error-injection framework is not limited to be used > > by kprobes, nor bpf. Other kernel subsystems can use it > > freely for checking

Re: Recommendations for balancing as part of regular maintenance?

2018-01-10 Thread waxhead
Austin S. Hemmelgarn wrote: So, for a while now I've been recommending small filtered balances to people as part of regular maintenance for BTRFS filesystems under the logic that it does help in some cases and can't really hurt (and if done right, is really inexpensive in terms of resources).

Re: Recommendations for balancing as part of regular maintenance?

2018-01-10 Thread Timofey Titovets
2018-01-10 21:33 GMT+03:00 Tom Worster : > On 10 Jan 2018, at 12:01, Austin S. Hemmelgarn wrote: > >> On 2018-01-10 11:30, Tom Worster wrote: >> >> Also, for future reference, the term we typically use is ENOSPC, as that's >> the symbolic name for the error code you get when this

Re: Recommendations for balancing as part of regular maintenance?

2018-01-10 Thread Tom Worster
On 10 Jan 2018, at 12:01, Austin S. Hemmelgarn wrote: On 2018-01-10 11:30, Tom Worster wrote: Also, for future reference, the term we typically use is ENOSPC, as that's the symbolic name for the error code you get when this happens (or when your filesystem is just normally full), but I

Re: Recommendations for balancing as part of regular maintenance?

2018-01-10 Thread Austin S. Hemmelgarn
On 2018-01-10 11:30, Tom Worster wrote: On 9 Jan 2018, at 22:49, Duncan wrote: AFAIK, such corruption reports re balance aren't really balance, per se, at all. Instead, what I've seen in nearly all cases is a number of filesystem maintenance commands involving heavy I/O colliding, that is,

[PATCH] btrfs: return 0 for success in btrfs_alloc_data_chunk_ondemand

2018-01-10 Thread Josef Bacik
From: Josef Bacik My delayed refs rsv patches uncovered a problem in btrfs_alloc_data_chunk_ondemand where we don't clear ret before returning, so we could have whatever left over value we had from trying to do a chunk allocation or whatever that may have failed. Since we know

[PATCH RESEND 1/4] btrfs: Remove userspace transaction ioctls

2018-01-10 Thread Nikolay Borisov
Commit 3558d4f88ec8 ("btrfs: Deprecate userspace transaction ioctls") marked the beginning of the end of userspace transaction. This commit finishes the job! Signed-off-by: Nikolay Borisov --- fs/btrfs/ctree.h | 1 - fs/btrfs/file.c | 6 fs/btrfs/ioctl.c | 95

[PATCH RESEND 4/4] btrfs: Remove btrfs_fs_info::open_ioctl_trans

2018-01-10 Thread Nikolay Borisov
Since userspace transaction have been removed we no longer have use for this field so delete it. Signed-off-by: Nikolay Borisov --- fs/btrfs/ctree.h | 1 - fs/btrfs/extent-tree.c | 3 +-- fs/btrfs/transaction.c | 9 +++-- 3 files changed, 4 insertions(+), 9

[PATCH RESEND 2/4] btrfs: Remove code referencing unused TRANS_USERSPACE

2018-01-10 Thread Nikolay Borisov
Now that the userspace transaction ioctls have been removed, TRANS_USERSPACE is no longer used hence we can remove it. Signed-off-by: Nikolay Borisov --- fs/btrfs/transaction.c | 27 ++- fs/btrfs/transaction.h | 5 + 2 files changed, 7

[PATCH RESEND 3/4] btrfs: Remove transaction handle from btrfs_file_private

2018-01-10 Thread Nikolay Borisov
Since we no longer support userspace transaction there is no need to keep this member variable, so remove it. Signed-off-by: Nikolay Borisov --- fs/btrfs/ctree.h | 1 - fs/btrfs/file.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h

Re: Recommendations for balancing as part of regular maintenance?

2018-01-10 Thread Tom Worster
On 9 Jan 2018, at 22:49, Duncan wrote: AFAIK, such corruption reports re balance aren't really balance, per se, at all. Instead, what I've seen in nearly all cases is a number of filesystem maintenance commands involving heavy I/O colliding, that is, being run at the same time I hope

Re: [PATCH 0/4] Finally remove userspace transaction support

2018-01-10 Thread David Sterba
On Wed, Jan 10, 2018 at 03:21:13PM +0200, Nikolay Borisov wrote: > Userspace transaction were initially added to he benefit of Ceph, however > in recent times it became clear that btrfs is not suitable for Ceph's workload > and has even been actively discoured. Additionaly, the userspace

Re: [RFC PATCH] btrfs: Fix slight df misreporting when listing mixed block groups fs

2018-01-10 Thread David Sterba
On Wed, Jan 10, 2018 at 09:30:06AM +0800, Qu Wenruo wrote: > > > On 2018年01月10日 00:04, Nikolay Borisov wrote: > > Currently when df (resp. statfs) is executed on a btrfs instance the > > free space is calculated as the freespace of the block groups + > > any unallocated space on the devices,

Re: [PATCH 6/6] btrfs: make btrfs_free_stale_device() to match the path

2018-01-10 Thread Josef Bacik
On Wed, Jan 10, 2018 at 01:15:23PM +0800, Anand Jain wrote: > From: Anand Jain > > The btrfs_free_stale_device() is updated to match for the given > device path and delete it. (It searches for only unmounted list of > devices.) Also drop the comment about different path

Re: [PATCH 5/6] btrfs: rename btrfs_free_stale_devices() arg to skip_dev

2018-01-10 Thread Josef Bacik
On Wed, Jan 10, 2018 at 01:15:22PM +0800, Anand Jain wrote: > No functional changes. > Rename btrfs_free_stale_devices() arg to skip_dev, so that it > reflects what that arg for. > > Signed-off-by: Anand Jain Reviewed-by: Josef Bacik Thanks, Josef -- To

Re: [PATCH 0/4] Finally remove userspace transaction support

2018-01-10 Thread Josef Bacik
On Wed, Jan 10, 2018 at 03:21:13PM +0200, Nikolay Borisov wrote: > Userspace transaction were initially added to he benefit of Ceph, however > in recent times it became clear that btrfs is not suitable for Ceph's workload > and has even been actively discoured. Additionaly, the userspace

Re: [PATCH 4/6] btrfs: make btrfs_free_stale_device() argument optional

2018-01-10 Thread Josef Bacik
On Wed, Jan 10, 2018 at 01:15:21PM +0800, Anand Jain wrote: > From: Anand Jain > > This updates btrfs_free_stale_device() helper function to delete all > unmouted devices, when arg is NULL. > > Signed-off-by: Anand Jain Reviewed-by: Josef Bacik

Re: [PATCH 3/6] btrfs: make btrfs_free_stale_device() to iterate all stales

2018-01-10 Thread Josef Bacik
On Wed, Jan 10, 2018 at 01:15:20PM +0800, Anand Jain wrote: > From: Anand Jain > > Let the list iterator iterate further and find other stale > devices and delete it. This is in preparation to add support > for user land request-able stale devices cleanup. Also rename >

Re: [PATCH] btrfs: tree-check: reduce stack consumption in check_dir_item

2018-01-10 Thread Josef Bacik
On Wed, Jan 10, 2018 at 03:28:51PM +0100, David Sterba wrote: > I've noticed that the updated item checker stack consumption increased > dramatically in 542f5385e20cf97447 ("btrfs: tree-checker: Add checker > for dir item") > > tree-checker.c:check_leaf+552 (176 -> 728) > >

Re: [PATCH bpf-next v3 5/5] error-injection: Support fault injection framework

2018-01-10 Thread Josef Bacik
On Wed, Jan 10, 2018 at 07:19:05PM +0900, Masami Hiramatsu wrote: > Support in-kernel fault-injection framework via debugfs. > This allows you to inject a conditional error to specified > function using debugfs interfaces. > > Here is the result of test script described in >

Re: [PATCH bpf-next v3 4/5] error-injection: Add injectable error types

2018-01-10 Thread Josef Bacik
On Wed, Jan 10, 2018 at 07:18:35PM +0900, Masami Hiramatsu wrote: > Add injectable error types for each error-injectable function. > > One motivation of error injection test is to find software flaws, > mistakes or mis-handlings of expectable errors. If we find such > flaws by the test, that is a

Re: [PATCH bpf-next v3 3/5] error-injection: Separate error-injection from kprobe

2018-01-10 Thread Josef Bacik
On Wed, Jan 10, 2018 at 07:18:05PM +0900, Masami Hiramatsu wrote: > Since error-injection framework is not limited to be used > by kprobes, nor bpf. Other kernel subsystems can use it > freely for checking safeness of error-injection, e.g. > livepatch, ftrace etc. > So this separate

Re: [RFC PATCH] btrfs: Fix slight df misreporting when listing mixed block groups fs

2018-01-10 Thread Nikolay Borisov
On 10.01.2018 03:30, Qu Wenruo wrote: > That system chunk can be relocated by balance, and in that case new > chunk may start beyond 1M. > > So the most reliable method would be manually checking the the first > device extent of this device, and to determine if we should minus that 1M. > > If

Re: [PATCH bpf-next v3 2/5] tracing/kprobe: bpf: Compare instruction pointer with original one

2018-01-10 Thread Josef Bacik
On Wed, Jan 10, 2018 at 07:17:35PM +0900, Masami Hiramatsu wrote: > Compare instruction pointer with original one on the > stack instead using per-cpu bpf_kprobe_override flag. > > This patch also consolidates reset_current_kprobe() and > preempt_enable_no_resched() blocks. Those can be done > in

Re: [PATCH bpf-next v3 1/5] tracing/kprobe: bpf: Check error injectable event is on function entry

2018-01-10 Thread Josef Bacik
On Wed, Jan 10, 2018 at 07:17:06PM +0900, Masami Hiramatsu wrote: > Check whether error injectable event is on function entry or not. > Currently it checks the event is ftrace-based kprobes or not, > but that is wrong. It should check if the event is on the entry > of target function. Since error

[PATCH] btrfs: tree-check: reduce stack consumption in check_dir_item

2018-01-10 Thread David Sterba
I've noticed that the updated item checker stack consumption increased dramatically in 542f5385e20cf97447 ("btrfs: tree-checker: Add checker for dir item") tree-checker.c:check_leaf+552 (176 -> 728) The array is 255 bytes long, dynamic allocation would slow down the sanity

Re: [PATCH 1/2] btrfs-progs: mkfs: Prevent temporary system chunk to use space in reserved 1M range

2018-01-10 Thread Qu Wenruo
On 2018年01月10日 22:14, Nikolay Borisov wrote: > > > On 10.01.2018 06:56, Qu Wenruo wrote: >> When creating btrfs, mkfs.btrfs will firstly create a temporary system >> chunk as basis, and then created needed trees or new devices. >> >> However the layout temporary system chunk is hard-coded and

Re: [PATCH 1/2] btrfs-progs: mkfs: Prevent temporary system chunk to use space in reserved 1M range

2018-01-10 Thread Nikolay Borisov
On 10.01.2018 06:56, Qu Wenruo wrote: > When creating btrfs, mkfs.btrfs will firstly create a temporary system > chunk as basis, and then created needed trees or new devices. > > However the layout temporary system chunk is hard-coded and uses > reserved [0, 1M) range of devid 1. > > Change

Re: [PATCH v5 19/19] fs: handle inode->i_version more efficiently

2018-01-10 Thread Krzysztof Kozlowski
On Tue, Jan 9, 2018 at 3:10 PM, Jeff Layton wrote: > From: Jeff Layton > > Since i_version is mostly treated as an opaque value, we can exploit that > fact to avoid incrementing it when no one is watching. With that change, > we can avoid incrementing the

[PATCH v3] btrfs: Remove userspace transaction ioctls

2018-01-10 Thread Nikolay Borisov
Commit 3558d4f88ec8 ("btrfs: Deprecate userspace transaction ioctls") marked the beginning of the end of userspace transaction. This commit finishes the job! Signed-off-by: Nikolay Borisov --- V3: Remove btrfs_ioctl_trans_end declaration in ctree.h V2: Remove

[PATCH v2] btrfs: Remove userspace transaction ioctls

2018-01-10 Thread Nikolay Borisov
Commit 3558d4f88ec8 ("btrfs: Deprecate userspace transaction ioctls") marked the beginning of the end of userspace transaction. This commit finishes the job! Signed-off-by: Nikolay Borisov --- V2: Remove btrfs_ioctl_trans_end reference in btrfs_sync_fil fs/btrfs/file.c |

Re: [PATCH 3/4] btrfs: get device pointer from device_list_add()

2018-01-10 Thread Anand Jain
@@ -742,7 +741,7 @@ static noinline int device_list_add(const char *path, if (!fs_devices) { fs_devices = alloc_fs_devices(disk_super->fsid); if (IS_ERR(fs_devices)) - return PTR_ERR(fs_devices); + return

[PATCH 0/4] Finally remove userspace transaction support

2018-01-10 Thread Nikolay Borisov
Userspace transaction were initially added to he benefit of Ceph, however in recent times it became clear that btrfs is not suitable for Ceph's workload and has even been actively discoured. Additionaly, the userspace transaction mechanism has always been a sort of a hack, which could easily lead

[PATCH 2/4] btrfs: Remove code referencing unused TRANS_USERSPACE

2018-01-10 Thread Nikolay Borisov
Now that the userspace transaction ioctls have been removed, TRANS_USERSPACE is no longer used hence we can remove it. --- fs/btrfs/transaction.c | 27 ++- fs/btrfs/transaction.h | 5 + 2 files changed, 7 insertions(+), 25 deletions(-) diff --git

[PATCH 3/4] btrfs: Remove transaction handle from btrfs_file_private

2018-01-10 Thread Nikolay Borisov
Since we no longer support userspace transaction there is no need to keep this member variable, so remove it. --- fs/btrfs/ctree.h | 1 - fs/btrfs/file.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 1a462ab85c49..a3911d86bab9 100644 ---

[PATCH 1/4] btrfs: Remove userspace transaction ioctls

2018-01-10 Thread Nikolay Borisov
Commit 3558d4f88ec8 ("btrfs: Deprecate userspace transaction ioctls") marked the beginning of the end of userspace transaction. This commit finishes the job! --- fs/btrfs/ioctl.c | 95 1 file changed, 95 deletions(-) diff --git

[PATCH 4/4] btrfs: Remove btrfs_fs_info::open_ioctl_trans

2018-01-10 Thread Nikolay Borisov
Since userspace transaction have been removed we no longer have use for this field so delete it. --- fs/btrfs/ctree.h | 1 - fs/btrfs/extent-tree.c | 3 +-- fs/btrfs/transaction.c | 9 +++-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/fs/btrfs/ctree.h

[PATCH bpf-next v3 3/5] error-injection: Separate error-injection from kprobe

2018-01-10 Thread Masami Hiramatsu
Since error-injection framework is not limited to be used by kprobes, nor bpf. Other kernel subsystems can use it freely for checking safeness of error-injection, e.g. livepatch, ftrace etc. So this separate error-injection framework from kprobes. Some differences has been made: - "kprobe" word

[PATCH bpf-next v3 4/5] error-injection: Add injectable error types

2018-01-10 Thread Masami Hiramatsu
Add injectable error types for each error-injectable function. One motivation of error injection test is to find software flaws, mistakes or mis-handlings of expectable errors. If we find such flaws by the test, that is a program bug, so we need to fix it. But if the tester miss input the error

[PATCH bpf-next v3 5/5] error-injection: Support fault injection framework

2018-01-10 Thread Masami Hiramatsu
Support in-kernel fault-injection framework via debugfs. This allows you to inject a conditional error to specified function using debugfs interfaces. Here is the result of test script described in Documentation/fault-injection/fault-injection.txt === # ./test_fail_function.sh 1+0

[PATCH bpf-next v3 1/5] tracing/kprobe: bpf: Check error injectable event is on function entry

2018-01-10 Thread Masami Hiramatsu
Check whether error injectable event is on function entry or not. Currently it checks the event is ftrace-based kprobes or not, but that is wrong. It should check if the event is on the entry of target function. Since error injection will override a function to just return with modified return

[PATCH bpf-next v3 0/5] Separate error injection table from kprobes

2018-01-10 Thread Masami Hiramatsu
Hi, Here are the 3rd version of patches to moving error injection table from kprobes. This series includes some fixes and error type descriptions which we discussed in the previous thread. Here is the previous version: https://lkml.org/lkml/2017/12/26/26 There are 2 main reasons why I separate

Re: [PATCH 2/2] btrfs-progs: mkfs-tests: Add test case to check if the first device extent is occupying reserved 0~1M range

2018-01-10 Thread Nikolay Borisov
On 10.01.2018 06:56, Qu Wenruo wrote: > Signed-off-by: Qu Wenruo Reviewed-by: Nikolay Borisov > --- > .../mkfs-tests/010-reserved-1M-for-single/test.sh | 37 > ++ > 1 file changed, 37 insertions(+) > create mode 100755

Re: [PATCH 3/4] btrfs: get device pointer from device_list_add()

2018-01-10 Thread Nikolay Borisov
On 10.01.2018 07:16, Anand Jain wrote: > Instead of pointer to btrfs_fs_devices as an arg in device_list_add() > better to get pointer to btrfs_device as return value, then we have > both, pointer to btrfs_device and btrfs_fs_devices. btrfs_device is > needed to handle reappearing missing

Re: [PATCH 1/2] btrfs-progs: mkfs: Prevent temporary system chunk to use space in reserved 1M range

2018-01-10 Thread Nikolay Borisov
On 10.01.2018 06:56, Qu Wenruo wrote: > When creating btrfs, mkfs.btrfs will firstly create a temporary system > chunk as basis, and then created needed trees or new devices. > > However the layout temporary system chunk is hard-coded and uses > reserved [0, 1M) range of devid 1. > > Change

<    1   2