diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-04-06 22:01:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-07 11:31:19 -0400 |
commit | 458c5b0822a669d170fdb7bb16c9145f652ebe06 (patch) | |
tree | f2c53998492306a8aaf6d20ded229b69cba17348 /fs/nilfs2 | |
parent | e62687468588f47c32256e3c8c36157c40111b6e (diff) |
nilfs2: clean up sketch file
The sketch file is a file to mark checkpoints with user data. It was
experimentally introduced in the original implementation, and now
obsolete. The file was handled differently with regular files; the file
size got truncated when a checkpoint was created.
This stops the special treatment and will treat it as a regular file.
Most users are not affected because mkfs.nilfs2 no longer makes this file.
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/inode.c | 35 | ||||
-rw-r--r-- | fs/nilfs2/segment.c | 49 | ||||
-rw-r--r-- | fs/nilfs2/segment.h | 8 |
3 files changed, 3 insertions, 89 deletions
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index b6536bb2a324..a1922b17662c 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
@@ -418,30 +418,6 @@ int nilfs_read_inode_common(struct inode *inode, | |||
418 | return 0; | 418 | return 0; |
419 | } | 419 | } |
420 | 420 | ||
421 | static int nilfs_read_sketch_inode(struct inode *inode) | ||
422 | { | ||
423 | struct nilfs_sb_info *sbi = NILFS_SB(inode->i_sb); | ||
424 | int err = 0; | ||
425 | |||
426 | if (sbi->s_snapshot_cno) { | ||
427 | struct the_nilfs *nilfs = sbi->s_nilfs; | ||
428 | struct buffer_head *bh_cp; | ||
429 | struct nilfs_checkpoint *raw_cp; | ||
430 | |||
431 | err = nilfs_cpfile_get_checkpoint( | ||
432 | nilfs->ns_cpfile, sbi->s_snapshot_cno, 0, &raw_cp, | ||
433 | &bh_cp); | ||
434 | if (likely(!err)) { | ||
435 | if (!nilfs_checkpoint_sketch(raw_cp)) | ||
436 | inode->i_size = 0; | ||
437 | nilfs_cpfile_put_checkpoint( | ||
438 | nilfs->ns_cpfile, sbi->s_snapshot_cno, bh_cp); | ||
439 | } | ||
440 | inode->i_flags |= S_NOCMTIME; | ||
441 | } | ||
442 | return err; | ||
443 | } | ||
444 | |||
445 | static int __nilfs_read_inode(struct super_block *sb, unsigned long ino, | 421 | static int __nilfs_read_inode(struct super_block *sb, unsigned long ino, |
446 | struct inode *inode) | 422 | struct inode *inode) |
447 | { | 423 | { |
@@ -469,11 +445,6 @@ static int __nilfs_read_inode(struct super_block *sb, unsigned long ino, | |||
469 | inode->i_op = &nilfs_file_inode_operations; | 445 | inode->i_op = &nilfs_file_inode_operations; |
470 | inode->i_fop = &nilfs_file_operations; | 446 | inode->i_fop = &nilfs_file_operations; |
471 | inode->i_mapping->a_ops = &nilfs_aops; | 447 | inode->i_mapping->a_ops = &nilfs_aops; |
472 | if (unlikely(inode->i_ino == NILFS_SKETCH_INO)) { | ||
473 | err = nilfs_read_sketch_inode(inode); | ||
474 | if (unlikely(err)) | ||
475 | goto failed_unmap; | ||
476 | } | ||
477 | } else if (S_ISDIR(inode->i_mode)) { | 448 | } else if (S_ISDIR(inode->i_mode)) { |
478 | inode->i_op = &nilfs_dir_inode_operations; | 449 | inode->i_op = &nilfs_dir_inode_operations; |
479 | inode->i_fop = &nilfs_dir_operations; | 450 | inode->i_fop = &nilfs_dir_operations; |
@@ -742,8 +713,7 @@ int nilfs_set_file_dirty(struct nilfs_sb_info *sbi, struct inode *inode, | |||
742 | 713 | ||
743 | atomic_add(nr_dirty, &sbi->s_nilfs->ns_ndirtyblks); | 714 | atomic_add(nr_dirty, &sbi->s_nilfs->ns_ndirtyblks); |
744 | 715 | ||
745 | if (test_and_set_bit(NILFS_I_DIRTY, &ii->i_state) || | 716 | if (test_and_set_bit(NILFS_I_DIRTY, &ii->i_state)) |
746 | unlikely(inode->i_ino == NILFS_SKETCH_INO)) | ||
747 | return 0; | 717 | return 0; |
748 | 718 | ||
749 | spin_lock(&sbi->s_inode_lock); | 719 | spin_lock(&sbi->s_inode_lock); |
@@ -811,7 +781,6 @@ void nilfs_dirty_inode(struct inode *inode) | |||
811 | return; | 781 | return; |
812 | } | 782 | } |
813 | nilfs_transaction_begin(inode->i_sb, &ti, 0); | 783 | nilfs_transaction_begin(inode->i_sb, &ti, 0); |
814 | if (likely(inode->i_ino != NILFS_SKETCH_INO)) | 784 | nilfs_mark_inode_dirty(inode); |
815 | nilfs_mark_inode_dirty(inode); | ||
816 | nilfs_transaction_commit(inode->i_sb); /* never fails */ | 785 | nilfs_transaction_commit(inode->i_sb); /* never fails */ |
817 | } | 786 | } |
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 9a87410985b9..981c34a0cd69 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c | |||
@@ -67,7 +67,6 @@ enum { | |||
67 | NILFS_ST_INIT = 0, | 67 | NILFS_ST_INIT = 0, |
68 | NILFS_ST_GC, /* Collecting dirty blocks for GC */ | 68 | NILFS_ST_GC, /* Collecting dirty blocks for GC */ |
69 | NILFS_ST_FILE, | 69 | NILFS_ST_FILE, |
70 | NILFS_ST_SKETCH, | ||
71 | NILFS_ST_IFILE, | 70 | NILFS_ST_IFILE, |
72 | NILFS_ST_CPFILE, | 71 | NILFS_ST_CPFILE, |
73 | NILFS_ST_SUFILE, | 72 | NILFS_ST_SUFILE, |
@@ -887,8 +886,7 @@ static int nilfs_segctor_fill_in_checkpoint(struct nilfs_sc_info *sci) | |||
887 | cpu_to_le64(sci->sc_nblk_inc + sci->sc_nblk_this_inc); | 886 | cpu_to_le64(sci->sc_nblk_inc + sci->sc_nblk_this_inc); |
888 | raw_cp->cp_create = cpu_to_le64(sci->sc_seg_ctime); | 887 | raw_cp->cp_create = cpu_to_le64(sci->sc_seg_ctime); |
889 | raw_cp->cp_cno = cpu_to_le64(nilfs->ns_cno); | 888 | raw_cp->cp_cno = cpu_to_le64(nilfs->ns_cno); |
890 | if (sci->sc_sketch_inode && i_size_read(sci->sc_sketch_inode) > 0) | 889 | |
891 | nilfs_checkpoint_set_sketch(raw_cp); | ||
892 | nilfs_write_inode_common(sbi->s_ifile, &raw_cp->cp_ifile_inode, 1); | 890 | nilfs_write_inode_common(sbi->s_ifile, &raw_cp->cp_ifile_inode, 1); |
893 | nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, nilfs->ns_cno, bh_cp); | 891 | nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, nilfs->ns_cno, bh_cp); |
894 | return 0; | 892 | return 0; |
@@ -923,11 +921,6 @@ static void nilfs_segctor_fill_in_file_bmap(struct nilfs_sc_info *sci, | |||
923 | nilfs_fill_in_file_bmap(ifile, ii); | 921 | nilfs_fill_in_file_bmap(ifile, ii); |
924 | set_bit(NILFS_I_COLLECTED, &ii->i_state); | 922 | set_bit(NILFS_I_COLLECTED, &ii->i_state); |
925 | } | 923 | } |
926 | if (sci->sc_sketch_inode) { | ||
927 | ii = NILFS_I(sci->sc_sketch_inode); | ||
928 | if (test_bit(NILFS_I_DIRTY, &ii->i_state)) | ||
929 | nilfs_fill_in_file_bmap(ifile, ii); | ||
930 | } | ||
931 | } | 924 | } |
932 | 925 | ||
933 | /* | 926 | /* |
@@ -1228,26 +1221,6 @@ static int nilfs_segctor_collect_blocks(struct nilfs_sc_info *sci, int mode) | |||
1228 | sci->sc_stage.scnt = NILFS_ST_DONE; | 1221 | sci->sc_stage.scnt = NILFS_ST_DONE; |
1229 | return 0; | 1222 | return 0; |
1230 | } | 1223 | } |
1231 | sci->sc_stage.scnt++; /* Fall through */ | ||
1232 | case NILFS_ST_SKETCH: | ||
1233 | if (mode == SC_LSEG_SR && sci->sc_sketch_inode) { | ||
1234 | ii = NILFS_I(sci->sc_sketch_inode); | ||
1235 | if (test_bit(NILFS_I_DIRTY, &ii->i_state)) { | ||
1236 | sci->sc_sketch_inode->i_ctime.tv_sec | ||
1237 | = sci->sc_seg_ctime; | ||
1238 | sci->sc_sketch_inode->i_mtime.tv_sec | ||
1239 | = sci->sc_seg_ctime; | ||
1240 | err = nilfs_mark_inode_dirty( | ||
1241 | sci->sc_sketch_inode); | ||
1242 | if (unlikely(err)) | ||
1243 | goto break_or_fail; | ||
1244 | } | ||
1245 | err = nilfs_segctor_scan_file(sci, | ||
1246 | sci->sc_sketch_inode, | ||
1247 | &nilfs_sc_file_ops); | ||
1248 | if (unlikely(err)) | ||
1249 | goto break_or_fail; | ||
1250 | } | ||
1251 | sci->sc_stage.scnt++; | 1224 | sci->sc_stage.scnt++; |
1252 | sci->sc_stage.flags |= NILFS_CF_IFILE_STARTED; | 1225 | sci->sc_stage.flags |= NILFS_CF_IFILE_STARTED; |
1253 | /* Fall through */ | 1226 | /* Fall through */ |
@@ -2385,13 +2358,6 @@ static int nilfs_segctor_do_construct(struct nilfs_sc_info *sci, int mode) | |||
2385 | 2358 | ||
2386 | } while (sci->sc_stage.scnt != NILFS_ST_DONE); | 2359 | } while (sci->sc_stage.scnt != NILFS_ST_DONE); |
2387 | 2360 | ||
2388 | /* Clearing sketch data */ | ||
2389 | if (has_sr && sci->sc_sketch_inode) { | ||
2390 | if (i_size_read(sci->sc_sketch_inode) == 0) | ||
2391 | clear_bit(NILFS_I_DIRTY, | ||
2392 | &NILFS_I(sci->sc_sketch_inode)->i_state); | ||
2393 | i_size_write(sci->sc_sketch_inode, 0); | ||
2394 | } | ||
2395 | out: | 2361 | out: |
2396 | nilfs_segctor_destroy_segment_buffers(sci); | 2362 | nilfs_segctor_destroy_segment_buffers(sci); |
2397 | nilfs_segctor_check_out_files(sci, sbi); | 2363 | nilfs_segctor_check_out_files(sci, sbi); |
@@ -2971,11 +2937,6 @@ static int nilfs_segctor_init(struct nilfs_sc_info *sci, | |||
2971 | struct nilfs_recovery_info *ri) | 2937 | struct nilfs_recovery_info *ri) |
2972 | { | 2938 | { |
2973 | int err; | 2939 | int err; |
2974 | struct inode *inode = nilfs_iget(sci->sc_super, NILFS_SKETCH_INO); | ||
2975 | |||
2976 | sci->sc_sketch_inode = IS_ERR(inode) ? NULL : inode; | ||
2977 | if (sci->sc_sketch_inode) | ||
2978 | i_size_write(sci->sc_sketch_inode, 0); | ||
2979 | 2940 | ||
2980 | sci->sc_seq_done = sci->sc_seq_request; | 2941 | sci->sc_seq_done = sci->sc_seq_request; |
2981 | if (ri) | 2942 | if (ri) |
@@ -2987,10 +2948,6 @@ static int nilfs_segctor_init(struct nilfs_sc_info *sci, | |||
2987 | if (ri) | 2948 | if (ri) |
2988 | list_splice_init(&sci->sc_active_segments, | 2949 | list_splice_init(&sci->sc_active_segments, |
2989 | ri->ri_used_segments.prev); | 2950 | ri->ri_used_segments.prev); |
2990 | if (sci->sc_sketch_inode) { | ||
2991 | iput(sci->sc_sketch_inode); | ||
2992 | sci->sc_sketch_inode = NULL; | ||
2993 | } | ||
2994 | } | 2951 | } |
2995 | return err; | 2952 | return err; |
2996 | } | 2953 | } |
@@ -3090,10 +3047,6 @@ static void nilfs_segctor_destroy(struct nilfs_sc_info *sci) | |||
3090 | 3047 | ||
3091 | WARN_ON(!list_empty(&sci->sc_segbufs)); | 3048 | WARN_ON(!list_empty(&sci->sc_segbufs)); |
3092 | 3049 | ||
3093 | if (sci->sc_sketch_inode) { | ||
3094 | iput(sci->sc_sketch_inode); | ||
3095 | sci->sc_sketch_inode = NULL; | ||
3096 | } | ||
3097 | down_write(&sbi->s_nilfs->ns_segctor_sem); | 3050 | down_write(&sbi->s_nilfs->ns_segctor_sem); |
3098 | 3051 | ||
3099 | kfree(sci); | 3052 | kfree(sci); |
diff --git a/fs/nilfs2/segment.h b/fs/nilfs2/segment.h index 2dd39da9f386..fbd162d71707 100644 --- a/fs/nilfs2/segment.h +++ b/fs/nilfs2/segment.h | |||
@@ -108,7 +108,6 @@ struct nilfs_segsum_pointer { | |||
108 | * @sc_nblk_this_inc: Number of blocks included in the current logical segment | 108 | * @sc_nblk_this_inc: Number of blocks included in the current logical segment |
109 | * @sc_seg_ctime: Creation time | 109 | * @sc_seg_ctime: Creation time |
110 | * @sc_flags: Internal flags | 110 | * @sc_flags: Internal flags |
111 | * @sc_sketch_inode: Inode of the sketch file | ||
112 | * @sc_state_lock: spinlock for sc_state and so on | 111 | * @sc_state_lock: spinlock for sc_state and so on |
113 | * @sc_state: Segctord state flags | 112 | * @sc_state: Segctord state flags |
114 | * @sc_flush_request: inode bitmap of metadata files to be flushed | 113 | * @sc_flush_request: inode bitmap of metadata files to be flushed |
@@ -158,13 +157,6 @@ struct nilfs_sc_info { | |||
158 | 157 | ||
159 | unsigned long sc_flags; | 158 | unsigned long sc_flags; |
160 | 159 | ||
161 | /* | ||
162 | * Pointer to an inode of the sketch. | ||
163 | * This pointer is kept only while it contains data. | ||
164 | * We protect it with a semaphore of the segment constructor. | ||
165 | */ | ||
166 | struct inode *sc_sketch_inode; | ||
167 | |||
168 | spinlock_t sc_state_lock; | 160 | spinlock_t sc_state_lock; |
169 | unsigned long sc_state; | 161 | unsigned long sc_state; |
170 | unsigned long sc_flush_request; | 162 | unsigned long sc_flush_request; |