aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/node.h
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2014-09-15 12:07:13 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2014-09-23 11:10:14 -0700
commit7ef35e3b9e7a99db4930b58b33a94455dbf53276 (patch)
tree9db5d548974fca8bf89129e4ad4f304152b4ebc5 /fs/f2fs/node.h
parentf2fs: use meta_inode cache to improve roll-forward speed (diff)
downloadlinux-dev-7ef35e3b9e7a99db4930b58b33a94455dbf53276.tar.xz
linux-dev-7ef35e3b9e7a99db4930b58b33a94455dbf53276.zip
f2fs: introduce a flag to represent each nat entry information
This patch introduces a flag in the nat entry structure to merge various information such as checkpointed and fsync_done marks. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/node.h')
-rw-r--r--fs/f2fs/node.h28
1 files changed, 24 insertions, 4 deletions
diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h
index 324917d757f7..3043778d805b 100644
--- a/fs/f2fs/node.h
+++ b/fs/f2fs/node.h
@@ -39,10 +39,14 @@ struct node_info {
unsigned char version; /* version of the node */
};
+enum {
+ IS_CHECKPOINTED, /* is it checkpointed before? */
+ HAS_FSYNC_MARK, /* has the latest node fsync mark? */
+};
+
struct nat_entry {
struct list_head list; /* for clean or dirty nat list */
- bool checkpointed; /* whether it is checkpointed or not */
- bool fsync_done; /* whether the latest node has fsync mark */
+ unsigned char flag; /* for node information bits */
struct node_info ni; /* in-memory node information */
};
@@ -57,16 +61,32 @@ struct nat_entry {
#define __set_nat_cache_dirty(nm_i, ne) \
do { \
- ne->checkpointed = false; \
+ set_nat_flag(ne, IS_CHECKPOINTED, false); \
list_move_tail(&ne->list, &nm_i->dirty_nat_entries); \
} while (0)
#define __clear_nat_cache_dirty(nm_i, ne) \
do { \
- ne->checkpointed = true; \
+ set_nat_flag(ne, IS_CHECKPOINTED, true); \
list_move_tail(&ne->list, &nm_i->nat_entries); \
} while (0)
#define inc_node_version(version) (++version)
+static inline void set_nat_flag(struct nat_entry *ne,
+ unsigned int type, bool set)
+{
+ unsigned char mask = 0x01 << type;
+ if (set)
+ ne->flag |= mask;
+ else
+ ne->flag &= ~mask;
+}
+
+static inline bool get_nat_flag(struct nat_entry *ne, unsigned int type)
+{
+ unsigned char mask = 0x01 << type;
+ return ne->flag & mask;
+}
+
static inline void node_info_from_raw_nat(struct node_info *ni,
struct f2fs_nat_entry *raw_ne)
{