f2fs.h (fadb2fb8af5348c1bc59cab17c6f8bf515e50d55) | f2fs.h (aaec2b1d18792a5f27b69ff37f34f43f89f5aa3b) |
---|---|
1/* 2 * fs/f2fs/f2fs.h 3 * 4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 5 * http://www.samsung.com/ 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 783 unchanged lines hidden (view full) --- 792 793 /* for bio operations */ 794 struct f2fs_bio_info read_io; /* for read bios */ 795 struct f2fs_bio_info write_io[NR_PAGE_TYPE]; /* for write bios */ 796 struct mutex wio_mutex[NODE + 1]; /* bio ordering for NODE/DATA */ 797 798 /* for checkpoint */ 799 struct f2fs_checkpoint *ckpt; /* raw checkpoint pointer */ | 1/* 2 * fs/f2fs/f2fs.h 3 * 4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 5 * http://www.samsung.com/ 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 783 unchanged lines hidden (view full) --- 792 793 /* for bio operations */ 794 struct f2fs_bio_info read_io; /* for read bios */ 795 struct f2fs_bio_info write_io[NR_PAGE_TYPE]; /* for write bios */ 796 struct mutex wio_mutex[NODE + 1]; /* bio ordering for NODE/DATA */ 797 798 /* for checkpoint */ 799 struct f2fs_checkpoint *ckpt; /* raw checkpoint pointer */ |
800 spinlock_t cp_lock; /* for flag in ckpt */ |
|
800 struct inode *meta_inode; /* cache meta blocks */ 801 struct mutex cp_mutex; /* checkpoint procedure lock */ 802 struct rw_semaphore cp_rwsem; /* blocking FS operations */ 803 struct rw_semaphore node_write; /* locking node writes */ 804 wait_queue_head_t cp_wait; 805 unsigned long last_time[MAX_TIME]; /* to store time in jiffies */ 806 long interval_time[MAX_TIME]; /* to store thresholds */ 807 --- 251 unchanged lines hidden (view full) --- 1059 clear_bit(type, &sbi->s_flag); 1060} 1061 1062static inline unsigned long long cur_cp_version(struct f2fs_checkpoint *cp) 1063{ 1064 return le64_to_cpu(cp->checkpoint_ver); 1065} 1066 | 801 struct inode *meta_inode; /* cache meta blocks */ 802 struct mutex cp_mutex; /* checkpoint procedure lock */ 803 struct rw_semaphore cp_rwsem; /* blocking FS operations */ 804 struct rw_semaphore node_write; /* locking node writes */ 805 wait_queue_head_t cp_wait; 806 unsigned long last_time[MAX_TIME]; /* to store time in jiffies */ 807 long interval_time[MAX_TIME]; /* to store thresholds */ 808 --- 251 unchanged lines hidden (view full) --- 1060 clear_bit(type, &sbi->s_flag); 1061} 1062 1063static inline unsigned long long cur_cp_version(struct f2fs_checkpoint *cp) 1064{ 1065 return le64_to_cpu(cp->checkpoint_ver); 1066} 1067 |
1067static inline bool is_set_ckpt_flags(struct f2fs_checkpoint *cp, unsigned int f) | 1068static inline bool __is_set_ckpt_flags(struct f2fs_checkpoint *cp, unsigned int f) |
1068{ 1069 unsigned int ckpt_flags = le32_to_cpu(cp->ckpt_flags); | 1069{ 1070 unsigned int ckpt_flags = le32_to_cpu(cp->ckpt_flags); |
1071 |
|
1070 return ckpt_flags & f; 1071} 1072 | 1072 return ckpt_flags & f; 1073} 1074 |
1073static inline void set_ckpt_flags(struct f2fs_checkpoint *cp, unsigned int f) | 1075static inline bool is_set_ckpt_flags(struct f2fs_sb_info *sbi, unsigned int f) |
1074{ | 1076{ |
1075 unsigned int ckpt_flags = le32_to_cpu(cp->ckpt_flags); | 1077 return __is_set_ckpt_flags(F2FS_CKPT(sbi), f); 1078} 1079 1080static inline void __set_ckpt_flags(struct f2fs_checkpoint *cp, unsigned int f) 1081{ 1082 unsigned int ckpt_flags; 1083 1084 ckpt_flags = le32_to_cpu(cp->ckpt_flags); |
1076 ckpt_flags |= f; 1077 cp->ckpt_flags = cpu_to_le32(ckpt_flags); 1078} 1079 | 1085 ckpt_flags |= f; 1086 cp->ckpt_flags = cpu_to_le32(ckpt_flags); 1087} 1088 |
1080static inline void clear_ckpt_flags(struct f2fs_checkpoint *cp, unsigned int f) | 1089static inline void set_ckpt_flags(struct f2fs_sb_info *sbi, unsigned int f) |
1081{ | 1090{ |
1082 unsigned int ckpt_flags = le32_to_cpu(cp->ckpt_flags); | 1091 spin_lock(&sbi->cp_lock); 1092 __set_ckpt_flags(F2FS_CKPT(sbi), f); 1093 spin_unlock(&sbi->cp_lock); 1094} 1095 1096static inline void __clear_ckpt_flags(struct f2fs_checkpoint *cp, unsigned int f) 1097{ 1098 unsigned int ckpt_flags; 1099 1100 ckpt_flags = le32_to_cpu(cp->ckpt_flags); |
1083 ckpt_flags &= (~f); 1084 cp->ckpt_flags = cpu_to_le32(ckpt_flags); 1085} 1086 | 1101 ckpt_flags &= (~f); 1102 cp->ckpt_flags = cpu_to_le32(ckpt_flags); 1103} 1104 |
1105static inline void clear_ckpt_flags(struct f2fs_sb_info *sbi, unsigned int f) 1106{ 1107 spin_lock(&sbi->cp_lock); 1108 __clear_ckpt_flags(F2FS_CKPT(sbi), f); 1109 spin_unlock(&sbi->cp_lock); 1110} 1111 |
|
1087static inline bool f2fs_discard_en(struct f2fs_sb_info *sbi) 1088{ 1089 struct request_queue *q = bdev_get_queue(sbi->sb->s_bdev); 1090 1091 return blk_queue_discard(q); 1092} 1093 1094static inline void f2fs_lock_op(struct f2fs_sb_info *sbi) --- 29 unchanged lines hidden (view full) --- 1124 1125static inline bool __remain_node_summaries(int reason) 1126{ 1127 return (reason == CP_UMOUNT || reason == CP_FASTBOOT); 1128} 1129 1130static inline bool __exist_node_summaries(struct f2fs_sb_info *sbi) 1131{ | 1112static inline bool f2fs_discard_en(struct f2fs_sb_info *sbi) 1113{ 1114 struct request_queue *q = bdev_get_queue(sbi->sb->s_bdev); 1115 1116 return blk_queue_discard(q); 1117} 1118 1119static inline void f2fs_lock_op(struct f2fs_sb_info *sbi) --- 29 unchanged lines hidden (view full) --- 1149 1150static inline bool __remain_node_summaries(int reason) 1151{ 1152 return (reason == CP_UMOUNT || reason == CP_FASTBOOT); 1153} 1154 1155static inline bool __exist_node_summaries(struct f2fs_sb_info *sbi) 1156{ |
1132 return (is_set_ckpt_flags(F2FS_CKPT(sbi), CP_UMOUNT_FLAG) || 1133 is_set_ckpt_flags(F2FS_CKPT(sbi), CP_FASTBOOT_FLAG)); | 1157 return (is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG) || 1158 is_set_ckpt_flags(sbi, CP_FASTBOOT_FLAG)); |
1134} 1135 1136/* 1137 * Check whether the given nid is within node id range. 1138 */ 1139static inline int check_nid_range(struct f2fs_sb_info *sbi, nid_t nid) 1140{ 1141 if (unlikely(nid < F2FS_ROOT_INO(sbi))) --- 685 unchanged lines hidden (view full) --- 1827 1828static inline int f2fs_readonly(struct super_block *sb) 1829{ 1830 return sb->s_flags & MS_RDONLY; 1831} 1832 1833static inline bool f2fs_cp_error(struct f2fs_sb_info *sbi) 1834{ | 1159} 1160 1161/* 1162 * Check whether the given nid is within node id range. 1163 */ 1164static inline int check_nid_range(struct f2fs_sb_info *sbi, nid_t nid) 1165{ 1166 if (unlikely(nid < F2FS_ROOT_INO(sbi))) --- 685 unchanged lines hidden (view full) --- 1852 1853static inline int f2fs_readonly(struct super_block *sb) 1854{ 1855 return sb->s_flags & MS_RDONLY; 1856} 1857 1858static inline bool f2fs_cp_error(struct f2fs_sb_info *sbi) 1859{ |
1835 return is_set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG); | 1860 return is_set_ckpt_flags(sbi, CP_ERROR_FLAG); |
1836} 1837 1838static inline bool is_dot_dotdot(const struct qstr *str) 1839{ 1840 if (str->len == 1 && str->name[0] == '.') 1841 return true; 1842 1843 if (str->len == 2 && str->name[0] == '.' && str->name[1] == '.') --- 601 unchanged lines hidden --- | 1861} 1862 1863static inline bool is_dot_dotdot(const struct qstr *str) 1864{ 1865 if (str->len == 1 && str->name[0] == '.') 1866 return true; 1867 1868 if (str->len == 2 && str->name[0] == '.' && str->name[1] == '.') --- 601 unchanged lines hidden --- |