aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nilfs2')
-rw-r--r--fs/nilfs2/sufile.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/nilfs2/sufile.c b/fs/nilfs2/sufile.c
index 1ef2b4d9d794..8b2f93ca1e16 100644
--- a/fs/nilfs2/sufile.c
+++ b/fs/nilfs2/sufile.c
@@ -523,7 +523,7 @@ int nilfs_sufile_set_error(struct inode *sufile, __u64 segnum)
523 struct nilfs_segment_usage *su; 523 struct nilfs_segment_usage *su;
524 struct nilfs_sufile_header *header; 524 struct nilfs_sufile_header *header;
525 void *kaddr; 525 void *kaddr;
526 int ret; 526 int suclean, ret;
527 527
528 if (unlikely(segnum >= nilfs_sufile_get_nsegments(sufile))) { 528 if (unlikely(segnum >= nilfs_sufile_get_nsegments(sufile))) {
529 printk(KERN_WARNING "%s: invalid segment number: %llu\n", 529 printk(KERN_WARNING "%s: invalid segment number: %llu\n",
@@ -546,16 +546,19 @@ int nilfs_sufile_set_error(struct inode *sufile, __u64 segnum)
546 brelse(su_bh); 546 brelse(su_bh);
547 goto out_header; 547 goto out_header;
548 } 548 }
549 suclean = nilfs_segment_usage_clean(su);
549 550
550 nilfs_segment_usage_set_error(su); 551 nilfs_segment_usage_set_error(su);
551 kunmap_atomic(kaddr, KM_USER0); 552 kunmap_atomic(kaddr, KM_USER0);
552 brelse(su_bh);
553 553
554 kaddr = kmap_atomic(header_bh->b_page, KM_USER0); 554 if (suclean) {
555 header = nilfs_sufile_block_get_header(sufile, header_bh, kaddr); 555 kaddr = kmap_atomic(header_bh->b_page, KM_USER0);
556 le64_add_cpu(&header->sh_ndirtysegs, -1); 556 header = nilfs_sufile_block_get_header(sufile, header_bh,
557 kunmap_atomic(kaddr, KM_USER0); 557 kaddr);
558 nilfs_mdt_mark_buffer_dirty(header_bh); 558 le64_add_cpu(&header->sh_ncleansegs, -1);
559 kunmap_atomic(kaddr, KM_USER0);
560 nilfs_mdt_mark_buffer_dirty(header_bh);
561 }
559 nilfs_mdt_mark_buffer_dirty(su_bh); 562 nilfs_mdt_mark_buffer_dirty(su_bh);
560 nilfs_mdt_mark_dirty(sufile); 563 nilfs_mdt_mark_dirty(sufile);
561 brelse(su_bh); 564 brelse(su_bh);