f2fs.h (c59400a68c53374179cdc5f99fa77afbd092dcf8) f2fs.h (430f163b01888dc26696365d9c1053ba9d6c7d92)
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * fs/f2fs/f2fs.h
4 *
5 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
6 * http://www.samsung.com/
7 */
8#ifndef _LINUX_F2FS_H

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

118typedef u32 block_t; /*
119 * should not change u32, since it is the on-disk block
120 * address format, __le32.
121 */
122typedef u32 nid_t;
123
124#define COMPRESS_EXT_NUM 16
125
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * fs/f2fs/f2fs.h
4 *
5 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
6 * http://www.samsung.com/
7 */
8#ifndef _LINUX_F2FS_H

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

118typedef u32 block_t; /*
119 * should not change u32, since it is the on-disk block
120 * address format, __le32.
121 */
122typedef u32 nid_t;
123
124#define COMPRESS_EXT_NUM 16
125
126/*
127 * An implementation of an rwsem that is explicitly unfair to readers. This
128 * prevents priority inversion when a low-priority reader acquires the read lock
129 * while sleeping on the write lock but the write lock is needed by
130 * higher-priority clients.
131 */
132
133struct f2fs_rwsem {
134 struct rw_semaphore internal_rwsem;
135 wait_queue_head_t read_waiters;
136};
137
126struct f2fs_mount_info {
127 unsigned int opt;
128 int write_io_size_bits; /* Write IO size bits */
129 block_t root_reserved_blocks; /* root reserved blocks */
130 kuid_t s_resuid; /* reserved blocks for uid */
131 kgid_t s_resgid; /* reserved blocks for gid */
132 int active_logs; /* # of active logs */
133 int inline_xattr_size; /* inline xattr size */

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

381 struct list_head pend_list[MAX_PLIST_NUM];/* store pending entries */
382 struct list_head wait_list; /* store on-flushing entries */
383 struct list_head fstrim_list; /* in-flight discard from fstrim */
384 wait_queue_head_t discard_wait_queue; /* waiting queue for wake-up */
385 unsigned int discard_wake; /* to wake up discard thread */
386 struct mutex cmd_lock;
387 unsigned int nr_discards; /* # of discards in the list */
388 unsigned int max_discards; /* max. discards to be issued */
138struct f2fs_mount_info {
139 unsigned int opt;
140 int write_io_size_bits; /* Write IO size bits */
141 block_t root_reserved_blocks; /* root reserved blocks */
142 kuid_t s_resuid; /* reserved blocks for uid */
143 kgid_t s_resgid; /* reserved blocks for gid */
144 int active_logs; /* # of active logs */
145 int inline_xattr_size; /* inline xattr size */

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

393 struct list_head pend_list[MAX_PLIST_NUM];/* store pending entries */
394 struct list_head wait_list; /* store on-flushing entries */
395 struct list_head fstrim_list; /* in-flight discard from fstrim */
396 wait_queue_head_t discard_wait_queue; /* waiting queue for wake-up */
397 unsigned int discard_wake; /* to wake up discard thread */
398 struct mutex cmd_lock;
399 unsigned int nr_discards; /* # of discards in the list */
400 unsigned int max_discards; /* max. discards to be issued */
401 unsigned int max_discard_request; /* max. discard request per round */
402 unsigned int min_discard_issue_time; /* min. interval between discard issue */
403 unsigned int mid_discard_issue_time; /* mid. interval between discard issue */
404 unsigned int max_discard_issue_time; /* max. interval between discard issue */
389 unsigned int discard_granularity; /* discard granularity */
390 unsigned int undiscard_blks; /* # of undiscard blocks */
391 unsigned int next_pos; /* next discard position */
392 atomic_t issued_discard; /* # of issued discard */
393 atomic_t queued_discard; /* # of queued discard */
394 atomic_t discard_cmd_cnt; /* # of cached cmd count */
395 struct rb_root_cached root; /* root of discard rb-tree */
396 bool rbtree_check; /* config for consistence check */

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

483
484#ifdef CONFIG_FS_ENCRYPTION
485 /*
486 * For lookups in encrypted directories: either the buffer backing
487 * disk_name, or a buffer that holds the decoded no-key name.
488 */
489 struct fscrypt_str crypto_buf;
490#endif
405 unsigned int discard_granularity; /* discard granularity */
406 unsigned int undiscard_blks; /* # of undiscard blocks */
407 unsigned int next_pos; /* next discard position */
408 atomic_t issued_discard; /* # of issued discard */
409 atomic_t queued_discard; /* # of queued discard */
410 atomic_t discard_cmd_cnt; /* # of cached cmd count */
411 struct rb_root_cached root; /* root of discard rb-tree */
412 bool rbtree_check; /* config for consistence check */

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

499
500#ifdef CONFIG_FS_ENCRYPTION
501 /*
502 * For lookups in encrypted directories: either the buffer backing
503 * disk_name, or a buffer that holds the decoded no-key name.
504 */
505 struct fscrypt_str crypto_buf;
506#endif
491#if IS_ENABLED(CONFIG_UNICODE)
507#ifdef CONFIG_UNICODE
492 /*
493 * For casefolded directories: the casefolded name, but it's left NULL
494 * if the original name is not valid Unicode, if the directory is both
495 * casefolded and encrypted and its encryption key is unavailable, or if
496 * the filesystem is doing an internal operation where usr_fname is also
497 * NULL. In all these cases we fall back to treating the name as an
498 * opaque byte sequence.
499 */

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

569#define DEFAULT_DIRTY_THRESHOLD 4
570
571/* for in-memory extent cache entry */
572#define F2FS_MIN_EXTENT_LEN 64 /* minimum extent length */
573
574/* number of extent info in extent cache we try to shrink */
575#define EXTENT_CACHE_SHRINK_NUMBER 128
576
508 /*
509 * For casefolded directories: the casefolded name, but it's left NULL
510 * if the original name is not valid Unicode, if the directory is both
511 * casefolded and encrypted and its encryption key is unavailable, or if
512 * the filesystem is doing an internal operation where usr_fname is also
513 * NULL. In all these cases we fall back to treating the name as an
514 * opaque byte sequence.
515 */

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

585#define DEFAULT_DIRTY_THRESHOLD 4
586
587/* for in-memory extent cache entry */
588#define F2FS_MIN_EXTENT_LEN 64 /* minimum extent length */
589
590/* number of extent info in extent cache we try to shrink */
591#define EXTENT_CACHE_SHRINK_NUMBER 128
592
593#define RECOVERY_MAX_RA_BLOCKS BIO_MAX_VECS
594#define RECOVERY_MIN_RA_BLOCKS 1
595
577struct rb_entry {
578 struct rb_node rb_node; /* rb node located in rb-tree */
579 union {
580 struct {
581 unsigned int ofs; /* start offset of the entry */
582 unsigned int len; /* length of the entry */
583 };
584 unsigned long long key; /* 64-bits key */

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

747 unsigned int i_current_depth; /* only for directory depth */
748 /* for gc failure statistic */
749 unsigned int i_gc_failures[MAX_GC_FAILURE];
750 unsigned int i_pino; /* parent inode number */
751 umode_t i_acl_mode; /* keep file acl mode temporarily */
752
753 /* Use below internally in f2fs*/
754 unsigned long flags[BITS_TO_LONGS(FI_MAX)]; /* use to pass per-file flags */
596struct rb_entry {
597 struct rb_node rb_node; /* rb node located in rb-tree */
598 union {
599 struct {
600 unsigned int ofs; /* start offset of the entry */
601 unsigned int len; /* length of the entry */
602 };
603 unsigned long long key; /* 64-bits key */

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

766 unsigned int i_current_depth; /* only for directory depth */
767 /* for gc failure statistic */
768 unsigned int i_gc_failures[MAX_GC_FAILURE];
769 unsigned int i_pino; /* parent inode number */
770 umode_t i_acl_mode; /* keep file acl mode temporarily */
771
772 /* Use below internally in f2fs*/
773 unsigned long flags[BITS_TO_LONGS(FI_MAX)]; /* use to pass per-file flags */
755 struct rw_semaphore i_sem; /* protect fi info */
774 struct f2fs_rwsem i_sem; /* protect fi info */
756 atomic_t dirty_pages; /* # of dirty pages */
757 f2fs_hash_t chash; /* hash value of given file name */
758 unsigned int clevel; /* maximum level of given file name */
759 struct task_struct *task; /* lookup and create consistency */
760 struct task_struct *cp_task; /* separate cp/wb IO stats*/
761 nid_t i_xattr_nid; /* node id that contains xattrs */
762 loff_t last_disk_size; /* lastly written file size */
763 spinlock_t i_size_lock; /* protect last_disk_size */

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

772 struct list_head gdirty_list; /* linked in global dirty list */
773 struct list_head inmem_ilist; /* list for inmem inodes */
774 struct list_head inmem_pages; /* inmemory pages managed by f2fs */
775 struct task_struct *inmem_task; /* store inmemory task */
776 struct mutex inmem_lock; /* lock for inmemory pages */
777 struct extent_tree *extent_tree; /* cached extent_tree entry */
778
779 /* avoid racing between foreground op and gc */
775 atomic_t dirty_pages; /* # of dirty pages */
776 f2fs_hash_t chash; /* hash value of given file name */
777 unsigned int clevel; /* maximum level of given file name */
778 struct task_struct *task; /* lookup and create consistency */
779 struct task_struct *cp_task; /* separate cp/wb IO stats*/
780 nid_t i_xattr_nid; /* node id that contains xattrs */
781 loff_t last_disk_size; /* lastly written file size */
782 spinlock_t i_size_lock; /* protect last_disk_size */

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

791 struct list_head gdirty_list; /* linked in global dirty list */
792 struct list_head inmem_ilist; /* list for inmem inodes */
793 struct list_head inmem_pages; /* inmemory pages managed by f2fs */
794 struct task_struct *inmem_task; /* store inmemory task */
795 struct mutex inmem_lock; /* lock for inmemory pages */
796 struct extent_tree *extent_tree; /* cached extent_tree entry */
797
798 /* avoid racing between foreground op and gc */
780 struct rw_semaphore i_gc_rwsem[2];
781 struct rw_semaphore i_xattr_sem; /* avoid racing between reading and changing EAs */
799 struct f2fs_rwsem i_gc_rwsem[2];
800 struct f2fs_rwsem i_xattr_sem; /* avoid racing between reading and changing EAs */
782
783 int i_extra_isize; /* size of extra space located in i_addr */
784 kprojid_t i_projid; /* id for project quota */
785 int i_inline_xattr_size; /* inline xattr size */
786 struct timespec64 i_crtime; /* inode creation time */
787 struct timespec64 i_disk_time[4];/* inode disk times */
788
789 /* for file compress */

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

899 nid_t next_scan_nid; /* the next nid to be scanned */
900 unsigned int ram_thresh; /* control the memory footprint */
901 unsigned int ra_nid_pages; /* # of nid pages to be readaheaded */
902 unsigned int dirty_nats_ratio; /* control dirty nats ratio threshold */
903
904 /* NAT cache management */
905 struct radix_tree_root nat_root;/* root of the nat entry cache */
906 struct radix_tree_root nat_set_root;/* root of the nat set cache */
801
802 int i_extra_isize; /* size of extra space located in i_addr */
803 kprojid_t i_projid; /* id for project quota */
804 int i_inline_xattr_size; /* inline xattr size */
805 struct timespec64 i_crtime; /* inode creation time */
806 struct timespec64 i_disk_time[4];/* inode disk times */
807
808 /* for file compress */

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

918 nid_t next_scan_nid; /* the next nid to be scanned */
919 unsigned int ram_thresh; /* control the memory footprint */
920 unsigned int ra_nid_pages; /* # of nid pages to be readaheaded */
921 unsigned int dirty_nats_ratio; /* control dirty nats ratio threshold */
922
923 /* NAT cache management */
924 struct radix_tree_root nat_root;/* root of the nat entry cache */
925 struct radix_tree_root nat_set_root;/* root of the nat set cache */
907 struct rw_semaphore nat_tree_lock; /* protect nat entry tree */
926 struct f2fs_rwsem nat_tree_lock; /* protect nat entry tree */
908 struct list_head nat_entries; /* cached nat entry list (clean) */
909 spinlock_t nat_list_lock; /* protect clean nat entry list */
910 unsigned int nat_cnt[MAX_NAT_STATE]; /* the # of cached nat entries */
911 unsigned int nat_blocks; /* # of nat blocks */
912
913 /* free node ids management */
914 struct radix_tree_root free_nid_root;/* root of the free_nid cache */
915 struct list_head free_nid_list; /* list for free nids excluding preallocated nids */

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

1012};
1013
1014struct f2fs_sm_info {
1015 struct sit_info *sit_info; /* whole segment information */
1016 struct free_segmap_info *free_info; /* free segment information */
1017 struct dirty_seglist_info *dirty_info; /* dirty segment information */
1018 struct curseg_info *curseg_array; /* active segment information */
1019
927 struct list_head nat_entries; /* cached nat entry list (clean) */
928 spinlock_t nat_list_lock; /* protect clean nat entry list */
929 unsigned int nat_cnt[MAX_NAT_STATE]; /* the # of cached nat entries */
930 unsigned int nat_blocks; /* # of nat blocks */
931
932 /* free node ids management */
933 struct radix_tree_root free_nid_root;/* root of the free_nid cache */
934 struct list_head free_nid_list; /* list for free nids excluding preallocated nids */

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

1031};
1032
1033struct f2fs_sm_info {
1034 struct sit_info *sit_info; /* whole segment information */
1035 struct free_segmap_info *free_info; /* free segment information */
1036 struct dirty_seglist_info *dirty_info; /* dirty segment information */
1037 struct curseg_info *curseg_array; /* active segment information */
1038
1020 struct rw_semaphore curseg_lock; /* for preventing curseg change */
1039 struct f2fs_rwsem curseg_lock; /* for preventing curseg change */
1021
1022 block_t seg0_blkaddr; /* block address of 0'th segment */
1023 block_t main_blkaddr; /* start block address of main area */
1024 block_t ssa_blkaddr; /* start block address of SSA area */
1025
1026 unsigned int segment_count; /* total # of segments */
1027 unsigned int main_segments; /* # of segments in main area */
1028 unsigned int reserved_segments; /* # of reserved segments */

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

1196};
1197
1198#define is_read_io(rw) ((rw) == READ)
1199struct f2fs_bio_info {
1200 struct f2fs_sb_info *sbi; /* f2fs superblock */
1201 struct bio *bio; /* bios to merge */
1202 sector_t last_block_in_bio; /* last block number */
1203 struct f2fs_io_info fio; /* store buffered io info. */
1040
1041 block_t seg0_blkaddr; /* block address of 0'th segment */
1042 block_t main_blkaddr; /* start block address of main area */
1043 block_t ssa_blkaddr; /* start block address of SSA area */
1044
1045 unsigned int segment_count; /* total # of segments */
1046 unsigned int main_segments; /* # of segments in main area */
1047 unsigned int reserved_segments; /* # of reserved segments */

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

1215};
1216
1217#define is_read_io(rw) ((rw) == READ)
1218struct f2fs_bio_info {
1219 struct f2fs_sb_info *sbi; /* f2fs superblock */
1220 struct bio *bio; /* bios to merge */
1221 sector_t last_block_in_bio; /* last block number */
1222 struct f2fs_io_info fio; /* store buffered io info. */
1204 struct rw_semaphore io_rwsem; /* blocking op for bio */
1223 struct f2fs_rwsem io_rwsem; /* blocking op for bio */
1205 spinlock_t io_lock; /* serialize DATA/NODE IOs */
1206 struct list_head io_list; /* track fios */
1207 struct list_head bio_list; /* bio entry list head */
1224 spinlock_t io_lock; /* serialize DATA/NODE IOs */
1225 struct list_head io_list; /* track fios */
1226 struct list_head bio_list; /* bio entry list head */
1208 struct rw_semaphore bio_list_lock; /* lock to protect bio entry list */
1227 struct f2fs_rwsem bio_list_lock; /* lock to protect bio entry list */
1209};
1210
1211#define FDEV(i) (sbi->devs[i])
1212#define RDEV(i) (raw_super->devs[i])
1213struct f2fs_dev_info {
1214 struct block_device *bdev;
1215 char path[MAX_PATH_LEN];
1216 unsigned int total_segments;

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

1566#define MIN_COMPRESS_LOG_SIZE 2
1567#define MAX_COMPRESS_LOG_SIZE 8
1568#define MAX_COMPRESS_WINDOW_SIZE(log_size) ((PAGE_SIZE) << (log_size))
1569
1570struct f2fs_sb_info {
1571 struct super_block *sb; /* pointer to VFS super block */
1572 struct proc_dir_entry *s_proc; /* proc entry */
1573 struct f2fs_super_block *raw_super; /* raw super block pointer */
1228};
1229
1230#define FDEV(i) (sbi->devs[i])
1231#define RDEV(i) (raw_super->devs[i])
1232struct f2fs_dev_info {
1233 struct block_device *bdev;
1234 char path[MAX_PATH_LEN];
1235 unsigned int total_segments;

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

1585#define MIN_COMPRESS_LOG_SIZE 2
1586#define MAX_COMPRESS_LOG_SIZE 8
1587#define MAX_COMPRESS_WINDOW_SIZE(log_size) ((PAGE_SIZE) << (log_size))
1588
1589struct f2fs_sb_info {
1590 struct super_block *sb; /* pointer to VFS super block */
1591 struct proc_dir_entry *s_proc; /* proc entry */
1592 struct f2fs_super_block *raw_super; /* raw super block pointer */
1574 struct rw_semaphore sb_lock; /* lock for raw super block */
1593 struct f2fs_rwsem sb_lock; /* lock for raw super block */
1575 int valid_super_block; /* valid super block no */
1576 unsigned long s_flag; /* flags for sbi */
1577 struct mutex writepages; /* mutex for writepages() */
1578
1579#ifdef CONFIG_BLK_DEV_ZONED
1580 unsigned int blocks_per_blkz; /* F2FS blocks per zone */
1581 unsigned int log_blocks_per_blkz; /* log2 F2FS blocks per zone */
1582#endif
1583
1584 /* for node-related operations */
1585 struct f2fs_nm_info *nm_info; /* node manager */
1586 struct inode *node_inode; /* cache node blocks */
1587
1588 /* for segment-related operations */
1589 struct f2fs_sm_info *sm_info; /* segment manager */
1590
1591 /* for bio operations */
1592 struct f2fs_bio_info *write_io[NR_PAGE_TYPE]; /* for write bios */
1593 /* keep migration IO order for LFS mode */
1594 int valid_super_block; /* valid super block no */
1595 unsigned long s_flag; /* flags for sbi */
1596 struct mutex writepages; /* mutex for writepages() */
1597
1598#ifdef CONFIG_BLK_DEV_ZONED
1599 unsigned int blocks_per_blkz; /* F2FS blocks per zone */
1600 unsigned int log_blocks_per_blkz; /* log2 F2FS blocks per zone */
1601#endif
1602
1603 /* for node-related operations */
1604 struct f2fs_nm_info *nm_info; /* node manager */
1605 struct inode *node_inode; /* cache node blocks */
1606
1607 /* for segment-related operations */
1608 struct f2fs_sm_info *sm_info; /* segment manager */
1609
1610 /* for bio operations */
1611 struct f2fs_bio_info *write_io[NR_PAGE_TYPE]; /* for write bios */
1612 /* keep migration IO order for LFS mode */
1594 struct rw_semaphore io_order_lock;
1613 struct f2fs_rwsem io_order_lock;
1595 mempool_t *write_io_dummy; /* Dummy pages */
1596
1597 /* for checkpoint */
1598 struct f2fs_checkpoint *ckpt; /* raw checkpoint pointer */
1599 int cur_cp_pack; /* remain current cp pack */
1600 spinlock_t cp_lock; /* for flag in ckpt */
1601 struct inode *meta_inode; /* cache meta blocks */
1614 mempool_t *write_io_dummy; /* Dummy pages */
1615
1616 /* for checkpoint */
1617 struct f2fs_checkpoint *ckpt; /* raw checkpoint pointer */
1618 int cur_cp_pack; /* remain current cp pack */
1619 spinlock_t cp_lock; /* for flag in ckpt */
1620 struct inode *meta_inode; /* cache meta blocks */
1602 struct rw_semaphore cp_global_sem; /* checkpoint procedure lock */
1603 struct rw_semaphore cp_rwsem; /* blocking FS operations */
1604 struct rw_semaphore node_write; /* locking node writes */
1605 struct rw_semaphore node_change; /* locking node change */
1621 struct f2fs_rwsem cp_global_sem; /* checkpoint procedure lock */
1622 struct f2fs_rwsem cp_rwsem; /* blocking FS operations */
1623 struct f2fs_rwsem node_write; /* locking node writes */
1624 struct f2fs_rwsem node_change; /* locking node change */
1606 wait_queue_head_t cp_wait;
1607 unsigned long last_time[MAX_TIME]; /* to store time in jiffies */
1608 long interval_time[MAX_TIME]; /* to store thresholds */
1609 struct ckpt_req_control cprc_info; /* for checkpoint request control */
1610
1611 struct inode_management im[MAX_INO_ENTRY]; /* manage inode cache */
1612
1613 spinlock_t fsync_node_lock; /* for node entry lock */

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

1657 block_t last_valid_block_count; /* for recovery */
1658 block_t reserved_blocks; /* configurable reserved blocks */
1659 block_t current_reserved_blocks; /* current reserved blocks */
1660
1661 /* Additional tracking for no checkpoint mode */
1662 block_t unusable_block_count; /* # of blocks saved by last cp */
1663
1664 unsigned int nquota_files; /* # of quota sysfile */
1625 wait_queue_head_t cp_wait;
1626 unsigned long last_time[MAX_TIME]; /* to store time in jiffies */
1627 long interval_time[MAX_TIME]; /* to store thresholds */
1628 struct ckpt_req_control cprc_info; /* for checkpoint request control */
1629
1630 struct inode_management im[MAX_INO_ENTRY]; /* manage inode cache */
1631
1632 spinlock_t fsync_node_lock; /* for node entry lock */

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

1676 block_t last_valid_block_count; /* for recovery */
1677 block_t reserved_blocks; /* configurable reserved blocks */
1678 block_t current_reserved_blocks; /* current reserved blocks */
1679
1680 /* Additional tracking for no checkpoint mode */
1681 block_t unusable_block_count; /* # of blocks saved by last cp */
1682
1683 unsigned int nquota_files; /* # of quota sysfile */
1665 struct rw_semaphore quota_sem; /* blocking cp for flags */
1684 struct f2fs_rwsem quota_sem; /* blocking cp for flags */
1666
1667 /* # of pages, see count_type */
1668 atomic_t nr_pages[NR_COUNT_TYPE];
1669 /* # of allocated blocks */
1670 struct percpu_counter alloc_valid_block_count;
1671
1672 /* writeback control */
1673 atomic_t wb_sync_req[META]; /* count # of WB_SYNC threads */
1674
1675 /* valid inode count */
1676 struct percpu_counter total_valid_inode_count;
1677
1678 struct f2fs_mount_info mount_opt; /* mount options */
1679
1680 /* for cleaning operations */
1685
1686 /* # of pages, see count_type */
1687 atomic_t nr_pages[NR_COUNT_TYPE];
1688 /* # of allocated blocks */
1689 struct percpu_counter alloc_valid_block_count;
1690
1691 /* writeback control */
1692 atomic_t wb_sync_req[META]; /* count # of WB_SYNC threads */
1693
1694 /* valid inode count */
1695 struct percpu_counter total_valid_inode_count;
1696
1697 struct f2fs_mount_info mount_opt; /* mount options */
1698
1699 /* for cleaning operations */
1681 struct rw_semaphore gc_lock; /*
1700 struct f2fs_rwsem gc_lock; /*
1682 * semaphore for GC, avoid
1683 * race between GC and GC or CP
1684 */
1685 struct f2fs_gc_kthread *gc_thread; /* GC thread */
1686 struct atgc_management am; /* atgc management */
1687 unsigned int cur_victim_sec; /* current victim section num */
1688 unsigned int gc_mode; /* current GC state */
1689 unsigned int next_victim_seg[2]; /* next segment in victim section */
1690 spinlock_t gc_urgent_high_lock;
1691 bool gc_urgent_high_limited; /* indicates having limited trial count */
1692 unsigned int gc_urgent_high_remaining; /* remaining trial count for GC_URGENT_HIGH */
1693
1694 /* for skip statistic */
1695 unsigned int atomic_files; /* # of opened atomic file */
1696 unsigned long long skipped_atomic_files[2]; /* FG_GC and BG_GC */
1697 unsigned long long skipped_gc_rwsem; /* FG_GC only */
1698
1699 /* threshold for gc trials on pinned files */
1700 u64 gc_pin_file_threshold;
1701 * semaphore for GC, avoid
1702 * race between GC and GC or CP
1703 */
1704 struct f2fs_gc_kthread *gc_thread; /* GC thread */
1705 struct atgc_management am; /* atgc management */
1706 unsigned int cur_victim_sec; /* current victim section num */
1707 unsigned int gc_mode; /* current GC state */
1708 unsigned int next_victim_seg[2]; /* next segment in victim section */
1709 spinlock_t gc_urgent_high_lock;
1710 bool gc_urgent_high_limited; /* indicates having limited trial count */
1711 unsigned int gc_urgent_high_remaining; /* remaining trial count for GC_URGENT_HIGH */
1712
1713 /* for skip statistic */
1714 unsigned int atomic_files; /* # of opened atomic file */
1715 unsigned long long skipped_atomic_files[2]; /* FG_GC and BG_GC */
1716 unsigned long long skipped_gc_rwsem; /* FG_GC only */
1717
1718 /* threshold for gc trials on pinned files */
1719 u64 gc_pin_file_threshold;
1701 struct rw_semaphore pin_sem;
1720 struct f2fs_rwsem pin_sem;
1702
1703 /* maximum # of trials to find a victim segment for SSR and GC */
1704 unsigned int max_victim_search;
1705 /* migration granularity of garbage collection, unit: segment */
1706 unsigned int migration_granularity;
1707
1708 /*
1709 * for stat information.

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

2087{
2088 unsigned long flags;
2089
2090 spin_lock_irqsave(&sbi->cp_lock, flags);
2091 __clear_ckpt_flags(F2FS_CKPT(sbi), f);
2092 spin_unlock_irqrestore(&sbi->cp_lock, flags);
2093}
2094
1721
1722 /* maximum # of trials to find a victim segment for SSR and GC */
1723 unsigned int max_victim_search;
1724 /* migration granularity of garbage collection, unit: segment */
1725 unsigned int migration_granularity;
1726
1727 /*
1728 * for stat information.

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

2106{
2107 unsigned long flags;
2108
2109 spin_lock_irqsave(&sbi->cp_lock, flags);
2110 __clear_ckpt_flags(F2FS_CKPT(sbi), f);
2111 spin_unlock_irqrestore(&sbi->cp_lock, flags);
2112}
2113
2114static inline void init_f2fs_rwsem(struct f2fs_rwsem *sem)
2115{
2116 init_rwsem(&sem->internal_rwsem);
2117 init_waitqueue_head(&sem->read_waiters);
2118}
2119
2120static inline int f2fs_rwsem_is_locked(struct f2fs_rwsem *sem)
2121{
2122 return rwsem_is_locked(&sem->internal_rwsem);
2123}
2124
2125static inline int f2fs_rwsem_is_contended(struct f2fs_rwsem *sem)
2126{
2127 return rwsem_is_contended(&sem->internal_rwsem);
2128}
2129
2130static inline void f2fs_down_read(struct f2fs_rwsem *sem)
2131{
2132 wait_event(sem->read_waiters, down_read_trylock(&sem->internal_rwsem));
2133}
2134
2135static inline int f2fs_down_read_trylock(struct f2fs_rwsem *sem)
2136{
2137 return down_read_trylock(&sem->internal_rwsem);
2138}
2139
2140#ifdef CONFIG_DEBUG_LOCK_ALLOC
2141static inline void f2fs_down_read_nested(struct f2fs_rwsem *sem, int subclass)
2142{
2143 down_read_nested(&sem->internal_rwsem, subclass);
2144}
2145#else
2146#define f2fs_down_read_nested(sem, subclass) f2fs_down_read(sem)
2147#endif
2148
2149static inline void f2fs_up_read(struct f2fs_rwsem *sem)
2150{
2151 up_read(&sem->internal_rwsem);
2152}
2153
2154static inline void f2fs_down_write(struct f2fs_rwsem *sem)
2155{
2156 down_write(&sem->internal_rwsem);
2157}
2158
2159static inline int f2fs_down_write_trylock(struct f2fs_rwsem *sem)
2160{
2161 return down_write_trylock(&sem->internal_rwsem);
2162}
2163
2164static inline void f2fs_up_write(struct f2fs_rwsem *sem)
2165{
2166 up_write(&sem->internal_rwsem);
2167 wake_up_all(&sem->read_waiters);
2168}
2169
2095static inline void f2fs_lock_op(struct f2fs_sb_info *sbi)
2096{
2170static inline void f2fs_lock_op(struct f2fs_sb_info *sbi)
2171{
2097 down_read(&sbi->cp_rwsem);
2172 f2fs_down_read(&sbi->cp_rwsem);
2098}
2099
2100static inline int f2fs_trylock_op(struct f2fs_sb_info *sbi)
2101{
2102 if (time_to_inject(sbi, FAULT_LOCK_OP)) {
2103 f2fs_show_injection_info(sbi, FAULT_LOCK_OP);
2104 return 0;
2105 }
2173}
2174
2175static inline int f2fs_trylock_op(struct f2fs_sb_info *sbi)
2176{
2177 if (time_to_inject(sbi, FAULT_LOCK_OP)) {
2178 f2fs_show_injection_info(sbi, FAULT_LOCK_OP);
2179 return 0;
2180 }
2106 return down_read_trylock(&sbi->cp_rwsem);
2181 return f2fs_down_read_trylock(&sbi->cp_rwsem);
2107}
2108
2109static inline void f2fs_unlock_op(struct f2fs_sb_info *sbi)
2110{
2182}
2183
2184static inline void f2fs_unlock_op(struct f2fs_sb_info *sbi)
2185{
2111 up_read(&sbi->cp_rwsem);
2186 f2fs_up_read(&sbi->cp_rwsem);
2112}
2113
2114static inline void f2fs_lock_all(struct f2fs_sb_info *sbi)
2115{
2187}
2188
2189static inline void f2fs_lock_all(struct f2fs_sb_info *sbi)
2190{
2116 down_write(&sbi->cp_rwsem);
2191 f2fs_down_write(&sbi->cp_rwsem);
2117}
2118
2119static inline void f2fs_unlock_all(struct f2fs_sb_info *sbi)
2120{
2192}
2193
2194static inline void f2fs_unlock_all(struct f2fs_sb_info *sbi)
2195{
2121 up_write(&sbi->cp_rwsem);
2196 f2fs_up_write(&sbi->cp_rwsem);
2122}
2123
2124static inline int __get_cp_reason(struct f2fs_sb_info *sbi)
2125{
2126 int reason = CP_SYNC;
2127
2128 if (test_opt(sbi, FASTBOOT))
2129 reason = CP_FASTBOOT;

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

3574struct page *f2fs_grab_meta_page(struct f2fs_sb_info *sbi, pgoff_t index);
3575struct page *f2fs_get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index);
3576struct page *f2fs_get_meta_page_retry(struct f2fs_sb_info *sbi, pgoff_t index);
3577struct page *f2fs_get_tmp_page(struct f2fs_sb_info *sbi, pgoff_t index);
3578bool f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
3579 block_t blkaddr, int type);
3580int f2fs_ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages,
3581 int type, bool sync);
2197}
2198
2199static inline int __get_cp_reason(struct f2fs_sb_info *sbi)
2200{
2201 int reason = CP_SYNC;
2202
2203 if (test_opt(sbi, FASTBOOT))
2204 reason = CP_FASTBOOT;

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

3649struct page *f2fs_grab_meta_page(struct f2fs_sb_info *sbi, pgoff_t index);
3650struct page *f2fs_get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index);
3651struct page *f2fs_get_meta_page_retry(struct f2fs_sb_info *sbi, pgoff_t index);
3652struct page *f2fs_get_tmp_page(struct f2fs_sb_info *sbi, pgoff_t index);
3653bool f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
3654 block_t blkaddr, int type);
3655int f2fs_ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages,
3656 int type, bool sync);
3582void f2fs_ra_meta_pages_cond(struct f2fs_sb_info *sbi, pgoff_t index);
3657void f2fs_ra_meta_pages_cond(struct f2fs_sb_info *sbi, pgoff_t index,
3658 unsigned int ra_blocks);
3583long f2fs_sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type,
3584 long nr_to_write, enum iostat_type io_type);
3585void f2fs_add_ino_entry(struct f2fs_sb_info *sbi, nid_t ino, int type);
3586void f2fs_remove_ino_entry(struct f2fs_sb_info *sbi, nid_t ino, int type);
3587void f2fs_release_ino_entry(struct f2fs_sb_info *sbi, bool all);
3588bool f2fs_exist_written_data(struct f2fs_sb_info *sbi, nid_t ino, int mode);
3589void f2fs_set_dirty_device(struct f2fs_sb_info *sbi, nid_t ino,
3590 unsigned int devidx, int type);

--- 842 unchanged lines hidden ---
3659long f2fs_sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type,
3660 long nr_to_write, enum iostat_type io_type);
3661void f2fs_add_ino_entry(struct f2fs_sb_info *sbi, nid_t ino, int type);
3662void f2fs_remove_ino_entry(struct f2fs_sb_info *sbi, nid_t ino, int type);
3663void f2fs_release_ino_entry(struct f2fs_sb_info *sbi, bool all);
3664bool f2fs_exist_written_data(struct f2fs_sb_info *sbi, nid_t ino, int mode);
3665void f2fs_set_dirty_device(struct f2fs_sb_info *sbi, nid_t ino,
3666 unsigned int devidx, int type);

--- 842 unchanged lines hidden ---