Skip to content

Commit 91808cd

Browse files
committed
Merge tag 'ext4_for_linus_cleanups' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 fixes and cleanups from Ted Ts'o: "More fixes and cleanups for the new fast_commit features, but also a few other miscellaneous bug fixes and a cleanup for the MAINTAINERS file" * tag 'ext4_for_linus_cleanups' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (28 commits) jbd2: fix up sparse warnings in checkpoint code ext4: fix sparse warnings in fast_commit code ext4: cleanup fast commit mount options jbd2: don't start fast commit on aborted journal ext4: make s_mount_flags modifications atomic ext4: issue fsdev cache flush before starting fast commit ext4: disable fast commit with data journalling ext4: fix inode dirty check in case of fast commits ext4: remove unnecessary fast commit calls from ext4_file_mmap ext4: mark buf dirty before submitting fast commit buffer ext4: fix code documentatioon ext4: dedpulicate the code to wait on inode that's being committed jbd2: don't read journal->j_commit_sequence without taking a lock jbd2: don't touch buffer state until it is filled jbd2: add todo for a fast commit performance optimization jbd2: don't pass tid to jbd2_fc_end_commit_fallback() jbd2: don't use state lock during commit path jbd2: drop jbd2_fc_init documentation ext4: clean up the JBD2 API that initializes fast commits jbd2: rename j_maxlen to j_total_len and add jbd2_journal_max_txn_bufs ...
2 parents df3319a + 05d5233 commit 91808cd

24 files changed

Lines changed: 342 additions & 271 deletions

File tree

Documentation/filesystems/ext4/journal.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,10 @@ which is 1024 bytes long:
256256
- s\_padding2
257257
-
258258
* - 0x54
259+
- \_\_be32
260+
- s\_num\_fc\_blocks
261+
- Number of fast commit blocks in the journal.
262+
* - 0x58
259263
- \_\_u32
260264
- s\_padding[42]
261265
-
@@ -310,6 +314,8 @@ The journal incompat features are any combination of the following:
310314
- This journal uses v3 of the checksum on-disk format. This is the same as
311315
v2, but the journal block tag size is fixed regardless of the size of
312316
block numbers. (JBD2\_FEATURE\_INCOMPAT\_CSUM\_V3)
317+
* - 0x20
318+
- Journal has fast commit blocks. (JBD2\_FEATURE\_INCOMPAT\_FAST\_COMMIT)
313319

314320
.. _jbd2_checksum_type:
315321

Documentation/filesystems/ext4/super.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,13 @@ following:
596596
- Sparse Super Block, v2. If this flag is set, the SB field s\_backup\_bgs
597597
points to the two block groups that contain backup superblocks
598598
(COMPAT\_SPARSE\_SUPER2).
599+
* - 0x400
600+
- Fast commits supported. Although fast commits blocks are
601+
backward incompatible, fast commit blocks are not always
602+
present in the journal. If fast commit blocks are present in
603+
the journal, JBD2 incompat feature
604+
(JBD2\_FEATURE\_INCOMPAT\_FAST\_COMMIT) gets
605+
set (COMPAT\_FAST\_COMMIT).
599606

600607
.. _super_incompat:
601608

Documentation/filesystems/journalling.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,8 @@ Fast commits
136136
~~~~~~~~~~~~
137137

138138
JBD2 to also allows you to perform file-system specific delta commits known as
139-
fast commits. In order to use fast commits, you first need to call
140-
:c:func:`jbd2_fc_init` and tell how many blocks at the end of journal
141-
area should be reserved for fast commits. Along with that, you will also need
142-
to set following callbacks that perform correspodning work:
139+
fast commits. In order to use fast commits, you will need to set following
140+
callbacks that perform correspodning work:
143141

144142
`journal->j_fc_cleanup_cb`: Cleanup function called after every full commit and
145143
fast commit.

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6614,6 +6614,7 @@ Q: http://patchwork.ozlabs.org/project/linux-ext4/list/
66146614
T: git git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git
66156615
F: Documentation/filesystems/ext4/
66166616
F: fs/ext4/
6617+
F: include/trace/events/ext4.h
66176618

66186619
Extended Verification Module (EVM)
66196620
M: Mimi Zohar <zohar@linux.ibm.com>

