f2fs.h (feeb0debfb3454726ebea3871cecac35e144d1bb) | f2fs.h (caf0047e7e1e60a7ad1d655d3b81b32e2dfb6095) |
---|---|
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 --- 14 unchanged lines hidden (view full) --- 23#ifdef CONFIG_F2FS_CHECK_FS 24#define f2fs_bug_on(sbi, condition) BUG_ON(condition) 25#define f2fs_down_write(x, y) down_write_nest_lock(x, y) 26#else 27#define f2fs_bug_on(sbi, condition) \ 28 do { \ 29 if (unlikely(condition)) { \ 30 WARN_ON(1); \ | 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 --- 14 unchanged lines hidden (view full) --- 23#ifdef CONFIG_F2FS_CHECK_FS 24#define f2fs_bug_on(sbi, condition) BUG_ON(condition) 25#define f2fs_down_write(x, y) down_write_nest_lock(x, y) 26#else 27#define f2fs_bug_on(sbi, condition) \ 28 do { \ 29 if (unlikely(condition)) { \ 30 WARN_ON(1); \ |
31 sbi->need_fsck = true; \ | 31 set_sbi_flag(sbi, SBI_NEED_FSCK); \ |
32 } \ 33 } while (0) 34#define f2fs_down_write(x, y) down_write(x) 35#endif 36 37/* 38 * For mount options 39 */ --- 474 unchanged lines hidden (view full) --- 514/* for inner inode cache management */ 515struct inode_management { 516 struct radix_tree_root ino_root; /* ino entry array */ 517 spinlock_t ino_lock; /* for ino entry lock */ 518 struct list_head ino_list; /* inode list head */ 519 unsigned long ino_num; /* number of entries */ 520}; 521 | 32 } \ 33 } while (0) 34#define f2fs_down_write(x, y) down_write(x) 35#endif 36 37/* 38 * For mount options 39 */ --- 474 unchanged lines hidden (view full) --- 514/* for inner inode cache management */ 515struct inode_management { 516 struct radix_tree_root ino_root; /* ino entry array */ 517 spinlock_t ino_lock; /* for ino entry lock */ 518 struct list_head ino_list; /* inode list head */ 519 unsigned long ino_num; /* number of entries */ 520}; 521 |
522/* For s_flag in struct f2fs_sb_info */ 523enum { 524 SBI_IS_DIRTY, /* dirty flag for checkpoint */ 525 SBI_IS_CLOSE, /* specify unmounting */ 526 SBI_NEED_FSCK, /* need fsck.f2fs to fix */ 527 SBI_POR_DOING, /* recovery is doing or not */ 528}; 529 |
|
522struct f2fs_sb_info { 523 struct super_block *sb; /* pointer to VFS super block */ 524 struct proc_dir_entry *s_proc; /* proc entry */ 525 struct buffer_head *raw_super_buf; /* buffer head of raw sb */ 526 struct f2fs_super_block *raw_super; /* raw super block pointer */ | 530struct f2fs_sb_info { 531 struct super_block *sb; /* pointer to VFS super block */ 532 struct proc_dir_entry *s_proc; /* proc entry */ 533 struct buffer_head *raw_super_buf; /* buffer head of raw sb */ 534 struct f2fs_super_block *raw_super; /* raw super block pointer */ |
527 int s_dirty; /* dirty flag for checkpoint */ 528 bool need_fsck; /* need fsck.f2fs to fix */ 529 bool s_closing; /* specify unmounting */ | 535 int s_flag; /* flags for sbi */ |
530 531 /* for node-related operations */ 532 struct f2fs_nm_info *nm_info; /* node manager */ 533 struct inode *node_inode; /* cache node blocks */ 534 535 /* for segment-related operations */ 536 struct f2fs_sm_info *sm_info; /* segment manager */ 537 538 /* for bio operations */ 539 struct f2fs_bio_info read_io; /* for read bios */ 540 struct f2fs_bio_info write_io[NR_PAGE_TYPE]; /* for write bios */ 541 542 /* for checkpoint */ 543 struct f2fs_checkpoint *ckpt; /* raw checkpoint pointer */ 544 struct inode *meta_inode; /* cache meta blocks */ 545 struct mutex cp_mutex; /* checkpoint procedure lock */ 546 struct rw_semaphore cp_rwsem; /* blocking FS operations */ 547 struct rw_semaphore node_write; /* locking node writes */ 548 struct mutex writepages; /* mutex for writepages() */ | 536 537 /* for node-related operations */ 538 struct f2fs_nm_info *nm_info; /* node manager */ 539 struct inode *node_inode; /* cache node blocks */ 540 541 /* for segment-related operations */ 542 struct f2fs_sm_info *sm_info; /* segment manager */ 543 544 /* for bio operations */ 545 struct f2fs_bio_info read_io; /* for read bios */ 546 struct f2fs_bio_info write_io[NR_PAGE_TYPE]; /* for write bios */ 547 548 /* for checkpoint */ 549 struct f2fs_checkpoint *ckpt; /* raw checkpoint pointer */ 550 struct inode *meta_inode; /* cache meta blocks */ 551 struct mutex cp_mutex; /* checkpoint procedure lock */ 552 struct rw_semaphore cp_rwsem; /* blocking FS operations */ 553 struct rw_semaphore node_write; /* locking node writes */ 554 struct mutex writepages; /* mutex for writepages() */ |
549 bool por_doing; /* recovery is doing or not */ | |
550 wait_queue_head_t cp_wait; 551 552 struct inode_management im[MAX_INO_ENTRY]; /* manage inode cache */ 553 554 /* for orphan inode, use 0'th array */ 555 unsigned int max_orphans; /* max orphan inodes */ 556 557 /* for directory inode management */ --- 136 unchanged lines hidden (view full) --- 694 return sbi->meta_inode->i_mapping; 695} 696 697static inline struct address_space *NODE_MAPPING(struct f2fs_sb_info *sbi) 698{ 699 return sbi->node_inode->i_mapping; 700} 701 | 555 wait_queue_head_t cp_wait; 556 557 struct inode_management im[MAX_INO_ENTRY]; /* manage inode cache */ 558 559 /* for orphan inode, use 0'th array */ 560 unsigned int max_orphans; /* max orphan inodes */ 561 562 /* for directory inode management */ --- 136 unchanged lines hidden (view full) --- 699 return sbi->meta_inode->i_mapping; 700} 701 702static inline struct address_space *NODE_MAPPING(struct f2fs_sb_info *sbi) 703{ 704 return sbi->node_inode->i_mapping; 705} 706 |
702static inline void F2FS_SET_SB_DIRT(struct f2fs_sb_info *sbi) | 707static inline bool is_sbi_flag_set(struct f2fs_sb_info *sbi, unsigned int type) |
703{ | 708{ |
704 sbi->s_dirty = 1; | 709 return sbi->s_flag & (0x01 << type); |
705} 706 | 710} 711 |
707static inline void F2FS_RESET_SB_DIRT(struct f2fs_sb_info *sbi) | 712static inline void set_sbi_flag(struct f2fs_sb_info *sbi, unsigned int type) |
708{ | 713{ |
709 sbi->s_dirty = 0; | 714 sbi->s_flag |= (0x01 << type); |
710} 711 | 715} 716 |
717static inline void clear_sbi_flag(struct f2fs_sb_info *sbi, unsigned int type) 718{ 719 sbi->s_flag &= ~(0x01 << type); 720} 721 |
|
712static inline unsigned long long cur_cp_version(struct f2fs_checkpoint *cp) 713{ 714 return le64_to_cpu(cp->checkpoint_ver); 715} 716 717static inline bool is_set_ckpt_flags(struct f2fs_checkpoint *cp, unsigned int f) 718{ 719 unsigned int ckpt_flags = le32_to_cpu(cp->ckpt_flags); --- 93 unchanged lines hidden (view full) --- 813 inode->i_blocks -= count; 814 sbi->total_valid_block_count -= (block_t)count; 815 spin_unlock(&sbi->stat_lock); 816} 817 818static inline void inc_page_count(struct f2fs_sb_info *sbi, int count_type) 819{ 820 atomic_inc(&sbi->nr_pages[count_type]); | 722static inline unsigned long long cur_cp_version(struct f2fs_checkpoint *cp) 723{ 724 return le64_to_cpu(cp->checkpoint_ver); 725} 726 727static inline bool is_set_ckpt_flags(struct f2fs_checkpoint *cp, unsigned int f) 728{ 729 unsigned int ckpt_flags = le32_to_cpu(cp->ckpt_flags); --- 93 unchanged lines hidden (view full) --- 823 inode->i_blocks -= count; 824 sbi->total_valid_block_count -= (block_t)count; 825 spin_unlock(&sbi->stat_lock); 826} 827 828static inline void inc_page_count(struct f2fs_sb_info *sbi, int count_type) 829{ 830 atomic_inc(&sbi->nr_pages[count_type]); |
821 F2FS_SET_SB_DIRT(sbi); | 831 set_sbi_flag(sbi, SBI_IS_DIRTY); |
822} 823 824static inline void inode_inc_dirty_pages(struct inode *inode) 825{ 826 atomic_inc(&F2FS_I(inode)->dirty_pages); 827 if (S_ISDIR(inode->i_mode)) 828 inc_page_count(F2FS_I_SB(inode), F2FS_DIRTY_DENTS); 829} --- 833 unchanged lines hidden --- | 832} 833 834static inline void inode_inc_dirty_pages(struct inode *inode) 835{ 836 atomic_inc(&F2FS_I(inode)->dirty_pages); 837 if (S_ISDIR(inode->i_mode)) 838 inc_page_count(F2FS_I_SB(inode), F2FS_DIRTY_DENTS); 839} --- 833 unchanged lines hidden --- |