Skip to content

Commit 0b166a5

Browse files
committed
Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 updates from Ted Ts'o: "A lot of bug fixes and cleanups for ext4, including: - Fix performance problems found in dioread_nolock now that it is the default, caused by transaction leaks. - Clean up fiemap handling in ext4 - Clean up and refactor multiple block allocator (mballoc) code - Fix a problem with mballoc with a smaller file systems running out of blocks because they couldn't properly use blocks that had been reserved by inode preallocation. - Fixed a race in ext4_sync_parent() versus rename() - Simplify the error handling in the extent manipulation code - Make sure all metadata I/O errors are felected to ext4_ext_dirty()'s and ext4_make_inode_dirty()'s callers. - Avoid passing an error pointer to brelse in ext4_xattr_set() - Fix race which could result to freeing an inode on the dirty last in data=journal mode. - Fix refcount handling if ext4_iget() fails - Fix a crash in generic/019 caused by a corrupted extent node" * tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (58 commits) ext4: avoid unnecessary transaction starts during writeback ext4: don't block for O_DIRECT if IOCB_NOWAIT is set ext4: remove the access_ok() check in ext4_ioctl_get_es_cache fs: remove the access_ok() check in ioctl_fiemap fs: handle FIEMAP_FLAG_SYNC in fiemap_prep fs: move fiemap range validation into the file systems instances iomap: fix the iomap_fiemap prototype fs: move the fiemap definitions out of fs.h fs: mark __generic_block_fiemap static ext4: remove the call to fiemap_check_flags in ext4_fiemap ext4: split _ext4_fiemap ext4: fix fiemap size checks for bitmap files ext4: fix EXT4_MAX_LOGICAL_BLOCK macro add comment for ext4_dir_entry_2 file_type member jbd2: avoid leaking transaction credits when unreserving handle ext4: drop ext4_journal_free_reserved() ext4: mballoc: use lock for checking free blocks while retrying ext4: mballoc: refactor ext4_mb_good_group() ext4: mballoc: introduce pcpu seqcnt for freeing PA to improve ENOSPC handling ext4: mballoc: refactor ext4_mb_discard_preallocations() ...
2 parents b25c664 + 6b8ed62 commit 0b166a5

47 files changed

Lines changed: 905 additions & 663 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Documentation/filesystems/fiemap.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,16 +206,18 @@ EINTR once fatal signal received.
206206

207207

208208
Flag checking should be done at the beginning of the ->fiemap callback via the
209-
fiemap_check_flags() helper::
209+
fiemap_prep() helper::
210210

211-
int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags);
211+
int fiemap_prep(struct inode *inode, struct fiemap_extent_info *fieinfo,
212+
u64 start, u64 *len, u32 supported_flags);
212213

213214
The struct fieinfo should be passed in as received from ioctl_fiemap(). The
214215
set of fiemap flags which the fs understands should be passed via fs_flags. If
215-
fiemap_check_flags finds invalid user flags, it will place the bad values in
216+
fiemap_prep finds invalid user flags, it will place the bad values in
216217
fieinfo->fi_flags and return -EBADR. If the file system gets -EBADR, from
217-
fiemap_check_flags(), it should immediately exit, returning that error back to
218-
ioctl_fiemap().
218+
fiemap_prep(), it should immediately exit, returning that error back to
219+
ioctl_fiemap(). Additionally the range is validate against the supported
220+
maximum file size.
219221

220222

221223
For each extent in the request range, the file system should call

fs/bad_inode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/time.h>
1616
#include <linux/namei.h>
1717
#include <linux/poll.h>
18+
#include <linux/fiemap.h>
1819

