diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-24 11:04:21 -0500 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-30 07:05:57 -0500 |
commit | 9284ad2a9016ad631460caf8fd01fc21d84f118c (patch) | |
tree | 6ef77d51ca75017a1632bf215703ed9ee12feade /fs/nilfs2/segment.c | |
parent | 5f1586d0dd8f6eeecf6c0d35cbca6291afd6f1cc (diff) |
nilfs2: relocate io status variables to segment buffer
This moves io status variables in nilfs_write_info struct to
nilfs_segment_buffer struct.
This is a preparation to hide nilfs_write_info in segment buffer code.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/segment.c')
-rw-r--r-- | fs/nilfs2/segment.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 79acf4d66e88..cb004ebe7895 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c | |||
@@ -1382,14 +1382,14 @@ static void nilfs_segctor_free_incomplete_segments(struct nilfs_sc_info *sci, | |||
1382 | struct the_nilfs *nilfs) | 1382 | struct the_nilfs *nilfs) |
1383 | { | 1383 | { |
1384 | struct nilfs_segment_buffer *segbuf; | 1384 | struct nilfs_segment_buffer *segbuf; |
1385 | int ret, done = 0; | 1385 | int ret; |
1386 | 1386 | ||
1387 | segbuf = NILFS_FIRST_SEGBUF(&sci->sc_segbufs); | 1387 | segbuf = NILFS_FIRST_SEGBUF(&sci->sc_segbufs); |
1388 | if (nilfs->ns_nextnum != segbuf->sb_nextnum) { | 1388 | if (nilfs->ns_nextnum != segbuf->sb_nextnum) { |
1389 | ret = nilfs_sufile_free(nilfs->ns_sufile, segbuf->sb_nextnum); | 1389 | ret = nilfs_sufile_free(nilfs->ns_sufile, segbuf->sb_nextnum); |
1390 | WARN_ON(ret); /* never fails */ | 1390 | WARN_ON(ret); /* never fails */ |
1391 | } | 1391 | } |
1392 | if (segbuf->sb_io_error) { | 1392 | if (atomic_read(&segbuf->sb_err)) { |
1393 | /* Case 1: The first segment failed */ | 1393 | /* Case 1: The first segment failed */ |
1394 | if (segbuf->sb_pseg_start != segbuf->sb_fseg_start) | 1394 | if (segbuf->sb_pseg_start != segbuf->sb_fseg_start) |
1395 | /* Case 1a: Partial segment appended into an existing | 1395 | /* Case 1a: Partial segment appended into an existing |
@@ -1398,19 +1398,16 @@ static void nilfs_segctor_free_incomplete_segments(struct nilfs_sc_info *sci, | |||
1398 | segbuf->sb_fseg_end); | 1398 | segbuf->sb_fseg_end); |
1399 | else /* Case 1b: New full segment */ | 1399 | else /* Case 1b: New full segment */ |
1400 | set_nilfs_discontinued(nilfs); | 1400 | set_nilfs_discontinued(nilfs); |
1401 | done++; | ||
1402 | } | 1401 | } |
1403 | 1402 | ||
1404 | list_for_each_entry_continue(segbuf, &sci->sc_segbufs, sb_list) { | 1403 | list_for_each_entry_continue(segbuf, &sci->sc_segbufs, sb_list) { |
1405 | ret = nilfs_sufile_free(nilfs->ns_sufile, segbuf->sb_nextnum); | 1404 | ret = nilfs_sufile_free(nilfs->ns_sufile, segbuf->sb_nextnum); |
1406 | WARN_ON(ret); /* never fails */ | 1405 | WARN_ON(ret); /* never fails */ |
1407 | if (!done && segbuf->sb_io_error) { | 1406 | if (atomic_read(&segbuf->sb_err) && |
1408 | if (segbuf->sb_segnum != nilfs->ns_nextnum) | 1407 | segbuf->sb_segnum != nilfs->ns_nextnum) |
1409 | /* Case 2: extended segment (!= next) failed */ | 1408 | /* Case 2: extended segment (!= next) failed */ |
1410 | nilfs_sufile_set_error(nilfs->ns_sufile, | 1409 | nilfs_sufile_set_error(nilfs->ns_sufile, |
1411 | segbuf->sb_segnum); | 1410 | segbuf->sb_segnum); |
1412 | done++; | ||
1413 | } | ||
1414 | } | 1411 | } |
1415 | } | 1412 | } |
1416 | 1413 | ||
@@ -1801,7 +1798,7 @@ static int nilfs_segctor_write(struct nilfs_sc_info *sci, | |||
1801 | nilfs_segbuf_prepare_write(segbuf, &wi); | 1798 | nilfs_segbuf_prepare_write(segbuf, &wi); |
1802 | err = nilfs_segbuf_write(segbuf, &wi); | 1799 | err = nilfs_segbuf_write(segbuf, &wi); |
1803 | 1800 | ||
1804 | res = nilfs_segbuf_wait(segbuf, &wi); | 1801 | res = nilfs_segbuf_wait(segbuf); |
1805 | err = err ? : res; | 1802 | err = err ? : res; |
1806 | if (err) | 1803 | if (err) |
1807 | return err; | 1804 | return err; |