mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-01 20:14:08 +00:00
nilfs2: move iterator to write log into segment buffer
This moves iterator to submit write requests for a series of logs into segbuf.c, and hides nilfs_segbuf_write() and nilfs_segbuf_wait() in the file. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
This commit is contained in:
parent
e605f0a724
commit
d1c6b72a72
3 changed files with 21 additions and 11 deletions
|
@ -40,6 +40,11 @@ struct nilfs_write_info {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static int nilfs_segbuf_write(struct nilfs_segment_buffer *segbuf,
|
||||||
|
struct the_nilfs *nilfs);
|
||||||
|
static int nilfs_segbuf_wait(struct nilfs_segment_buffer *segbuf);
|
||||||
|
|
||||||
|
|
||||||
static struct kmem_cache *nilfs_segbuf_cachep;
|
static struct kmem_cache *nilfs_segbuf_cachep;
|
||||||
|
|
||||||
static void nilfs_segbuf_init_once(void *obj)
|
static void nilfs_segbuf_init_once(void *obj)
|
||||||
|
@ -302,6 +307,19 @@ void nilfs_truncate_logs(struct list_head *logs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nilfs_write_logs(struct list_head *logs, struct the_nilfs *nilfs)
|
||||||
|
{
|
||||||
|
struct nilfs_segment_buffer *segbuf;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
list_for_each_entry(segbuf, logs, sb_list) {
|
||||||
|
ret = nilfs_segbuf_write(segbuf, nilfs);
|
||||||
|
if (ret)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
int nilfs_wait_on_logs(struct list_head *logs)
|
int nilfs_wait_on_logs(struct list_head *logs)
|
||||||
{
|
{
|
||||||
struct nilfs_segment_buffer *segbuf;
|
struct nilfs_segment_buffer *segbuf;
|
||||||
|
|
|
@ -166,13 +166,10 @@ nilfs_segbuf_add_file_buffer(struct nilfs_segment_buffer *segbuf,
|
||||||
segbuf->sb_sum.nfileblk++;
|
segbuf->sb_sum.nfileblk++;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nilfs_segbuf_write(struct nilfs_segment_buffer *segbuf,
|
|
||||||
struct the_nilfs *nilfs);
|
|
||||||
int nilfs_segbuf_wait(struct nilfs_segment_buffer *segbuf);
|
|
||||||
|
|
||||||
void nilfs_clear_logs(struct list_head *logs);
|
void nilfs_clear_logs(struct list_head *logs);
|
||||||
void nilfs_truncate_logs(struct list_head *logs,
|
void nilfs_truncate_logs(struct list_head *logs,
|
||||||
struct nilfs_segment_buffer *last);
|
struct nilfs_segment_buffer *last);
|
||||||
|
int nilfs_write_logs(struct list_head *logs, struct the_nilfs *nilfs);
|
||||||
int nilfs_wait_on_logs(struct list_head *logs);
|
int nilfs_wait_on_logs(struct list_head *logs);
|
||||||
|
|
||||||
static inline void nilfs_destroy_logs(struct list_head *logs)
|
static inline void nilfs_destroy_logs(struct list_head *logs)
|
||||||
|
|
|
@ -1764,14 +1764,9 @@ static int nilfs_segctor_prepare_write(struct nilfs_sc_info *sci,
|
||||||
static int nilfs_segctor_write(struct nilfs_sc_info *sci,
|
static int nilfs_segctor_write(struct nilfs_sc_info *sci,
|
||||||
struct the_nilfs *nilfs)
|
struct the_nilfs *nilfs)
|
||||||
{
|
{
|
||||||
struct nilfs_segment_buffer *segbuf;
|
int ret;
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
list_for_each_entry(segbuf, &sci->sc_segbufs, sb_list) {
|
ret = nilfs_write_logs(&sci->sc_segbufs, nilfs);
|
||||||
ret = nilfs_segbuf_write(segbuf, nilfs);
|
|
||||||
if (ret)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
list_splice_tail_init(&sci->sc_segbufs, &sci->sc_write_logs);
|
list_splice_tail_init(&sci->sc_segbufs, &sci->sc_write_logs);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue