[PATCH v2] generic: add test for fsync after shrinking truncate and rename

2019-03-05 Thread fdmanana
From: Filipe Manana Test that if we truncate a file to reduce its size, rename it and then fsync it, after a power failure the file has a correct size and name. This test is motivated by a bug found in btrfs, which is fixed by a patch for the linux kernel titled: "Btrfs: fix incorrect file si

Re: [PATCH] generic: add test for fsync after shrinking truncate and rename

2019-03-05 Thread Filipe Manana
On Tue, Mar 5, 2019 at 5:59 AM Amir Goldstein wrote: > > On Tue, Mar 5, 2019 at 12:31 AM Filipe Manana wrote: > > > > On Mon, Mar 4, 2019 at 5:59 PM Amir Goldstein wrote: > > > > > > On Mon, Mar 4, 2019 at 5:23 PM Filipe Manana wrote: > > > > > > > > On Mon, Mar 4, 2019 at 3:04 PM Amir Goldstei

Re: [PATCH] generic: add test for fsync after shrinking truncate and rename

2019-03-05 Thread Amir Goldstein
> > As I wrote to Dave, if file is not "metadata dirty" before rename, > > then whether or not rename dirties to file for fsync is a filesystem > > specific implementation detail that is not in any standard. > > > > Since filesystems tend to try to optimize out unneeded journal > > commits, so the

Re: [PATCH v2] btrfs-progs: gitignore: Ignore hidden files

2019-03-05 Thread David Sterba
On Thu, Feb 28, 2019 at 10:22:06AM +0800, Qu Wenruo wrote: > A lot of editor/IDE related config files are dotfiles, like .vimrc > or .clang_complete. > > Instead of adding gitignore entry for each editor/IDE, just ignore all > dotfiles. Fortunatelly it still works for tracked dotfiles like .travi

Re: [PATCH v2] btrfs-progs: gitignore: Ignore hidden files

2019-03-05 Thread Qu Wenruo
On 2019/3/5 下午8:27, David Sterba wrote: > On Thu, Feb 28, 2019 at 10:22:06AM +0800, Qu Wenruo wrote: >> A lot of editor/IDE related config files are dotfiles, like .vimrc >> or .clang_complete. >> >> Instead of adding gitignore entry for each editor/IDE, just ignore all >> dotfiles. > > Fortunat

Re: [RFC PATCH] btrfs-progs: Quiet mode for btrfs-receive

2019-03-05 Thread David Sterba
On Wed, Feb 20, 2019 at 09:16:04AM +, Steven Davies wrote: > Provide an option in `btrfs receive` to suppress the informational > messages when writing files. Thank, looks ok to me, the 'receive' command already has the verbosity option so it makes sense to have both. > Signed-off-by: Steven

Re: [PATCH resend 1/2] btrfs-progs: fix kernel version parsing on some versions past 3.0

2019-03-05 Thread David Sterba
On Mon, Feb 25, 2019 at 07:16:43PM +0100, Adam Borowski wrote: > The code fails if the third section is missing (like "4.18") or is followed > by anything but "." or "-". This happens for example if we're not exactly > at a tag and CONFIG_LOCALVERSION_AUTO=n (which results in "4.18.5+"). > > Sign

Re: [PATCH resend 2/2] btrfs-progs: defrag: open files RO on new enough kernels

2019-03-05 Thread David Sterba
On Mon, Feb 25, 2019 at 07:16:44PM +0100, Adam Borowski wrote: > Defragging an executable conflicts both way with it being run, resulting in > ETXTBSY. This either makes defrag fail or prevents the program from being > executed. > > Kernels 4.19-rc1 and later allow defragging files you could have

Re: [PATCH v2] btrfs-progs: gitignore: Ignore hidden files

2019-03-05 Thread David Sterba
On Tue, Mar 05, 2019 at 08:35:39PM +0800, Qu Wenruo wrote: > > > On 2019/3/5 下午8:27, David Sterba wrote: > > On Thu, Feb 28, 2019 at 10:22:06AM +0800, Qu Wenruo wrote: > >> A lot of editor/IDE related config files are dotfiles, like .vimrc > >> or .clang_complete. > >> > >> Instead of adding giti