fs/ext4/ext4.h

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,9 +1028,6 @@ struct ext4_inode_info {
10281028
* protected by sbi->s_fc_lock.
10291029
*/
10301030

1031-
/* Fast commit subtid when this inode was committed */
1032-
unsigned int i_fc_committed_subtid;
1033-
10341031
/* Start of lblk range that needs to be committed in this fast commit */
10351032
ext4_lblk_t i_fc_lblk_start;
10361033

@@ -1422,16 +1419,6 @@ struct ext4_super_block {
14221419

14231420
#ifdef __KERNEL__
14241421

1425-
/*
1426-
* run-time mount flags
1427-
*/
1428-
#define EXT4_MF_MNTDIR_SAMPLED 0x0001
1429-
#define EXT4_MF_FS_ABORTED 0x0002 /* Fatal error detected */
1430-
#define EXT4_MF_FC_INELIGIBLE 0x0004 /* Fast commit ineligible */
1431-
#define EXT4_MF_FC_COMMITTING 0x0008 /* File system underoing a fast
1432-
* commit.
1433-
*/
1434-
14351422
#ifdef CONFIG_FS_ENCRYPTION
14361423
#define DUMMY_ENCRYPTION_ENABLED(sbi) ((sbi)->s_dummy_enc_policy.policy != NULL)
14371424
#else
@@ -1466,7 +1453,7 @@ struct ext4_sb_info {
14661453
struct buffer_head * __rcu *s_group_desc;
14671454
unsigned int s_mount_opt;
14681455
unsigned int s_mount_opt2;
1469-
unsigned int s_mount_flags;
1456+
unsigned long s_mount_flags;
14701457
unsigned int s_def_mount_opt;
14711458
ext4_fsblk_t s_sb_block;
14721459
atomic64_t s_resv_clusters;
@@ -1694,6 +1681,34 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
16941681
_v; \
16951682
})
16961683

1684+
/*
1685+
* run-time mount flags
1686+
*/
1687+
enum {
1688+
EXT4_MF_MNTDIR_SAMPLED,
1689+
EXT4_MF_FS_ABORTED, /* Fatal error detected */
1690+
EXT4_MF_FC_INELIGIBLE, /* Fast commit ineligible */
1691+
EXT4_MF_FC_COMMITTING /* File system underoing a fast
1692+
* commit.
1693+
*/
1694+
};
1695+
1696+
static inline void ext4_set_mount_flag(struct super_block *sb, int bit)
1697+
{
1698+
set_bit(bit, &EXT4_SB(sb)->s_mount_flags);
1699+
}
1700+
1701+
static inline void ext4_clear_mount_flag(struct super_block *sb, int bit)
1702+
{
1703+
clear_bit(bit, &EXT4_SB(sb)->s_mount_flags);
1704+
}
1705+
1706+
static inline int ext4_test_mount_flag(struct super_block *sb, int bit)
1707+
{
1708+
return test_bit(bit, &EXT4_SB(sb)->s_mount_flags);
1709+
}
1710+
1711+
16971712
/*
16981713
* Simulate_fail codes
16991714
*/
@@ -1863,6 +1878,13 @@ static inline bool ext4_verity_in_progress(struct inode *inode)
18631878
#define EXT4_FEATURE_COMPAT_RESIZE_INODE 0x0010
18641879
#define EXT4_FEATURE_COMPAT_DIR_INDEX 0x0020
18651880
#define EXT4_FEATURE_COMPAT_SPARSE_SUPER2 0x0200
1881+
/*
1882+
* The reason why "FAST_COMMIT" is a compat feature is that, FS becomes
1883+
* incompatible only if fast commit blocks are present in the FS. Since we
1884+
* clear the journal (and thus the fast commit blocks), we don't mark FS as
1885+
* incompatible. We also have a JBD2 incompat feature, which gets set when
1886+
* there are fast commit blocks present in the journal.
1887+
*/
18661888
#define EXT4_FEATURE_COMPAT_FAST_COMMIT 0x0400
18671889
#define EXT4_FEATURE_COMPAT_STABLE_INODES 0x0800
18681890

@@ -2731,12 +2753,16 @@ extern void ext4_end_bitmap_read(struct buffer_head *bh, int uptodate);
27312753
int ext4_fc_info_show(struct seq_file *seq, void *v);
27322754
void ext4_fc_init(struct super_block *sb, journal_t *journal);
27332755
void ext4_fc_init_inode(struct inode *inode);
2734-
void ext4_fc_track_range(struct inode *inode, ext4_lblk_t start,
2756+
void ext4_fc_track_range(handle_t *handle, struct inode *inode, ext4_lblk_t start,
27352757
ext4_lblk_t end);
2736-
void ext4_fc_track_unlink(struct inode *inode, struct dentry *dentry);
2737-
void ext4_fc_track_link(struct inode *inode, struct dentry *dentry);
2738-
void ext4_fc_track_create(struct inode *inode, struct dentry *dentry);
2739-
void ext4_fc_track_inode(struct inode *inode);
2758+
void __ext4_fc_track_unlink(handle_t *handle, struct inode *inode,
2759+
struct dentry *dentry);
2760+
void __ext4_fc_track_link(handle_t *handle, struct inode *inode,
2761+
struct dentry *dentry);
2762+
void ext4_fc_track_unlink(handle_t *handle, struct dentry *dentry);
2763+
void ext4_fc_track_link(handle_t *handle, struct dentry *dentry);
2764+
void ext4_fc_track_create(handle_t *handle, struct dentry *dentry);
2765+
void ext4_fc_track_inode(handle_t *handle, struct inode *inode);
27402766
void ext4_fc_mark_ineligible(struct super_block *sb, int reason);
27412767
void ext4_fc_start_ineligible(struct super_block *sb, int reason);
27422768
void ext4_fc_stop_ineligible(struct super_block *sb);
@@ -3452,7 +3478,7 @@ extern int ext4_handle_dirty_dirblock(handle_t *handle, struct inode *inode,
34523478
extern int ext4_ci_compare(const struct inode *parent,
34533479
const struct qstr *fname,
34543480
const struct qstr *entry, bool quick);
3455-
extern int __ext4_unlink(struct inode *dir, const struct qstr *d_name,
3481+
extern int __ext4_unlink(handle_t *handle, struct inode *dir, const struct qstr *d_name,
34563482
struct inode *inode);
34573483
extern int __ext4_link(struct inode *dir, struct inode *inode,
34583484
struct dentry *dentry);

fs/ext4/extents.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3724,7 +3724,6 @@ static int ext4_convert_unwritten_extents_endio(handle_t *handle,
37243724
err = ext4_ext_dirty(handle, inode, path + path->p_depth);
37253725
out:
37263726
ext4_ext_show_leaf(inode, path);
3727-
ext4_fc_track_range(inode, ee_block, ee_block + ee_len - 1);
37283727
return err;
37293728
}
37303729

@@ -3796,7 +3795,6 @@ convert_initialized_extent(handle_t *handle, struct inode *inode,
37963795
if (*allocated > map->m_len)
37973796
*allocated = map->m_len;
37983797
map->m_len = *allocated;
3799-
ext4_fc_track_range(inode, ee_block, ee_block + ee_len - 1);
38003798
return 0;
38013799
}
38023800

@@ -4329,7 +4327,6 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
43294327
map->m_len = ar.len;
43304328
allocated = map->m_len;
43314329
ext4_ext_show_leaf(inode, path);
4332-
ext4_fc_track_range(inode, map->m_lblk, map->m_lblk + map->m_len - 1);
43334330
out:
43344331
ext4_ext_drop_refs(path);
43354332
kfree(path);
@@ -4602,7 +4599,7 @@ static long ext4_zero_range(struct file *file, loff_t offset,
46024599
ret = ext4_mark_inode_dirty(handle, inode);
46034600
if (unlikely(ret))
46044601
goto out_handle;
4605-
ext4_fc_track_range(inode, offset >> inode->i_sb->s_blocksize_bits,
4602+
ext4_fc_track_range(handle, inode, offset >> inode->i_sb->s_blocksize_bits,
46064603
(offset + len - 1) >> inode->i_sb->s_blocksize_bits);
46074604
/* Zero out partial block at the edges of the range */
46084605
ret = ext4_zero_partial_blocks(handle, inode, offset, len);
@@ -4651,8 +4648,6 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
46514648
FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE |
46524649
FALLOC_FL_INSERT_RANGE))
46534650
return -EOPNOTSUPP;
4654-
ext4_fc_track_range(inode, offset >> blkbits,
4655-
(offset + len - 1) >> blkbits);
46564651

46574652
ext4_fc_start_update(inode);
46584653

0 commit comments

Comments
 (0)