inode.c (a8ab6d3885ef5e2300d683b79a9e1999403eefd9) inode.c (043546e46dc70c25ff7e2cf6d09cbb0424fc9978)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * linux/fs/ext4/inode.c
4 *
5 * Copyright (C) 1992, 1993, 1994, 1995
6 * Remy Card (card@masi.ibp.fr)
7 * Laboratoire MASI - Institut Blaise Pascal
8 * Universite Pierre et Marie Curie (Paris VI)

--- 4406 unchanged lines hidden (view full) ---

4415 if (!test_bit(EXT4_FLAGS_BDEV_IS_DAX, &sbi->s_ext4_flags))
4416 return false;
4417 if (test_opt(inode->i_sb, DAX_ALWAYS))
4418 return true;
4419
4420 return false;
4421}
4422
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * linux/fs/ext4/inode.c
4 *
5 * Copyright (C) 1992, 1993, 1994, 1995
6 * Remy Card (card@masi.ibp.fr)
7 * Laboratoire MASI - Institut Blaise Pascal
8 * Universite Pierre et Marie Curie (Paris VI)

--- 4406 unchanged lines hidden (view full) ---

4415 if (!test_bit(EXT4_FLAGS_BDEV_IS_DAX, &sbi->s_ext4_flags))
4416 return false;
4417 if (test_opt(inode->i_sb, DAX_ALWAYS))
4418 return true;
4419
4420 return false;
4421}
4422
4423void ext4_set_inode_flags(struct inode *inode)
4423void ext4_set_inode_flags(struct inode *inode, bool init)
4424{
4425 unsigned int flags = EXT4_I(inode)->i_flags;
4426 unsigned int new_fl = 0;
4427
4424{
4425 unsigned int flags = EXT4_I(inode)->i_flags;
4426 unsigned int new_fl = 0;
4427
4428 WARN_ON_ONCE(IS_DAX(inode) && init);
4429
4428 if (flags & EXT4_SYNC_FL)
4429 new_fl |= S_SYNC;
4430 if (flags & EXT4_APPEND_FL)
4431 new_fl |= S_APPEND;
4432 if (flags & EXT4_IMMUTABLE_FL)
4433 new_fl |= S_IMMUTABLE;
4434 if (flags & EXT4_NOATIME_FL)
4435 new_fl |= S_NOATIME;
4436 if (flags & EXT4_DIRSYNC_FL)
4437 new_fl |= S_DIRSYNC;
4430 if (flags & EXT4_SYNC_FL)
4431 new_fl |= S_SYNC;
4432 if (flags & EXT4_APPEND_FL)
4433 new_fl |= S_APPEND;
4434 if (flags & EXT4_IMMUTABLE_FL)
4435 new_fl |= S_IMMUTABLE;
4436 if (flags & EXT4_NOATIME_FL)
4437 new_fl |= S_NOATIME;
4438 if (flags & EXT4_DIRSYNC_FL)
4439 new_fl |= S_DIRSYNC;
4438 if (ext4_should_enable_dax(inode))
4440
4441 /* Because of the way inode_set_flags() works we must preserve S_DAX
4442 * here if already set. */
4443 new_fl |= (inode->i_flags & S_DAX);
4444 if (init && ext4_should_enable_dax(inode))
4439 new_fl |= S_DAX;
4445 new_fl |= S_DAX;
4446
4440 if (flags & EXT4_ENCRYPT_FL)
4441 new_fl |= S_ENCRYPTED;
4442 if (flags & EXT4_CASEFOLD_FL)
4443 new_fl |= S_CASEFOLD;
4444 if (flags & EXT4_VERITY_FL)
4445 new_fl |= S_VERITY;
4446 inode_set_flags(inode, new_fl,
4447 S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC|S_DAX|

--- 197 unchanged lines hidden (view full) ---

4645 /* The only unlinked inodes we let through here have
4646 * valid i_mode and are being read by the orphan
4647 * recovery code: that's fine, we're about to complete
4648 * the process of deleting those.
4649 * OR it is the EXT4_BOOT_LOADER_INO which is
4650 * not initialized on a new filesystem. */
4651 }
4652 ei->i_flags = le32_to_cpu(raw_inode->i_flags);
4447 if (flags & EXT4_ENCRYPT_FL)
4448 new_fl |= S_ENCRYPTED;
4449 if (flags & EXT4_CASEFOLD_FL)
4450 new_fl |= S_CASEFOLD;
4451 if (flags & EXT4_VERITY_FL)
4452 new_fl |= S_VERITY;
4453 inode_set_flags(inode, new_fl,
4454 S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC|S_DAX|

--- 197 unchanged lines hidden (view full) ---

4652 /* The only unlinked inodes we let through here have
4653 * valid i_mode and are being read by the orphan
4654 * recovery code: that's fine, we're about to complete
4655 * the process of deleting those.
4656 * OR it is the EXT4_BOOT_LOADER_INO which is
4657 * not initialized on a new filesystem. */
4658 }
4659 ei->i_flags = le32_to_cpu(raw_inode->i_flags);
4653 ext4_set_inode_flags(inode);
4660 ext4_set_inode_flags(inode, true);
4654 inode->i_blocks = ext4_inode_blocks(raw_inode, ei);
4655 ei->i_file_acl = le32_to_cpu(raw_inode->i_file_acl_lo);
4656 if (ext4_has_feature_64bit(sb))
4657 ei->i_file_acl |=
4658 ((__u64)le16_to_cpu(raw_inode->i_file_acl_high)) << 32;
4659 inode->i_size = ext4_isize(sb, raw_inode);
4660 if ((size = i_size_read(inode)) < 0) {
4661 ext4_error_inode(inode, function, line, 0,

--- 1381 unchanged lines hidden ---
4661 inode->i_blocks = ext4_inode_blocks(raw_inode, ei);
4662 ei->i_file_acl = le32_to_cpu(raw_inode->i_file_acl_lo);
4663 if (ext4_has_feature_64bit(sb))
4664 ei->i_file_acl |=
4665 ((__u64)le16_to_cpu(raw_inode->i_file_acl_high)) << 32;
4666 inode->i_size = ext4_isize(sb, raw_inode);
4667 if ((size = i_size_read(inode)) < 0) {
4668 ext4_error_inode(inode, function, line, 0,

--- 1381 unchanged lines hidden ---