diff options
author | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-02-23 23:00:13 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-02-24 02:00:41 -0500 |
commit | 8b8343fa9d503894ece57acbe46cb36883646685 (patch) | |
tree | a8650f40e45644e91aad8298038aee3c024a80d8 /fs/f2fs/segment.h | |
parent | 8a7ed66aaf8ee56b0a6beee4d02e10af5a9e38b2 (diff) |
f2fs: implement a lock-free stat_show
The stat_show is just to show the current status of f2fs.
So, we can remove all the there-in locks.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/segment.h')
-rw-r--r-- | fs/f2fs/segment.h | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 4024546b6361..c3d5e3689ffc 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h | |||
@@ -380,26 +380,12 @@ static inline void get_sit_bitmap(struct f2fs_sb_info *sbi, | |||
380 | 380 | ||
381 | static inline block_t written_block_count(struct f2fs_sb_info *sbi) | 381 | static inline block_t written_block_count(struct f2fs_sb_info *sbi) |
382 | { | 382 | { |
383 | struct sit_info *sit_i = SIT_I(sbi); | 383 | return SIT_I(sbi)->written_valid_blocks; |
384 | block_t vblocks; | ||
385 | |||
386 | mutex_lock(&sit_i->sentry_lock); | ||
387 | vblocks = sit_i->written_valid_blocks; | ||
388 | mutex_unlock(&sit_i->sentry_lock); | ||
389 | |||
390 | return vblocks; | ||
391 | } | 384 | } |
392 | 385 | ||
393 | static inline unsigned int free_segments(struct f2fs_sb_info *sbi) | 386 | static inline unsigned int free_segments(struct f2fs_sb_info *sbi) |
394 | { | 387 | { |
395 | struct free_segmap_info *free_i = FREE_I(sbi); | 388 | return FREE_I(sbi)->free_segments; |
396 | unsigned int free_segs; | ||
397 | |||
398 | read_lock(&free_i->segmap_lock); | ||
399 | free_segs = free_i->free_segments; | ||
400 | read_unlock(&free_i->segmap_lock); | ||
401 | |||
402 | return free_segs; | ||
403 | } | 389 | } |
404 | 390 | ||
405 | static inline int reserved_segments(struct f2fs_sb_info *sbi) | 391 | static inline int reserved_segments(struct f2fs_sb_info *sbi) |
@@ -409,14 +395,7 @@ static inline int reserved_segments(struct f2fs_sb_info *sbi) | |||
409 | 395 | ||
410 | static inline unsigned int free_sections(struct f2fs_sb_info *sbi) | 396 | static inline unsigned int free_sections(struct f2fs_sb_info *sbi) |
411 | { | 397 | { |
412 | struct free_segmap_info *free_i = FREE_I(sbi); | 398 | return FREE_I(sbi)->free_sections; |
413 | unsigned int free_secs; | ||
414 | |||
415 | read_lock(&free_i->segmap_lock); | ||
416 | free_secs = free_i->free_sections; | ||
417 | read_unlock(&free_i->segmap_lock); | ||
418 | |||
419 | return free_secs; | ||
420 | } | 399 | } |
421 | 400 | ||
422 | static inline unsigned int prefree_segments(struct f2fs_sb_info *sbi) | 401 | static inline unsigned int prefree_segments(struct f2fs_sb_info *sbi) |