diff options
Diffstat (limited to 'fs/nilfs2/segbuf.c')
-rw-r--r-- | fs/nilfs2/segbuf.c | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c index 3d3ea8351f6d..1e68821b4a9b 100644 --- a/fs/nilfs2/segbuf.c +++ b/fs/nilfs2/segbuf.c | |||
@@ -64,27 +64,17 @@ struct nilfs_segment_buffer *nilfs_segbuf_new(struct super_block *sb) | |||
64 | INIT_LIST_HEAD(&segbuf->sb_list); | 64 | INIT_LIST_HEAD(&segbuf->sb_list); |
65 | INIT_LIST_HEAD(&segbuf->sb_segsum_buffers); | 65 | INIT_LIST_HEAD(&segbuf->sb_segsum_buffers); |
66 | INIT_LIST_HEAD(&segbuf->sb_payload_buffers); | 66 | INIT_LIST_HEAD(&segbuf->sb_payload_buffers); |
67 | segbuf->sb_segent = NULL; | ||
68 | return segbuf; | 67 | return segbuf; |
69 | } | 68 | } |
70 | 69 | ||
71 | void nilfs_segbuf_free(struct nilfs_segment_buffer *segbuf) | 70 | void nilfs_segbuf_free(struct nilfs_segment_buffer *segbuf) |
72 | { | 71 | { |
73 | struct nilfs_segment_entry *ent = segbuf->sb_segent; | ||
74 | |||
75 | if (ent != NULL && list_empty(&ent->list)) { | ||
76 | /* free isolated segment list head */ | ||
77 | nilfs_free_segment_entry(segbuf->sb_segent); | ||
78 | segbuf->sb_segent = NULL; | ||
79 | } | ||
80 | kmem_cache_free(nilfs_segbuf_cachep, segbuf); | 72 | kmem_cache_free(nilfs_segbuf_cachep, segbuf); |
81 | } | 73 | } |
82 | 74 | ||
83 | int nilfs_segbuf_map(struct nilfs_segment_buffer *segbuf, __u64 segnum, | 75 | void nilfs_segbuf_map(struct nilfs_segment_buffer *segbuf, __u64 segnum, |
84 | unsigned long offset, struct the_nilfs *nilfs) | 76 | unsigned long offset, struct the_nilfs *nilfs) |
85 | { | 77 | { |
86 | struct nilfs_segment_entry *ent; | ||
87 | |||
88 | segbuf->sb_segnum = segnum; | 78 | segbuf->sb_segnum = segnum; |
89 | nilfs_get_segment_range(nilfs, segnum, &segbuf->sb_fseg_start, | 79 | nilfs_get_segment_range(nilfs, segnum, &segbuf->sb_fseg_start, |
90 | &segbuf->sb_fseg_end); | 80 | &segbuf->sb_fseg_end); |
@@ -92,18 +82,6 @@ int nilfs_segbuf_map(struct nilfs_segment_buffer *segbuf, __u64 segnum, | |||
92 | segbuf->sb_pseg_start = segbuf->sb_fseg_start + offset; | 82 | segbuf->sb_pseg_start = segbuf->sb_fseg_start + offset; |
93 | segbuf->sb_rest_blocks = | 83 | segbuf->sb_rest_blocks = |
94 | segbuf->sb_fseg_end - segbuf->sb_pseg_start + 1; | 84 | segbuf->sb_fseg_end - segbuf->sb_pseg_start + 1; |
95 | |||
96 | /* Attach a segment list head */ | ||
97 | ent = segbuf->sb_segent; | ||
98 | if (ent == NULL) { | ||
99 | segbuf->sb_segent = nilfs_alloc_segment_entry(segnum); | ||
100 | if (unlikely(!segbuf->sb_segent)) | ||
101 | return -ENOMEM; | ||
102 | } else { | ||
103 | BUG_ON(ent->bh_su || !list_empty(&ent->list)); | ||
104 | ent->segnum = segnum; | ||
105 | } | ||
106 | return 0; | ||
107 | } | 85 | } |
108 | 86 | ||
109 | void nilfs_segbuf_set_next_segnum(struct nilfs_segment_buffer *segbuf, | 87 | void nilfs_segbuf_set_next_segnum(struct nilfs_segment_buffer *segbuf, |