]> 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 191560ec2e7fd81d5d6dcd4fd6841a7d890f5808..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,6 +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_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
@@ -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,6 +152,7 @@ struct the_nilfs {
        u64                     ns_last_seq;
        __u64                   ns_last_cno;
        u64                     ns_prot_seq;
+       u64                     ns_prev_seq;
 
        struct rw_semaphore     ns_segctor_sem;
 
@@ -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);