diff options
-rw-r--r-- | fs/nilfs2/segbuf.c | 18 | ||||
-rw-r--r-- | fs/nilfs2/segbuf.h | 5 | ||||
-rw-r--r-- | fs/nilfs2/segment.c | 9 |
3 files changed, 21 insertions, 11 deletions
diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c index 645c78656aa0..ab56fe44e377 100644 --- a/fs/nilfs2/segbuf.c +++ b/fs/nilfs2/segbuf.c | |||
@@ -40,6 +40,11 @@ struct nilfs_write_info { | |||
40 | }; | 40 | }; |
41 | 41 | ||
42 | 42 | ||
43 | static int nilfs_segbuf_write(struct nilfs_segment_buffer *segbuf, | ||
44 | struct the_nilfs *nilfs); | ||
45 | static int nilfs_segbuf_wait(struct nilfs_segment_buffer *segbuf); | ||
46 | |||
47 | |||
43 | static struct kmem_cache *nilfs_segbuf_cachep; | 48 | static struct kmem_cache *nilfs_segbuf_cachep; |
44 | 49 | ||
45 | static void nilfs_segbuf_init_once(void *obj) | 50 | static void nilfs_segbuf_init_once(void *obj) |
@@ -302,6 +307,19 @@ void nilfs_truncate_logs(struct list_head *logs, | |||
302 | } | 307 | } |
303 | } | 308 | } |
304 | 309 | ||
310 | int nilfs_write_logs(struct list_head *logs, struct the_nilfs *nilfs) | ||
311 | { | ||
312 | struct nilfs_segment_buffer *segbuf; | ||
313 | int ret = 0; | ||
314 | |||
315 | list_for_each_entry(segbuf, logs, sb_list) { | ||
316 | ret = nilfs_segbuf_write(segbuf, nilfs); | ||
317 | if (ret) | ||
318 | break; | ||
319 | } | ||
320 | return ret; | ||
321 | } | ||
322 | |||
305 | int nilfs_wait_on_logs(struct list_head *logs) | 323 | int nilfs_wait_on_logs(struct list_head *logs) |
306 | { | 324 | { |
307 | struct nilfs_segment_buffer *segbuf; | 325 | struct nilfs_segment_buffer *segbuf; |
diff --git a/fs/nilfs2/segbuf.h b/fs/nilfs2/segbuf.h index 6af1630fb401..94dfd3517bc0 100644 --- a/fs/nilfs2/segbuf.h +++ b/fs/nilfs2/segbuf.h | |||
@@ -166,13 +166,10 @@ nilfs_segbuf_add_file_buffer(struct nilfs_segment_buffer *segbuf, | |||
166 | segbuf->sb_sum.nfileblk++; | 166 | segbuf->sb_sum.nfileblk++; |
167 | } | 167 | } |
168 | 168 | ||
169 | int nilfs_segbuf_write(struct nilfs_segment_buffer *segbuf, | ||
170 | struct the_nilfs *nilfs); | ||
171 | int nilfs_segbuf_wait(struct nilfs_segment_buffer *segbuf); | ||
172 | |||
173 | void nilfs_clear_logs(struct list_head *logs); | 169 | void nilfs_clear_logs(struct list_head *logs); |
174 | void nilfs_truncate_logs(struct list_head *logs, | 170 | void nilfs_truncate_logs(struct list_head *logs, |
175 | struct nilfs_segment_buffer *last); | 171 | struct nilfs_segment_buffer *last); |
172 | int nilfs_write_logs(struct list_head *logs, struct the_nilfs *nilfs); | ||
176 | int nilfs_wait_on_logs(struct list_head *logs); | 173 | int nilfs_wait_on_logs(struct list_head *logs); |
177 | 174 | ||
178 | static inline void nilfs_destroy_logs(struct list_head *logs) | 175 | static inline void nilfs_destroy_logs(struct list_head *logs) |
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index c4fcdd1567a9..ada2f1b947a3 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c | |||
@@ -1764,14 +1764,9 @@ static int nilfs_segctor_prepare_write(struct nilfs_sc_info *sci, | |||
1764 | static int nilfs_segctor_write(struct nilfs_sc_info *sci, | 1764 | static int nilfs_segctor_write(struct nilfs_sc_info *sci, |
1765 | struct the_nilfs *nilfs) | 1765 | struct the_nilfs *nilfs) |
1766 | { | 1766 | { |
1767 | struct nilfs_segment_buffer *segbuf; | 1767 | int ret; |
1768 | int ret = 0; | ||
1769 | 1768 | ||
1770 | list_for_each_entry(segbuf, &sci->sc_segbufs, sb_list) { | 1769 | ret = nilfs_write_logs(&sci->sc_segbufs, nilfs); |
1771 | ret = nilfs_segbuf_write(segbuf, nilfs); | ||
1772 | if (ret) | ||
1773 | break; | ||
1774 | } | ||
1775 | list_splice_tail_init(&sci->sc_segbufs, &sci->sc_write_logs); | 1770 | list_splice_tail_init(&sci->sc_segbufs, &sci->sc_write_logs); |
1776 | return ret; | 1771 | return ret; |
1777 | } | 1772 | } |