Commit b5492af7 authored by Jaegeuk Kim's avatar Jaegeuk Kim

f2fs: move existing definitions into f2fs.h

This patch moves some inode-related definitions from node.h to f2fs.h to
add new features.
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 0040b933
...@@ -320,6 +320,13 @@ struct extent_tree { ...@@ -320,6 +320,13 @@ struct extent_tree {
#define FADVISE_COLD_BIT 0x01 #define FADVISE_COLD_BIT 0x01
#define FADVISE_LOST_PINO_BIT 0x02 #define FADVISE_LOST_PINO_BIT 0x02
#define file_is_cold(inode) is_file(inode, FADVISE_COLD_BIT)
#define file_wrong_pino(inode) is_file(inode, FADVISE_LOST_PINO_BIT)
#define file_set_cold(inode) set_file(inode, FADVISE_COLD_BIT)
#define file_lost_pino(inode) set_file(inode, FADVISE_LOST_PINO_BIT)
#define file_clear_cold(inode) clear_file(inode, FADVISE_COLD_BIT)
#define file_got_pino(inode) clear_file(inode, FADVISE_LOST_PINO_BIT)
#define DEF_DIR_LEVEL 0 #define DEF_DIR_LEVEL 0
struct f2fs_inode_info { struct f2fs_inode_info {
...@@ -1391,6 +1398,21 @@ static inline void f2fs_dentry_kunmap(struct inode *dir, struct page *page) ...@@ -1391,6 +1398,21 @@ static inline void f2fs_dentry_kunmap(struct inode *dir, struct page *page)
kunmap(page); kunmap(page);
} }
static inline int is_file(struct inode *inode, int type)
{
return F2FS_I(inode)->i_advise & type;
}
static inline void set_file(struct inode *inode, int type)
{
F2FS_I(inode)->i_advise |= type;
}
static inline void clear_file(struct inode *inode, int type)
{
F2FS_I(inode)->i_advise &= ~type;
}
static inline int f2fs_readonly(struct super_block *sb) static inline int f2fs_readonly(struct super_block *sb)
{ {
return sb->s_flags & MS_RDONLY; return sb->s_flags & MS_RDONLY;
......
...@@ -343,28 +343,6 @@ static inline nid_t get_nid(struct page *p, int off, bool i) ...@@ -343,28 +343,6 @@ static inline nid_t get_nid(struct page *p, int off, bool i)
* - Mark cold node blocks in their node footer * - Mark cold node blocks in their node footer
* - Mark cold data pages in page cache * - Mark cold data pages in page cache
*/ */
static inline int is_file(struct inode *inode, int type)
{
return F2FS_I(inode)->i_advise & type;
}
static inline void set_file(struct inode *inode, int type)
{
F2FS_I(inode)->i_advise |= type;
}
static inline void clear_file(struct inode *inode, int type)
{
F2FS_I(inode)->i_advise &= ~type;
}
#define file_is_cold(inode) is_file(inode, FADVISE_COLD_BIT)
#define file_wrong_pino(inode) is_file(inode, FADVISE_LOST_PINO_BIT)
#define file_set_cold(inode) set_file(inode, FADVISE_COLD_BIT)
#define file_lost_pino(inode) set_file(inode, FADVISE_LOST_PINO_BIT)
#define file_clear_cold(inode) clear_file(inode, FADVISE_COLD_BIT)
#define file_got_pino(inode) clear_file(inode, FADVISE_LOST_PINO_BIT)
static inline int is_cold_data(struct page *page) static inline int is_cold_data(struct page *page)
{ {
return PageChecked(page); return PageChecked(page);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment