@@ -678,6 +678,44 @@ enum {
678
678
MAX_GC_FAILURE
679
679
};
680
680
681
+ /* used for f2fs_inode_info->flags */
682
+ enum {
683
+ FI_NEW_INODE , /* indicate newly allocated inode */
684
+ FI_DIRTY_INODE , /* indicate inode is dirty or not */
685
+ FI_AUTO_RECOVER , /* indicate inode is recoverable */
686
+ FI_DIRTY_DIR , /* indicate directory has dirty pages */
687
+ FI_INC_LINK , /* need to increment i_nlink */
688
+ FI_ACL_MODE , /* indicate acl mode */
689
+ FI_NO_ALLOC , /* should not allocate any blocks */
690
+ FI_FREE_NID , /* free allocated nide */
691
+ FI_NO_EXTENT , /* not to use the extent cache */
692
+ FI_INLINE_XATTR , /* used for inline xattr */
693
+ FI_INLINE_DATA , /* used for inline data*/
694
+ FI_INLINE_DENTRY , /* used for inline dentry */
695
+ FI_APPEND_WRITE , /* inode has appended data */
696
+ FI_UPDATE_WRITE , /* inode has in-place-update data */
697
+ FI_NEED_IPU , /* used for ipu per file */
698
+ FI_ATOMIC_FILE , /* indicate atomic file */
699
+ FI_ATOMIC_COMMIT , /* indicate the state of atomical committing */
700
+ FI_VOLATILE_FILE , /* indicate volatile file */
701
+ FI_FIRST_BLOCK_WRITTEN , /* indicate #0 data block was written */
702
+ FI_DROP_CACHE , /* drop dirty page cache */
703
+ FI_DATA_EXIST , /* indicate data exists */
704
+ FI_INLINE_DOTS , /* indicate inline dot dentries */
705
+ FI_DO_DEFRAG , /* indicate defragment is running */
706
+ FI_DIRTY_FILE , /* indicate regular/symlink has dirty pages */
707
+ FI_NO_PREALLOC , /* indicate skipped preallocated blocks */
708
+ FI_HOT_DATA , /* indicate file is hot */
709
+ FI_EXTRA_ATTR , /* indicate file has extra attribute */
710
+ FI_PROJ_INHERIT , /* indicate file inherits projectid */
711
+ FI_PIN_FILE , /* indicate file should not be gced */
712
+ FI_ATOMIC_REVOKE_REQUEST , /* request to drop atomic data */
713
+ FI_VERITY_IN_PROGRESS , /* building fs-verity Merkle tree */
714
+ FI_COMPRESSED_FILE , /* indicate file's data can be compressed */
715
+ FI_MMAP_FILE , /* indicate file was mmapped */
716
+ FI_MAX , /* max flag, never be used */
717
+ };
718
+
681
719
struct f2fs_inode_info {
682
720
struct inode vfs_inode ; /* serve a vfs inode */
683
721
unsigned long i_flags ; /* keep an inode flags for ioctl */
@@ -690,7 +728,7 @@ struct f2fs_inode_info {
690
728
umode_t i_acl_mode ; /* keep file acl mode temporarily */
691
729
692
730
/* Use below internally in f2fs*/
693
- unsigned long flags ; /* use to pass per-file flags */
731
+ unsigned long flags [ BITS_TO_LONGS ( FI_MAX )]; /* use to pass per-file flags */
694
732
struct rw_semaphore i_sem ; /* protect fi info */
695
733
atomic_t dirty_pages ; /* # of dirty pages */
696
734
f2fs_hash_t chash ; /* hash value of given file name */
@@ -2522,43 +2560,6 @@ static inline __u32 f2fs_mask_flags(umode_t mode, __u32 flags)
2522
2560
return flags & F2FS_OTHER_FLMASK ;
2523
2561
}
2524
2562
2525
- /* used for f2fs_inode_info->flags */
2526
- enum {
2527
- FI_NEW_INODE , /* indicate newly allocated inode */
2528
- FI_DIRTY_INODE , /* indicate inode is dirty or not */
2529
- FI_AUTO_RECOVER , /* indicate inode is recoverable */
2530
- FI_DIRTY_DIR , /* indicate directory has dirty pages */
2531
- FI_INC_LINK , /* need to increment i_nlink */
2532
- FI_ACL_MODE , /* indicate acl mode */
2533
- FI_NO_ALLOC , /* should not allocate any blocks */
2534
- FI_FREE_NID , /* free allocated nide */
2535
- FI_NO_EXTENT , /* not to use the extent cache */
2536
- FI_INLINE_XATTR , /* used for inline xattr */
2537
- FI_INLINE_DATA , /* used for inline data*/
2538
- FI_INLINE_DENTRY , /* used for inline dentry */
2539
- FI_APPEND_WRITE , /* inode has appended data */
2540
- FI_UPDATE_WRITE , /* inode has in-place-update data */
2541
- FI_NEED_IPU , /* used for ipu per file */
2542
- FI_ATOMIC_FILE , /* indicate atomic file */
2543
- FI_ATOMIC_COMMIT , /* indicate the state of atomical committing */
2544
- FI_VOLATILE_FILE , /* indicate volatile file */
2545
- FI_FIRST_BLOCK_WRITTEN , /* indicate #0 data block was written */
2546
- FI_DROP_CACHE , /* drop dirty page cache */
2547
- FI_DATA_EXIST , /* indicate data exists */
2548
- FI_INLINE_DOTS , /* indicate inline dot dentries */
2549
- FI_DO_DEFRAG , /* indicate defragment is running */
2550
- FI_DIRTY_FILE , /* indicate regular/symlink has dirty pages */
2551
- FI_NO_PREALLOC , /* indicate skipped preallocated blocks */
2552
- FI_HOT_DATA , /* indicate file is hot */
2553
- FI_EXTRA_ATTR , /* indicate file has extra attribute */
2554
- FI_PROJ_INHERIT , /* indicate file inherits projectid */
2555
- FI_PIN_FILE , /* indicate file should not be gced */
2556
- FI_ATOMIC_REVOKE_REQUEST , /* request to drop atomic data */
2557
- FI_VERITY_IN_PROGRESS , /* building fs-verity Merkle tree */
2558
- FI_COMPRESSED_FILE , /* indicate file's data can be compressed */
2559
- FI_MMAP_FILE , /* indicate file was mmapped */
2560
- };
2561
-
2562
2563
static inline void __mark_inode_dirty_flag (struct inode * inode ,
2563
2564
int flag , bool set )
2564
2565
{
@@ -2579,20 +2580,18 @@ static inline void __mark_inode_dirty_flag(struct inode *inode,
2579
2580
2580
2581
static inline void set_inode_flag (struct inode * inode , int flag )
2581
2582
{
2582
- if (!test_bit (flag , & F2FS_I (inode )-> flags ))
2583
- set_bit (flag , & F2FS_I (inode )-> flags );
2583
+ test_and_set_bit (flag , F2FS_I (inode )-> flags );
2584
2584
__mark_inode_dirty_flag (inode , flag , true);
2585
2585
}
2586
2586
2587
2587
static inline int is_inode_flag_set (struct inode * inode , int flag )
2588
2588
{
2589
- return test_bit (flag , & F2FS_I (inode )-> flags );
2589
+ return test_bit (flag , F2FS_I (inode )-> flags );
2590
2590
}
2591
2591
2592
2592
static inline void clear_inode_flag (struct inode * inode , int flag )
2593
2593
{
2594
- if (test_bit (flag , & F2FS_I (inode )-> flags ))
2595
- clear_bit (flag , & F2FS_I (inode )-> flags );
2594
+ test_and_clear_bit (flag , F2FS_I (inode )-> flags );
2596
2595
__mark_inode_dirty_flag (inode , flag , false);
2597
2596
}
2598
2597
@@ -2683,19 +2682,19 @@ static inline void get_inline_info(struct inode *inode, struct f2fs_inode *ri)
2683
2682
struct f2fs_inode_info * fi = F2FS_I (inode );
2684
2683
2685
2684
if (ri -> i_inline & F2FS_INLINE_XATTR )
2686
- set_bit (FI_INLINE_XATTR , & fi -> flags );
2685
+ set_bit (FI_INLINE_XATTR , fi -> flags );
2687
2686
if (ri -> i_inline & F2FS_INLINE_DATA )
2688
- set_bit (FI_INLINE_DATA , & fi -> flags );
2687
+ set_bit (FI_INLINE_DATA , fi -> flags );
2689
2688
if (ri -> i_inline & F2FS_INLINE_DENTRY )
2690
- set_bit (FI_INLINE_DENTRY , & fi -> flags );
2689
+ set_bit (FI_INLINE_DENTRY , fi -> flags );
2691
2690
if (ri -> i_inline & F2FS_DATA_EXIST )
2692
- set_bit (FI_DATA_EXIST , & fi -> flags );
2691
+ set_bit (FI_DATA_EXIST , fi -> flags );
2693
2692
if (ri -> i_inline & F2FS_INLINE_DOTS )
2694
- set_bit (FI_INLINE_DOTS , & fi -> flags );
2693
+ set_bit (FI_INLINE_DOTS , fi -> flags );
2695
2694
if (ri -> i_inline & F2FS_EXTRA_ATTR )
2696
- set_bit (FI_EXTRA_ATTR , & fi -> flags );
2695
+ set_bit (FI_EXTRA_ATTR , fi -> flags );
2697
2696
if (ri -> i_inline & F2FS_PIN_FILE )
2698
- set_bit (FI_PIN_FILE , & fi -> flags );
2697
+ set_bit (FI_PIN_FILE , fi -> flags );
2699
2698
}
2700
2699
2701
2700
static inline void set_raw_inline (struct inode * inode , struct f2fs_inode * ri )
0 commit comments