1920
static int bad_file_open(struct inode *inode, struct file *filp)
2021
{

fs/btrfs/extent_io.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <linux/rbtree.h>
77
#include <linux/refcount.h>
8+
#include <linux/fiemap.h>
89
#include "ulist.h"
910

1011
/*

fs/btrfs/inode.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7828,14 +7828,12 @@ const struct iomap_dio_ops btrfs_dops = {
78287828
.submit_io = btrfs_submit_direct,
78297829
};
78307830

7831-
#define BTRFS_FIEMAP_FLAGS (FIEMAP_FLAG_SYNC)
7832-
78337831
static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
78347832
__u64 start, __u64 len)
78357833
{
78367834
int ret;
78377835

7838-
ret = fiemap_check_flags(fieinfo, BTRFS_FIEMAP_FLAGS);
7836+
ret = fiemap_prep(inode, fieinfo, start, &len, 0);
78397837
if (ret)
78407838
return ret;
78417839

fs/cifs/inode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <linux/freezer.h>
2626
#include <linux/sched/signal.h>
2727
#include <linux/wait_bit.h>
28+
#include <linux/fiemap.h>
2829

2930
#include <asm/div64.h>
3031
#include "cifsfs.h"

fs/cifs/smb2ops.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/uuid.h>
1313
#include <linux/sort.h>
1414
#include <crypto/aead.h>
15+
#include <linux/fiemap.h>
1516
#include "cifsfs.h"
1617
#include "cifsglob.h"
1718
#include "smb2pdu.h"
@@ -3407,8 +3408,9 @@ static int smb3_fiemap(struct cifs_tcon *tcon,
34073408
int i, num, rc, flags, last_blob;
34083409
u64 next;
34093410

3410-
if (fiemap_check_flags(fei, FIEMAP_FLAG_SYNC))
3411-
return -EBADR;
3411+
rc = fiemap_prep(d_inode(cfile->dentry), fei, start, &len, 0);
3412+
if (rc)
3413+
return rc;
34123414

34133415
xid = get_xid();
34143416
again:

fs/ext2/inode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <linux/iomap.h>
3737
#include <linux/namei.h>
3838
#include <linux/uio.h>
39+
#include <linux/fiemap.h>
3940
#include "ext2.h"
4041
#include "acl.h"
4142
#include "xattr.h"

fs/ext4/Kconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ config EXT4_DEBUG
9999
Enables run-time debugging support for the ext4 filesystem.
100100

101101
If you select Y here, then you will be able to turn on debugging
102-
with a command such as:
103-
echo 1 > /sys/module/ext4/parameters/mballoc_debug
102+
using dynamic debug control for mb_debug() / ext_debug() msgs.
104103

105104
config EXT4_KUNIT_TESTS
106105
tristate "KUnit tests for ext4"

fs/ext4/acl.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,8 @@ __ext4_set_acl(handle_t *handle, struct inode *inode, int type,
215215
value, size, xattr_flags);
216216

217217
kfree(value);
218-
if (!error) {
218+
if (!error)
219219
set_cached_acl(inode, type, acl);
220-
}
221220

222221
return error;
223222
}
@@ -256,7 +255,7 @@ ext4_set_acl(struct inode *inode, struct posix_acl *acl, int type)
256255
if (!error && update_mode) {
257256
inode->i_mode = mode;
258257
inode->i_ctime = current_time(inode);
259-
ext4_mark_inode_dirty(handle, inode);
258+
error = ext4_mark_inode_dirty(handle, inode);
260259
}
261260
out_stop:
262261
ext4_journal_stop(handle);

fs/ext4/balloc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -903,10 +903,11 @@ ext4_fsblk_t ext4_inode_to_goal_block(struct inode *inode)
903903
return bg_start;
904904

905905
if (bg_start + EXT4_BLOCKS_PER_GROUP(inode->i_sb) <= last_block)
906-
colour = (current->pid % 16) *
906+
colour = (task_pid_nr(current) % 16) *
907907
(EXT4_BLOCKS_PER_GROUP(inode->i_sb) / 16);
908908
else
909-
colour = (current->pid % 16) * ((last_block - bg_start) / 16);
909+
colour = (task_pid_nr(current) % 16) *
910+
((last_block - bg_start) / 16);
910911
return bg_start + colour;
911912
}
912913

0 commit comments

Comments
 (0)