]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/nilfs2/the_nilfs.h
nilfs2: get rid of nilfs_bmap_union
[karo-tx-linux.git] / fs / nilfs2 / the_nilfs.h
index 1ab974533697ea91609386da13e88c323ee8157e..f785a7b0ab994c55d6940f70259b53b53230325a 100644 (file)
@@ -57,7 +57,8 @@ enum {
  * @ns_current: back pointer to current mount
  * @ns_sbh: buffer heads of on-disk super blocks
  * @ns_sbp: pointers to super block data
- * @ns_sbwtime: previous write time of super blocks
+ * @ns_sbwtime: previous write time of super block
+ * @ns_sbwcount: write count of super block
  * @ns_sbsize: size of valid data in super block
  * @ns_supers: list of nilfs super block structs
  * @ns_seg_seq: segment sequence counter
@@ -73,7 +74,7 @@ enum {
  * @ns_last_seq: sequence value of the latest segment
  * @ns_last_cno: checkpoint number of the latest segment
  * @ns_prot_seq: least sequence number of segments which must not be reclaimed
- * @ns_free_segments_count: counter of free segments
+ * @ns_prev_seq: base sequence number used to decide if advance log cursor
  * @ns_segctor_sem: segment constructor semaphore
  * @ns_dat: DAT file inode
  * @ns_cpfile: checkpoint file inode
@@ -82,6 +83,7 @@ enum {
  * @ns_gc_inodes: dummy inodes to keep live blocks
  * @ns_gc_inodes_h: hash list to keep dummy inode holding live blocks
  * @ns_blocksize_bits: bit length of block size
+ * @ns_blocksize: block size
  * @ns_nsegments: number of segments in filesystem
  * @ns_blocks_per_segment: number of blocks per segment
  * @ns_r_segments_percentage: reserved segments percentage
@@ -119,7 +121,8 @@ struct the_nilfs {
         */
        struct buffer_head     *ns_sbh[2];
        struct nilfs_super_block *ns_sbp[2];
-       time_t                  ns_sbwtime[2];
+       time_t                  ns_sbwtime;
+       unsigned                ns_sbwcount;
        unsigned                ns_sbsize;
        unsigned                ns_mount_state;
 
@@ -149,7 +152,7 @@ struct the_nilfs {
        u64                     ns_last_seq;
        __u64                   ns_last_cno;
        u64                     ns_prot_seq;
-       unsigned long           ns_free_segments_count;
+       u64                     ns_prev_seq;
 
        struct rw_semaphore     ns_segctor_sem;
 
@@ -168,6 +171,7 @@ struct the_nilfs {
 
        /* Disk layout information (static) */
        unsigned int            ns_blocksize_bits;
+       unsigned int            ns_blocksize;
        unsigned long           ns_nsegments;
        unsigned long           ns_blocks_per_segment;
        unsigned long           ns_r_segments_percentage;
@@ -203,20 +207,17 @@ THE_NILFS_FNS(SB_DIRTY, sb_dirty)
 
 /* Minimum interval of periodical update of superblocks (in seconds) */
 #define NILFS_SB_FREQ          10
-#define NILFS_ALTSB_FREQ       60  /* spare superblock */
 
 static inline int nilfs_sb_need_update(struct the_nilfs *nilfs)
 {
        u64 t = get_seconds();
-       return t < nilfs->ns_sbwtime[0] ||
-                t > nilfs->ns_sbwtime[0] + NILFS_SB_FREQ;
+       return t < nilfs->ns_sbwtime || t > nilfs->ns_sbwtime + NILFS_SB_FREQ;
 }
 
-static inline int nilfs_altsb_need_update(struct the_nilfs *nilfs)
+static inline int nilfs_sb_will_flip(struct the_nilfs *nilfs)
 {
-       u64 t = get_seconds();
-       struct nilfs_super_block **sbp = nilfs->ns_sbp;
-       return sbp[1] && t > nilfs->ns_sbwtime[1] + NILFS_ALTSB_FREQ;
+       int flip_bits = nilfs->ns_sbwcount & 0x0FL;
+       return (flip_bits != 0x08 && flip_bits != 0x0F);
 }
 
 void nilfs_set_last_segment(struct the_nilfs *, sector_t, u64, __u64);