linux/fs
Filipe Manana e3b8a48585 Btrfs: fix reported number of inode blocks after buffered append writes
The patch from commit a7e3b975a0 ("Btrfs: fix reported number of inode
blocks") introduced a regression where if we do a buffered write starting
at position equal to or greater than the file's size and then stat(2) the
file before writeback is triggered, the number of used blocks does not
change (unless there's a prealloc/unwritten extent). Example:

  $ xfs_io -f -c "pwrite -S 0xab 0 64K" foobar
  $ du -h foobar
  0	foobar
  $ sync
  $ du -h foobar
  64K	foobar

The first version of that patch didn't had this regression and the second
version, which was the one committed, was made only to address some
performance regression detected by the intel test robots using fs_mark.

This fixes the regression by setting the new delaloc bit in the range, and
doing it at btrfs_dirty_pages() while setting the regular dealloc bit as
well, so that this way we set both bits at once avoiding navigation of the
inode's io tree twice. Doing it at btrfs_dirty_pages() is also the most
meaninful place, as we should set the new dellaloc bit when if we set the
delalloc bit, which happens only if we copied bytes into the pages at
__btrfs_buffered_write().

This was making some of LTP's du tests fail, which can be quickly run
using a command line like the following:

  $ ./runltp -q -p -l /ltp.log -f commands -s du -d /mnt

Fixes: a7e3b975a0 ("Btrfs: fix reported number of inode blocks")
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2017-11-15 17:27:46 +01:00
..
9p 9p: set page uptodate when required in write_end() 2017-10-11 09:30:08 -07:00
adfs
affs
afs
autofs4
befs
bfs
btrfs Btrfs: fix reported number of inode blocks after buffered append writes 2017-11-15 17:27:46 +01:00
cachefiles
ceph ceph: unlock dangling spinlock in try_flush_caps() 2017-10-25 08:31:15 +02:00
cifs SMB3: Validate negotiate request must always be signed 2017-10-26 12:20:59 -05:00
coda
configfs
cramfs
crypto fscrypt: fix dereference of NULL user_key_payload 2017-10-12 17:16:40 +01:00
debugfs
devpts
dlm
ecryptfs ecryptfs: fix dereference of NULL user_key_payload 2017-10-12 17:16:40 +01:00
efivarfs
efs
exofs
exportfs
ext2
ext4 Convert fs/*/* to SB_I_VERSION 2017-10-18 18:51:27 -04:00
f2fs
fat
freevxfs
fscache FS-Cache: fix dereference of NULL user_key_payload 2017-10-12 17:16:40 +01:00
fuse fuse: fix READDIRPLUS skipping an entry 2017-10-25 16:34:27 +02:00
gfs2
hfs
hfsplus
hostfs
hpfs
hugetlbfs
isofs
jbd2
jffs2
jfs
kernfs
lockd
minix
ncpfs
nfs
nfs_common
nfsd nfsd4: define nfsd4_secinfo_no_name_release() 2017-10-05 14:45:25 -04:00
nilfs2
nls
notify
ntfs
ocfs2
omfs
openpromfs
orangefs
overlayfs ovl: do not cleanup unsupported index entries 2017-10-24 16:06:17 +02:00
proc
pstore
qnx4
qnx6
quota quota: Generate warnings for DQUOT_SPACE_NOFAIL allocations 2017-10-10 17:24:46 +02:00
ramfs
reiserfs
romfs
squashfs
sysfs
sysv
tracefs
ubifs
udf
ufs
xfs Changes since last time: 2017-10-26 08:45:40 +02:00
aio.c
anon_inodes.c
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf_fdpic.c
binfmt_elf.c
binfmt_em86.c
binfmt_flat.c
binfmt_misc.c fs/binfmt_misc.c: node could be NULL when evicting inode 2017-10-13 16:18:33 -07:00
binfmt_script.c
block_dev.c fs/mpage.c: fix mpage_writepage() for pages with buffers 2017-10-13 16:18:33 -07:00
buffer.c
char_dev.c
compat_binfmt_elf.c
compat_ioctl.c
compat.c
coredump.c
dax.c
dcache.c
dcookies.c
direct-io.c Changes since last update: 2017-10-18 14:51:50 -04:00
drop_caches.c
eventfd.c
eventpoll.c
exec.c membarrier: Provide register expedited private command 2017-10-19 22:13:40 -04:00
fcntl.c
fhandle.c
file_table.c
file.c
filesystems.c
fs_pin.c
fs_struct.c
fs-writeback.c
inode.c
internal.h
ioctl.c
iomap.c fs: invalidate page cache after end_io() in dio completion 2017-10-16 12:11:56 -07:00
Kconfig
Kconfig.binfmt
libfs.c
locks.c
Makefile
mbcache.c
mount.h
mpage.c fs/mpage.c: fix mpage_writepage() for pages with buffers 2017-10-13 16:18:33 -07:00
namei.c
namespace.c vfs: fix mounting a filesystem with i_version 2017-10-17 02:22:07 -04:00
no-block.c
nsfs.c
open.c
pipe.c
pnode.c
pnode.h
posix_acl.c
proc_namespace.c
read_write.c
readdir.c
select.c
seq_file.c
signalfd.c
splice.c
stack.c
stat.c
statfs.c
super.c
sync.c
timerfd.c
userfaultfd.c
utimes.c
xattr.c