Re: [PATCH v1.1] btrfs-progs: Do metadata prealloc as long as we're not modifying extent tree

2019-03-05 Thread David Sterba
On Fri, Sep 14, 2018 at 03:49:44PM +0800, Qu Wenruo wrote: > In github issues, one user reports unexpected ENOSPC error if enabling > datasum. > After some investigation, it looks like that during ext2_saved/image > creation, we could create large file extent whose size can be 128M (max > data exte

Re: [PATCH v1.1] btrfs-progs: inspect-dump-tree: Allow '-b|--block' to be specified multiple times

2019-03-05 Thread David Sterba
On Fri, Jun 01, 2018 at 04:27:46PM +0800, Qu Wenruo wrote: > Reuse extent-cache facility to record multiple bytenr so '-b|--block' > can be specified multiple times. > > Despite that, add a sector size alignment check before we try to print a > tree block. > (Please note that, nodesize alignment c

Re: [PATCH] generic: add test for fsync after shrinking truncate and rename

2019-03-05 Thread Dave Chinner
On Tue, Mar 05, 2019 at 07:39:28AM +0200, Amir Goldstein wrote: > On Tue, Mar 5, 2019 at 2:50 AM Dave Chinner wrote: > > > > On Mon, Mar 04, 2019 at 05:04:23PM +0200, Amir Goldstein wrote: > > > On Mon, Mar 4, 2019 at 4:44 PM wrote: > > > > > > > > From: Filipe Manana > > > > > > > > Test that i

[PATCH] btrfs-progs: Free bad extent buffer as soon as possible

2019-03-05 Thread Qu Wenruo
[BUG] For the new multiple -b parameter supporting, we could hit this bug on a 16K node sized btrfs: $ ./btrfs inspect dump-tree -b 1024 -b 2048 -b 4096 -b 8192 zimg btrfs-progs v4.20.2 ERROR: tree block bytenr 1024 is not aligned to sectorsize 4096 ERROR: tree block bytenr 2048 is not alig

[PATCH RFC 3/3] btrfs: perf: Add RO sysfs interface to collect perf result

2019-03-05 Thread Qu Wenruo
This patch adds a new sys fs interface, 'profiler', for user to get real time performance data. The content of /sys/fs/btrfs//profiler is generated at the time of read, so user could have full control of the duration resolution. The output example would be: timestamp = 16364075995092ns duration =

[PATCH RFC 1/3] btrfs: Introduce performance profiler

2019-03-05 Thread Qu Wenruo
This patch introduce the skeleton of btrfs performance profiler. The objective of btrfs performance profiler is to provide various indicator to locate possible performance bottleneck. Initial btrfs profiler only supports sleepable tree lock anaylyse for the following trees: - fs/subvolume trees -

[PATCH RFC 2/3] btrfs: locking: Add hooks for btrfs perf

2019-03-05 Thread Qu Wenruo
For btrfs tree locking, there are only 2 functions can sleep: - btrfs_tree_read_lock() It will wait for any blocking writers - btrfs_tree_lock() It will wait for any blocking readers or writers Other functions only depends on rwlock which won't sleep. We doesn't really care about the spinning

[PATCH RFC 0/3] btrfs: Performance profiler support

2019-03-05 Thread Qu Wenruo
This patchset can be fetched from github: https://github.com/adam900710/linux/tree/perf_tree_lock Which is based on v5.0-rc7 tag. Although we have ftrace/perf to do various performance analyse, under most case the granularity is too small, resulting data flood for users. This RFC patchset provide

Re: [PATCH] generic: add test for fsync after shrinking truncate and rename

2019-03-05 Thread Amir Goldstein
On Wed, Mar 6, 2019 at 12:33 AM Dave Chinner wrote: > > On Tue, Mar 05, 2019 at 07:39:28AM +0200, Amir Goldstein wrote: > > On Tue, Mar 5, 2019 at 2:50 AM Dave Chinner wrote: > > > > > > On Mon, Mar 04, 2019 at 05:04:23PM +0200, Amir Goldstein wrote: > > > > On Mon, Mar 4, 2019 at 4:44 PM wrote: