|
@@ -29,6 +29,14 @@
|
|
|
/* return value for read_node_page */
|
|
/* return value for read_node_page */
|
|
|
#define LOCKED_PAGE 1
|
|
#define LOCKED_PAGE 1
|
|
|
|
|
|
|
|
|
|
+/* For flag in struct node_info */
|
|
|
|
|
+enum {
|
|
|
|
|
+ IS_CHECKPOINTED, /* is it checkpointed before? */
|
|
|
|
|
+ HAS_FSYNCED_INODE, /* is the inode fsynced before? */
|
|
|
|
|
+ HAS_LAST_FSYNC, /* has the latest node fsync mark? */
|
|
|
|
|
+ IS_DIRTY, /* this nat entry is dirty? */
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* For node information
|
|
* For node information
|
|
|
*/
|
|
*/
|
|
@@ -37,18 +45,11 @@ struct node_info {
|
|
|
nid_t ino; /* inode number of the node's owner */
|
|
nid_t ino; /* inode number of the node's owner */
|
|
|
block_t blk_addr; /* block address of the node */
|
|
block_t blk_addr; /* block address of the node */
|
|
|
unsigned char version; /* version of the node */
|
|
unsigned char version; /* version of the node */
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
-enum {
|
|
|
|
|
- IS_CHECKPOINTED, /* is it checkpointed before? */
|
|
|
|
|
- HAS_FSYNCED_INODE, /* is the inode fsynced before? */
|
|
|
|
|
- HAS_LAST_FSYNC, /* has the latest node fsync mark? */
|
|
|
|
|
- IS_DIRTY, /* this nat entry is dirty? */
|
|
|
|
|
|
|
+ unsigned char flag; /* for node information bits */
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
struct nat_entry {
|
|
struct nat_entry {
|
|
|
struct list_head list; /* for clean or dirty nat list */
|
|
struct list_head list; /* for clean or dirty nat list */
|
|
|
- unsigned char flag; /* for node information bits */
|
|
|
|
|
struct node_info ni; /* in-memory node information */
|
|
struct node_info ni; /* in-memory node information */
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -63,20 +64,30 @@ struct nat_entry {
|
|
|
|
|
|
|
|
#define inc_node_version(version) (++version)
|
|
#define inc_node_version(version) (++version)
|
|
|
|
|
|
|
|
|
|
+static inline void copy_node_info(struct node_info *dst,
|
|
|
|
|
+ struct node_info *src)
|
|
|
|
|
+{
|
|
|
|
|
+ dst->nid = src->nid;
|
|
|
|
|
+ dst->ino = src->ino;
|
|
|
|
|
+ dst->blk_addr = src->blk_addr;
|
|
|
|
|
+ dst->version = src->version;
|
|
|
|
|
+ /* should not copy flag here */
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
static inline void set_nat_flag(struct nat_entry *ne,
|
|
static inline void set_nat_flag(struct nat_entry *ne,
|
|
|
unsigned int type, bool set)
|
|
unsigned int type, bool set)
|
|
|
{
|
|
{
|
|
|
unsigned char mask = 0x01 << type;
|
|
unsigned char mask = 0x01 << type;
|
|
|
if (set)
|
|
if (set)
|
|
|
- ne->flag |= mask;
|
|
|
|
|
|
|
+ ne->ni.flag |= mask;
|
|
|
else
|
|
else
|
|
|
- ne->flag &= ~mask;
|
|
|
|
|
|
|
+ ne->ni.flag &= ~mask;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static inline bool get_nat_flag(struct nat_entry *ne, unsigned int type)
|
|
static inline bool get_nat_flag(struct nat_entry *ne, unsigned int type)
|
|
|
{
|
|
{
|
|
|
unsigned char mask = 0x01 << type;
|
|
unsigned char mask = 0x01 << type;
|
|
|
- return ne->flag & mask;
|
|
|
|
|
|
|
+ return ne->ni.flag & mask;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static inline void nat_reset_flag(struct nat_entry *ne)
|
|
static inline void nat_reset_flag(struct nat_entry *ne)
|