diff options
Diffstat (limited to 'fs/nilfs2/the_nilfs.c')
-rw-r--r-- | fs/nilfs2/the_nilfs.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c index 75095edec2fc..4d4d35c6fbef 100644 --- a/fs/nilfs2/the_nilfs.c +++ b/fs/nilfs2/the_nilfs.c | |||
@@ -612,30 +612,23 @@ int nilfs_count_free_blocks(struct the_nilfs *nilfs, sector_t *nblocks) | |||
612 | { | 612 | { |
613 | struct inode *dat = nilfs_dat_inode(nilfs); | 613 | struct inode *dat = nilfs_dat_inode(nilfs); |
614 | unsigned long ncleansegs; | 614 | unsigned long ncleansegs; |
615 | int err; | ||
616 | 615 | ||
617 | down_read(&NILFS_MDT(dat)->mi_sem); /* XXX */ | 616 | down_read(&NILFS_MDT(dat)->mi_sem); /* XXX */ |
618 | err = nilfs_sufile_get_ncleansegs(nilfs->ns_sufile, &ncleansegs); | 617 | ncleansegs = nilfs_sufile_get_ncleansegs(nilfs->ns_sufile); |
619 | up_read(&NILFS_MDT(dat)->mi_sem); /* XXX */ | 618 | up_read(&NILFS_MDT(dat)->mi_sem); /* XXX */ |
620 | if (likely(!err)) | 619 | *nblocks = (sector_t)ncleansegs * nilfs->ns_blocks_per_segment; |
621 | *nblocks = (sector_t)ncleansegs * nilfs->ns_blocks_per_segment; | 620 | return 0; |
622 | return err; | ||
623 | } | 621 | } |
624 | 622 | ||
625 | int nilfs_near_disk_full(struct the_nilfs *nilfs) | 623 | int nilfs_near_disk_full(struct the_nilfs *nilfs) |
626 | { | 624 | { |
627 | struct inode *sufile = nilfs->ns_sufile; | ||
628 | unsigned long ncleansegs, nincsegs; | 625 | unsigned long ncleansegs, nincsegs; |
629 | int ret; | ||
630 | 626 | ||
631 | ret = nilfs_sufile_get_ncleansegs(sufile, &ncleansegs); | 627 | ncleansegs = nilfs_sufile_get_ncleansegs(nilfs->ns_sufile); |
632 | if (likely(!ret)) { | 628 | nincsegs = atomic_read(&nilfs->ns_ndirtyblks) / |
633 | nincsegs = atomic_read(&nilfs->ns_ndirtyblks) / | 629 | nilfs->ns_blocks_per_segment + 1; |
634 | nilfs->ns_blocks_per_segment + 1; | 630 | |
635 | if (ncleansegs <= nilfs->ns_nrsvsegs + nincsegs) | 631 | return ncleansegs <= nilfs->ns_nrsvsegs + nincsegs; |
636 | ret++; | ||
637 | } | ||
638 | return ret; | ||
639 | } | 632 | } |
640 | 633 | ||
641 | /** | 634 | /** |