f2fs: introduce cur_cp_version function to reduce code size
[deliverable/linux.git] / fs / f2fs / f2fs.h
index 78777cdb89de3581e98839cc250acc095ce6752b..5348b63adbe9b17a681352a6c582572bd76e7a44 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/slab.h>
 #include <linux/crc32.h>
 #include <linux/magic.h>
+#include <linux/kobject.h>
 
 /*
  * For mount options
@@ -134,11 +135,13 @@ static inline int update_sits_in_cursum(struct f2fs_summary_block *rs, int i)
 /*
  * For INODE and NODE manager
  */
-#define XATTR_NODE_OFFSET      (-1)    /*
-                                        * store xattrs to one node block per
-                                        * file keeping -1 as its node offset to
-                                        * distinguish from index node blocks.
-                                        */
+/*
+ * XATTR_NODE_OFFSET stores xattrs to one node block per file keeping -1
+ * as its node offset to distinguish from index node blocks.
+ * But some bits are used to mark the node block.
+ */
+#define XATTR_NODE_OFFSET      ((((unsigned int)-1) << OFFSET_BIT_SHIFT) \
+                               >> OFFSET_BIT_SHIFT)
 enum {
        ALLOC_NODE,                     /* allocate a new node page if needed */
        LOOKUP_NODE,                    /* look up a node without readahead */
@@ -178,6 +181,7 @@ struct f2fs_inode_info {
        f2fs_hash_t chash;              /* hash value of given file name */
        unsigned int clevel;            /* maximum level of given file name */
        nid_t i_xattr_nid;              /* node id that contains xattrs */
+       unsigned long long xattr_ver;   /* cp version of xattr modification */
        struct extent_info ext;         /* in-memory extent cache entry */
 };
 
@@ -430,6 +434,10 @@ struct f2fs_sb_info {
 #endif
        unsigned int last_victim[2];            /* last victim segment # */
        spinlock_t stat_lock;                   /* lock for stat operations */
+
+       /* For sysfs suppport */
+       struct kobject s_kobj;
+       struct completion s_kobj_unregister;
 };
 
 /*
@@ -495,6 +503,11 @@ static inline void F2FS_RESET_SB_DIRT(struct f2fs_sb_info *sbi)
        sbi->s_dirty = 0;
 }
 
+static inline unsigned long long cur_cp_version(struct f2fs_checkpoint *cp)
+{
+       return le64_to_cpu(cp->checkpoint_ver);
+}
+
 static inline bool is_set_ckpt_flags(struct f2fs_checkpoint *cp, unsigned int f)
 {
        unsigned int ckpt_flags = le32_to_cpu(cp->ckpt_flags);
@@ -683,7 +696,7 @@ static inline block_t __start_cp_addr(struct f2fs_sb_info *sbi)
 {
        block_t start_addr;
        struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);
-       unsigned long long ckpt_version = le64_to_cpu(ckpt->checkpoint_ver);
+       unsigned long long ckpt_version = cur_cp_version(ckpt);
 
        start_addr = le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_blkaddr);
 
@@ -1019,7 +1032,8 @@ int npages_for_summary_flush(struct f2fs_sb_info *);
 void allocate_new_segments(struct f2fs_sb_info *);
 struct page *get_sum_page(struct f2fs_sb_info *, unsigned int);
 struct bio *f2fs_bio_alloc(struct block_device *, int);
-void f2fs_submit_bio(struct f2fs_sb_info *, enum page_type, bool sync);
+void f2fs_submit_bio(struct f2fs_sb_info *, enum page_type, bool);
+void f2fs_wait_on_page_writeback(struct page *, enum page_type, bool);
 void write_meta_page(struct f2fs_sb_info *, struct page *);
 void write_node_page(struct f2fs_sb_info *, struct page *, unsigned int,
                                        block_t, block_t *);
This page took 0.030101 seconds and 5 git commands to generate.