diff options
Diffstat (limited to 'fs/nilfs2/direct.c')
-rw-r--r-- | fs/nilfs2/direct.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/fs/nilfs2/direct.c b/fs/nilfs2/direct.c index 8e8095c2e1bb..2a546c8f784e 100644 --- a/fs/nilfs2/direct.c +++ b/fs/nilfs2/direct.c | |||
@@ -92,8 +92,7 @@ static int nilfs_direct_prepare_insert(struct nilfs_direct *direct, | |||
92 | 92 | ||
93 | if (direct->d_ops->dop_find_target != NULL) | 93 | if (direct->d_ops->dop_find_target != NULL) |
94 | req->bpr_ptr = direct->d_ops->dop_find_target(direct, key); | 94 | req->bpr_ptr = direct->d_ops->dop_find_target(direct, key); |
95 | ret = direct->d_bmap.b_pops->bpop_prepare_alloc_ptr(&direct->d_bmap, | 95 | ret = nilfs_bmap_prepare_alloc_ptr(&direct->d_bmap, req); |
96 | req); | ||
97 | if (ret < 0) | 96 | if (ret < 0) |
98 | return ret; | 97 | return ret; |
99 | 98 | ||
@@ -111,7 +110,7 @@ static void nilfs_direct_commit_insert(struct nilfs_direct *direct, | |||
111 | bh = (struct buffer_head *)((unsigned long)ptr); | 110 | bh = (struct buffer_head *)((unsigned long)ptr); |
112 | set_buffer_nilfs_volatile(bh); | 111 | set_buffer_nilfs_volatile(bh); |
113 | 112 | ||
114 | direct->d_bmap.b_pops->bpop_commit_alloc_ptr(&direct->d_bmap, req); | 113 | nilfs_bmap_commit_alloc_ptr(&direct->d_bmap, req); |
115 | nilfs_direct_set_ptr(direct, key, req->bpr_ptr); | 114 | nilfs_direct_set_ptr(direct, key, req->bpr_ptr); |
116 | 115 | ||
117 | if (!nilfs_bmap_dirty(&direct->d_bmap)) | 116 | if (!nilfs_bmap_dirty(&direct->d_bmap)) |
@@ -150,25 +149,18 @@ static int nilfs_direct_prepare_delete(struct nilfs_direct *direct, | |||
150 | { | 149 | { |
151 | int ret; | 150 | int ret; |
152 | 151 | ||
153 | if (direct->d_bmap.b_pops->bpop_prepare_end_ptr != NULL) { | 152 | req->bpr_ptr = nilfs_direct_get_ptr(direct, key); |
154 | req->bpr_ptr = nilfs_direct_get_ptr(direct, key); | 153 | ret = nilfs_bmap_prepare_end_ptr(&direct->d_bmap, req); |
155 | ret = direct->d_bmap.b_pops->bpop_prepare_end_ptr( | 154 | if (!ret) |
156 | &direct->d_bmap, req); | 155 | stats->bs_nblocks = 1; |
157 | if (ret < 0) | 156 | return ret; |
158 | return ret; | ||
159 | } | ||
160 | |||
161 | stats->bs_nblocks = 1; | ||
162 | return 0; | ||
163 | } | 157 | } |
164 | 158 | ||
165 | static void nilfs_direct_commit_delete(struct nilfs_direct *direct, | 159 | static void nilfs_direct_commit_delete(struct nilfs_direct *direct, |
166 | union nilfs_bmap_ptr_req *req, | 160 | union nilfs_bmap_ptr_req *req, |
167 | __u64 key) | 161 | __u64 key) |
168 | { | 162 | { |
169 | if (direct->d_bmap.b_pops->bpop_commit_end_ptr != NULL) | 163 | nilfs_bmap_commit_end_ptr(&direct->d_bmap, req); |
170 | direct->d_bmap.b_pops->bpop_commit_end_ptr( | ||
171 | &direct->d_bmap, req); | ||
172 | nilfs_direct_set_ptr(direct, key, NILFS_BMAP_INVALID_PTR); | 164 | nilfs_direct_set_ptr(direct, key, NILFS_BMAP_INVALID_PTR); |
173 | } | 165 | } |
174 | 166 | ||
@@ -289,11 +281,11 @@ static int nilfs_direct_propagate_v(struct nilfs_direct *direct, | |||
289 | if (!buffer_nilfs_volatile(bh)) { | 281 | if (!buffer_nilfs_volatile(bh)) { |
290 | oldreq.bpr_ptr = ptr; | 282 | oldreq.bpr_ptr = ptr; |
291 | newreq.bpr_ptr = ptr; | 283 | newreq.bpr_ptr = ptr; |
292 | ret = nilfs_bmap_prepare_update(&direct->d_bmap, &oldreq, | 284 | ret = nilfs_bmap_prepare_update_v(&direct->d_bmap, &oldreq, |
293 | &newreq); | 285 | &newreq); |
294 | if (ret < 0) | 286 | if (ret < 0) |
295 | return ret; | 287 | return ret; |
296 | nilfs_bmap_commit_update(&direct->d_bmap, &oldreq, &newreq); | 288 | nilfs_bmap_commit_update_v(&direct->d_bmap, &oldreq, &newreq); |
297 | set_buffer_nilfs_volatile(bh); | 289 | set_buffer_nilfs_volatile(bh); |
298 | nilfs_direct_set_ptr(direct, key, newreq.bpr_ptr); | 290 | nilfs_direct_set_ptr(direct, key, newreq.bpr_ptr); |
299 | } else | 291 | } else |