aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-11-18 03:25:12 -0500
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-11-19 20:05:51 -0500
commit61a189e9c62359cd12b2aa3bd6ab9cffa6cf2745 (patch)
tree03c5cb693a5ea01474055fa26028c42d37011b1d /fs/nilfs2
parent70622a2091647840013c1e982e56a8808768847e (diff)
nilfs2: move routine marking segment usage dirty into sufile
This adds nilfs_sufile_mark_dirty() function in sufile to replace nilfs_touch_segusage() function in log writer code. This is a preparation for the further cleanup which will move out low level sufile operations in the log writer. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2')
-rw-r--r--fs/nilfs2/segment.c19
-rw-r--r--fs/nilfs2/sufile.c19
-rw-r--r--fs/nilfs2/sufile.h1
3 files changed, 22 insertions, 17 deletions
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index d21179bd5a41..3ae4a3849f81 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -1273,21 +1273,6 @@ static int nilfs_segctor_collect_blocks(struct nilfs_sc_info *sci, int mode)
1273 return err; 1273 return err;
1274} 1274}
1275 1275
1276static int nilfs_touch_segusage(struct inode *sufile, __u64 segnum)
1277{
1278 struct buffer_head *bh_su;
1279 struct nilfs_segment_usage *raw_su;
1280 int err;
1281
1282 err = nilfs_sufile_get_segment_usage(sufile, segnum, &raw_su, &bh_su);
1283 if (unlikely(err))
1284 return err;
1285 nilfs_mdt_mark_buffer_dirty(bh_su);
1286 nilfs_mdt_mark_dirty(sufile);
1287 nilfs_sufile_put_segment_usage(sufile, segnum, bh_su);
1288 return 0;
1289}
1290
1291static int nilfs_segctor_begin_construction(struct nilfs_sc_info *sci, 1276static int nilfs_segctor_begin_construction(struct nilfs_sc_info *sci,
1292 struct the_nilfs *nilfs) 1277 struct the_nilfs *nilfs)
1293{ 1278{
@@ -1312,7 +1297,7 @@ static int nilfs_segctor_begin_construction(struct nilfs_sc_info *sci,
1312 } 1297 }
1313 sci->sc_segbuf_nblocks = segbuf->sb_rest_blocks; 1298 sci->sc_segbuf_nblocks = segbuf->sb_rest_blocks;
1314 1299
1315 err = nilfs_touch_segusage(nilfs->ns_sufile, segbuf->sb_segnum); 1300 err = nilfs_sufile_mark_dirty(nilfs->ns_sufile, segbuf->sb_segnum);
1316 if (unlikely(err)) 1301 if (unlikely(err))
1317 return err; 1302 return err;
1318 1303
@@ -1352,7 +1337,7 @@ static int nilfs_segctor_extend_segments(struct nilfs_sc_info *sci,
1352 * not be dirty. The following call ensures that the buffer is dirty 1337 * not be dirty. The following call ensures that the buffer is dirty
1353 * and will pin the buffer on memory until the sufile is written. 1338 * and will pin the buffer on memory until the sufile is written.
1354 */ 1339 */
1355 err = nilfs_touch_segusage(sufile, prev->sb_nextnum); 1340 err = nilfs_sufile_mark_dirty(sufile, prev->sb_nextnum);
1356 if (unlikely(err)) 1341 if (unlikely(err))
1357 return err; 1342 return err;
1358 1343
diff --git a/fs/nilfs2/sufile.c b/fs/nilfs2/sufile.c
index 5f18acab9dd4..d560f882a868 100644
--- a/fs/nilfs2/sufile.c
+++ b/fs/nilfs2/sufile.c
@@ -502,6 +502,25 @@ void nilfs_sufile_put_segment_usage(struct inode *sufile, __u64 segnum,
502} 502}
503 503
504/** 504/**
505 * nilfs_sufile_mark_dirty - mark the buffer having a segment usage dirty
506 * @sufile: inode of segment usage file
507 * @segnum: segment number
508 */
509int nilfs_sufile_mark_dirty(struct inode *sufile, __u64 segnum)
510{
511 struct buffer_head *bh;
512 int ret;
513
514 ret = nilfs_sufile_get_segment_usage_block(sufile, segnum, 0, &bh);
515 if (!ret) {
516 nilfs_mdt_mark_buffer_dirty(bh);
517 nilfs_mdt_mark_dirty(sufile);
518 brelse(bh);
519 }
520 return ret;
521}
522
523/**
505 * nilfs_sufile_get_stat - get segment usage statistics 524 * nilfs_sufile_get_stat - get segment usage statistics
506 * @sufile: inode of segment usage file 525 * @sufile: inode of segment usage file
507 * @stat: pointer to a structure of segment usage statistics 526 * @stat: pointer to a structure of segment usage statistics
diff --git a/fs/nilfs2/sufile.h b/fs/nilfs2/sufile.h
index c339ad5b5326..4146a652aed1 100644
--- a/fs/nilfs2/sufile.h
+++ b/fs/nilfs2/sufile.h
@@ -42,6 +42,7 @@ int nilfs_sufile_get_segment_usage(struct inode *, __u64,
42 struct buffer_head **); 42 struct buffer_head **);
43void nilfs_sufile_put_segment_usage(struct inode *, __u64, 43void nilfs_sufile_put_segment_usage(struct inode *, __u64,
44 struct buffer_head *); 44 struct buffer_head *);
45int nilfs_sufile_mark_dirty(struct inode *sufile, __u64 segnum);
45int nilfs_sufile_get_stat(struct inode *, struct nilfs_sustat *); 46int nilfs_sufile_get_stat(struct inode *, struct nilfs_sustat *);
46ssize_t nilfs_sufile_get_suinfo(struct inode *, __u64, void *, unsigned, 47ssize_t nilfs_sufile_get_suinfo(struct inode *, __u64, void *, unsigned,
47 size_t); 48 size_t);