diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-12 18:45:32 -0500 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-19 20:05:49 -0500 |
commit | ef7d4757a5b7b07a3a0d30d3ba6b587e574b28b9 (patch) | |
tree | 5f1f1cad0c9bb755cd332017f66fe502d1286a94 /fs/nilfs2/the_nilfs.c | |
parent | aa474a220180d997caafcee372770d6ed6bf798a (diff) |
nilfs2: simplify nilfs_sufile_get_ncleansegs function
Previously, this function took an status code to return possible error
codes. The ("nilfs2: add local variable to cache the number of clean
segments") patch removed the possibility to return errors.
So, this simplifies the function definition to make it directly return
the number of clean segments.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
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 | /** |