aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-04-06 22:01:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-07 11:31:19 -0400
commitc96fa464a567a2a8796009af0e79bc68af73f485 (patch)
tree5467fcdc2a4a64dfad3c5cb627451b6f7e76809b /fs/nilfs2
parent458c5b0822a669d170fdb7bb16c9145f652ebe06 (diff)
nilfs2: mark minor flag for checkpoint created by internal operation
Nilfs creates checkpoints even for garbage collection or metadata updates such as checkpoint mode change. So, user often sees checkpoints created only by such internal operations. This is inconvenient in some situations. For example, application that monitors checkpoints and changes them to snapshots, will fall into an infinite loop because it cannot distinguish internally created checkpoints. This patch solves this sort of problem by adding a flag to checkpoint for identification. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/nilfs2')
-rw-r--r--fs/nilfs2/segment.c9
-rw-r--r--fs/nilfs2/segment.h3
2 files changed, 12 insertions, 0 deletions
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 981c34a0cd69..2879704509fd 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -462,6 +462,9 @@ static void nilfs_segctor_begin_finfo(struct nilfs_sc_info *sci,
462 sci->sc_binfo_ptr = sci->sc_finfo_ptr; 462 sci->sc_binfo_ptr = sci->sc_finfo_ptr;
463 nilfs_segctor_map_segsum_entry( 463 nilfs_segctor_map_segsum_entry(
464 sci, &sci->sc_binfo_ptr, sizeof(struct nilfs_finfo)); 464 sci, &sci->sc_binfo_ptr, sizeof(struct nilfs_finfo));
465
466 if (inode->i_sb && !test_bit(NILFS_SC_HAVE_DELTA, &sci->sc_flags))
467 set_bit(NILFS_SC_HAVE_DELTA, &sci->sc_flags);
465 /* skip finfo */ 468 /* skip finfo */
466} 469}
467 470
@@ -887,6 +890,11 @@ static int nilfs_segctor_fill_in_checkpoint(struct nilfs_sc_info *sci)
887 raw_cp->cp_create = cpu_to_le64(sci->sc_seg_ctime); 890 raw_cp->cp_create = cpu_to_le64(sci->sc_seg_ctime);
888 raw_cp->cp_cno = cpu_to_le64(nilfs->ns_cno); 891 raw_cp->cp_cno = cpu_to_le64(nilfs->ns_cno);
889 892
893 if (test_bit(NILFS_SC_HAVE_DELTA, &sci->sc_flags))
894 nilfs_checkpoint_clear_minor(raw_cp);
895 else
896 nilfs_checkpoint_set_minor(raw_cp);
897
890 nilfs_write_inode_common(sbi->s_ifile, &raw_cp->cp_ifile_inode, 1); 898 nilfs_write_inode_common(sbi->s_ifile, &raw_cp->cp_ifile_inode, 1);
891 nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, nilfs->ns_cno, bh_cp); 899 nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, nilfs->ns_cno, bh_cp);
892 return 0; 900 return 0;
@@ -2091,6 +2099,7 @@ static void nilfs_segctor_complete_write(struct nilfs_sc_info *sci)
2091 nilfs_set_last_segment(nilfs, segbuf->sb_pseg_start, 2099 nilfs_set_last_segment(nilfs, segbuf->sb_pseg_start,
2092 segbuf->sb_sum.seg_seq, nilfs->ns_cno); 2100 segbuf->sb_sum.seg_seq, nilfs->ns_cno);
2093 2101
2102 clear_bit(NILFS_SC_HAVE_DELTA, &sci->sc_flags);
2094 clear_bit(NILFS_SC_DIRTY, &sci->sc_flags); 2103 clear_bit(NILFS_SC_DIRTY, &sci->sc_flags);
2095 set_bit(NILFS_SC_SUPER_ROOT, &sci->sc_flags); 2104 set_bit(NILFS_SC_SUPER_ROOT, &sci->sc_flags);
2096 } else 2105 } else
diff --git a/fs/nilfs2/segment.h b/fs/nilfs2/segment.h
index fbd162d71707..bb7d417fec62 100644
--- a/fs/nilfs2/segment.h
+++ b/fs/nilfs2/segment.h
@@ -185,6 +185,9 @@ enum {
185 NILFS_SC_SUPER_ROOT, /* The latest segment has a super root */ 185 NILFS_SC_SUPER_ROOT, /* The latest segment has a super root */
186 NILFS_SC_PRIOR_FLUSH, /* Requesting immediate flush without making a 186 NILFS_SC_PRIOR_FLUSH, /* Requesting immediate flush without making a
187 checkpoint */ 187 checkpoint */
188 NILFS_SC_HAVE_DELTA, /* Next checkpoint will have update of files
189 other than DAT, cpfile, sufile, or files
190 moved by GC */
188}; 191};
189 192
190/* sc_state */ 193/* sc_state */