summaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/the_nilfs.h
diff options
context:
space:
mode:
authorJiro SEKIBA <jir@unicus.jp>2009-07-22 18:26:34 +0200
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-09-14 11:27:14 +0200
commit79efdd94111f30c373fce05e4e5822d8ff671c2a (patch)
tree9d12c0e87146fb4fb63362f567e574d629a222a1 /fs/nilfs2/the_nilfs.h
parentnilfs2: fix disorder of nilfs_write_super in nilfs_sync_fs (diff)
downloadlinux-79efdd94111f30c373fce05e4e5822d8ff671c2a.tar.xz
linux-79efdd94111f30c373fce05e4e5822d8ff671c2a.zip
nilfs2: clean up nilfs_write_super
Separate conditions that check if syncing super block and alternative super block are required as inline functions to reuse the conditions. Signed-off-by: Jiro SEKIBA <jir@unicus.jp> Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/the_nilfs.h')
-rw-r--r--fs/nilfs2/the_nilfs.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/nilfs2/the_nilfs.h b/fs/nilfs2/the_nilfs.h
index fa3a1dfe4053..68e9626e3d44 100644
--- a/fs/nilfs2/the_nilfs.h
+++ b/fs/nilfs2/the_nilfs.h
@@ -200,6 +200,20 @@ THE_NILFS_FNS(DISCONTINUED, discontinued)
#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;
+}
+
+static inline int nilfs_altsb_need_update(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;
+}
+
void nilfs_set_last_segment(struct the_nilfs *, sector_t, u64, __u64);
struct the_nilfs *find_or_create_nilfs(struct block_device *);
void put_nilfs(struct the_nilfs *);