diff options
Diffstat (limited to 'fs/nilfs2/recovery.c')
-rw-r--r-- | fs/nilfs2/recovery.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c index 6ade0963fc1d..4fc081e47d70 100644 --- a/fs/nilfs2/recovery.c +++ b/fs/nilfs2/recovery.c | |||
@@ -413,7 +413,6 @@ static int nilfs_prepare_segment_for_recovery(struct the_nilfs *nilfs, | |||
413 | struct nilfs_segment_entry *ent, *n; | 413 | struct nilfs_segment_entry *ent, *n; |
414 | struct inode *sufile = nilfs->ns_sufile; | 414 | struct inode *sufile = nilfs->ns_sufile; |
415 | __u64 segnum[4]; | 415 | __u64 segnum[4]; |
416 | time_t mtime; | ||
417 | int err; | 416 | int err; |
418 | int i; | 417 | int i; |
419 | 418 | ||
@@ -442,24 +441,13 @@ static int nilfs_prepare_segment_for_recovery(struct the_nilfs *nilfs, | |||
442 | * Collecting segments written after the latest super root. | 441 | * Collecting segments written after the latest super root. |
443 | * These are marked dirty to avoid being reallocated in the next write. | 442 | * These are marked dirty to avoid being reallocated in the next write. |
444 | */ | 443 | */ |
445 | mtime = get_seconds(); | ||
446 | list_for_each_entry_safe(ent, n, head, list) { | 444 | list_for_each_entry_safe(ent, n, head, list) { |
447 | if (ent->segnum == segnum[0]) { | 445 | if (ent->segnum != segnum[0]) { |
448 | list_del(&ent->list); | 446 | err = nilfs_sufile_scrap(sufile, ent->segnum); |
449 | nilfs_free_segment_entry(ent); | 447 | if (unlikely(err)) |
450 | continue; | 448 | goto failed; |
451 | } | ||
452 | err = nilfs_open_segment_entry(ent, sufile); | ||
453 | if (unlikely(err)) | ||
454 | goto failed; | ||
455 | if (!nilfs_segment_usage_dirty(ent->raw_su)) { | ||
456 | /* make the segment garbage */ | ||
457 | ent->raw_su->su_nblocks = cpu_to_le32(0); | ||
458 | ent->raw_su->su_lastmod = cpu_to_le32(mtime); | ||
459 | nilfs_segment_usage_set_dirty(ent->raw_su); | ||
460 | } | 449 | } |
461 | list_del(&ent->list); | 450 | list_del(&ent->list); |
462 | nilfs_close_segment_entry(ent, sufile); | ||
463 | nilfs_free_segment_entry(ent); | 451 | nilfs_free_segment_entry(ent); |
464 | } | 452 | } |
465 | 453 | ||