Lines Matching full:sbi

20 static inline unsigned long long iostat_get_avg_bytes(struct f2fs_sb_info *sbi,  in iostat_get_avg_bytes()  argument
23 return sbi->iostat_count[type] ? div64_u64(sbi->iostat_bytes[type], in iostat_get_avg_bytes()
24 sbi->iostat_count[type]) : 0; in iostat_get_avg_bytes()
29 name":", sbi->iostat_bytes[type], \
30 sbi->iostat_count[type], \
31 iostat_get_avg_bytes(sbi, type))
36 struct f2fs_sb_info *sbi = F2FS_SB(sb); in iostat_info_seq_show() local
38 if (!sbi->iostat_enable) in iostat_info_seq_show()
88 static inline void __record_iostat_latency(struct f2fs_sb_info *sbi) in __record_iostat_latency() argument
92 struct iostat_lat_info *io_lat = sbi->iostat_io_lat; in __record_iostat_latency()
95 spin_lock_irqsave(&sbi->iostat_lat_lock, flags); in __record_iostat_latency()
108 spin_unlock_irqrestore(&sbi->iostat_lat_lock, flags); in __record_iostat_latency()
110 trace_f2fs_iostat_latency(sbi, iostat_lat); in __record_iostat_latency()
113 static inline void f2fs_record_iostat(struct f2fs_sb_info *sbi) in f2fs_record_iostat() argument
119 if (time_is_after_jiffies(sbi->iostat_next_period)) in f2fs_record_iostat()
123 spin_lock_irqsave(&sbi->iostat_lock, flags); in f2fs_record_iostat()
124 if (time_is_after_jiffies(sbi->iostat_next_period)) { in f2fs_record_iostat()
125 spin_unlock_irqrestore(&sbi->iostat_lock, flags); in f2fs_record_iostat()
128 sbi->iostat_next_period = jiffies + in f2fs_record_iostat()
129 msecs_to_jiffies(sbi->iostat_period_ms); in f2fs_record_iostat()
132 iostat_diff[i] = sbi->iostat_bytes[i] - in f2fs_record_iostat()
133 sbi->prev_iostat_bytes[i]; in f2fs_record_iostat()
134 sbi->prev_iostat_bytes[i] = sbi->iostat_bytes[i]; in f2fs_record_iostat()
136 spin_unlock_irqrestore(&sbi->iostat_lock, flags); in f2fs_record_iostat()
138 trace_f2fs_iostat(sbi, iostat_diff); in f2fs_record_iostat()
140 __record_iostat_latency(sbi); in f2fs_record_iostat()
143 void f2fs_reset_iostat(struct f2fs_sb_info *sbi) in f2fs_reset_iostat() argument
145 struct iostat_lat_info *io_lat = sbi->iostat_io_lat; in f2fs_reset_iostat()
148 spin_lock_irq(&sbi->iostat_lock); in f2fs_reset_iostat()
150 sbi->iostat_count[i] = 0; in f2fs_reset_iostat()
151 sbi->iostat_bytes[i] = 0; in f2fs_reset_iostat()
152 sbi->prev_iostat_bytes[i] = 0; in f2fs_reset_iostat()
154 spin_unlock_irq(&sbi->iostat_lock); in f2fs_reset_iostat()
156 spin_lock_irq(&sbi->iostat_lat_lock); in f2fs_reset_iostat()
158 spin_unlock_irq(&sbi->iostat_lat_lock); in f2fs_reset_iostat()
161 static inline void __f2fs_update_iostat(struct f2fs_sb_info *sbi, in __f2fs_update_iostat() argument
164 sbi->iostat_bytes[type] += io_bytes; in __f2fs_update_iostat()
165 sbi->iostat_count[type]++; in __f2fs_update_iostat()
168 void f2fs_update_iostat(struct f2fs_sb_info *sbi, struct inode *inode, in f2fs_update_iostat() argument
173 if (!sbi->iostat_enable) in f2fs_update_iostat()
176 spin_lock_irqsave(&sbi->iostat_lock, flags); in f2fs_update_iostat()
177 __f2fs_update_iostat(sbi, type, io_bytes); in f2fs_update_iostat()
180 __f2fs_update_iostat(sbi, APP_WRITE_IO, io_bytes); in f2fs_update_iostat()
183 __f2fs_update_iostat(sbi, APP_READ_IO, io_bytes); in f2fs_update_iostat()
188 __f2fs_update_iostat(sbi, APP_BUFFERED_CDATA_IO, io_bytes); in f2fs_update_iostat()
191 __f2fs_update_iostat(sbi, APP_BUFFERED_CDATA_READ_IO, io_bytes); in f2fs_update_iostat()
194 __f2fs_update_iostat(sbi, APP_MAPPED_CDATA_READ_IO, io_bytes); in f2fs_update_iostat()
197 __f2fs_update_iostat(sbi, APP_MAPPED_CDATA_IO, io_bytes); in f2fs_update_iostat()
200 __f2fs_update_iostat(sbi, FS_CDATA_READ_IO, io_bytes); in f2fs_update_iostat()
203 __f2fs_update_iostat(sbi, FS_CDATA_IO, io_bytes); in f2fs_update_iostat()
207 spin_unlock_irqrestore(&sbi->iostat_lock, flags); in f2fs_update_iostat()
209 f2fs_record_iostat(sbi); in f2fs_update_iostat()
217 struct f2fs_sb_info *sbi = iostat_ctx->sbi; in __update_iostat_latency() local
218 struct iostat_lat_info *io_lat = sbi->iostat_io_lat; in __update_iostat_latency()
221 if (!sbi->iostat_enable) in __update_iostat_latency()
228 f2fs_warn(sbi, "%s: %d over NR_PAGE_TYPE", __func__, page_type); in __update_iostat_latency()
232 spin_lock_irqsave(&sbi->iostat_lat_lock, flags); in __update_iostat_latency()
237 spin_unlock_irqrestore(&sbi->iostat_lat_lock, flags); in __update_iostat_latency()
248 bio->bi_private = iostat_ctx->sbi; in iostat_update_and_unbind_ctx()
258 void iostat_alloc_and_bind_ctx(struct f2fs_sb_info *sbi, in iostat_alloc_and_bind_ctx() argument
264 iostat_ctx->sbi = sbi; in iostat_alloc_and_bind_ctx()
297 int f2fs_init_iostat(struct f2fs_sb_info *sbi) in f2fs_init_iostat() argument
300 spin_lock_init(&sbi->iostat_lock); in f2fs_init_iostat()
301 spin_lock_init(&sbi->iostat_lat_lock); in f2fs_init_iostat()
302 sbi->iostat_enable = false; in f2fs_init_iostat()
303 sbi->iostat_period_ms = DEFAULT_IOSTAT_PERIOD_MS; in f2fs_init_iostat()
304 sbi->iostat_io_lat = f2fs_kzalloc(sbi, sizeof(struct iostat_lat_info), in f2fs_init_iostat()
306 if (!sbi->iostat_io_lat) in f2fs_init_iostat()
312 void f2fs_destroy_iostat(struct f2fs_sb_info *sbi) in f2fs_destroy_iostat() argument
314 kfree(sbi->iostat_io_lat); in f2fs_destroy_iostat()