diff options
author | Evgeniy Dushistov <dushistov@mail.ru> | 2006-06-25 08:47:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-25 13:01:01 -0400 |
commit | c9a27b5dca52bbd0955e065e49e56eb313d02c34 (patch) | |
tree | 6e5223f9ee942e8a55552138aa67ef2a37e01738 | |
parent | 2061df0f89201c0abeb4c17d343309c9fae5b861 (diff) |
[PATCH] ufs: right block allocation
* After block allocation, we map it on the same "address" as 8 others
blocks
* We nullify block several times: once in ufs/block.c and once in
block_*write_full_page, and use different "caches" for this.
Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/ufs/balloc.c | 15 | ||||
-rw-r--r-- | fs/ufs/inode.c | 30 |
2 files changed, 18 insertions, 27 deletions
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c index 3ada9dcf55b8..cc0c8f15d8fd 100644 --- a/fs/ufs/balloc.c +++ b/fs/ufs/balloc.c | |||
@@ -223,18 +223,6 @@ failed: | |||
223 | } | 223 | } |
224 | 224 | ||
225 | 225 | ||
226 | |||
227 | #define NULLIFY_FRAGMENTS \ | ||
228 | for (i = oldcount; i < newcount; i++) { \ | ||
229 | bh = sb_getblk(sb, result + i); \ | ||
230 | memset (bh->b_data, 0, sb->s_blocksize); \ | ||
231 | set_buffer_uptodate(bh); \ | ||
232 | mark_buffer_dirty (bh); \ | ||
233 | if (IS_SYNC(inode)) \ | ||
234 | sync_dirty_buffer(bh); \ | ||
235 | brelse (bh); \ | ||
236 | } | ||
237 | |||
238 | unsigned ufs_new_fragments (struct inode * inode, __fs32 * p, unsigned fragment, | 226 | unsigned ufs_new_fragments (struct inode * inode, __fs32 * p, unsigned fragment, |
239 | unsigned goal, unsigned count, int * err ) | 227 | unsigned goal, unsigned count, int * err ) |
240 | { | 228 | { |
@@ -312,7 +300,6 @@ unsigned ufs_new_fragments (struct inode * inode, __fs32 * p, unsigned fragment, | |||
312 | *err = 0; | 300 | *err = 0; |
313 | inode->i_blocks += count << uspi->s_nspfshift; | 301 | inode->i_blocks += count << uspi->s_nspfshift; |
314 | UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count); | 302 | UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count); |
315 | NULLIFY_FRAGMENTS | ||
316 | } | 303 | } |
317 | unlock_super(sb); | 304 | unlock_super(sb); |
318 | UFSD(("EXIT, result %u\n", result)) | 305 | UFSD(("EXIT, result %u\n", result)) |
@@ -327,7 +314,6 @@ unsigned ufs_new_fragments (struct inode * inode, __fs32 * p, unsigned fragment, | |||
327 | *err = 0; | 314 | *err = 0; |
328 | inode->i_blocks += count << uspi->s_nspfshift; | 315 | inode->i_blocks += count << uspi->s_nspfshift; |
329 | UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count); | 316 | UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count); |
330 | NULLIFY_FRAGMENTS | ||
331 | unlock_super(sb); | 317 | unlock_super(sb); |
332 | UFSD(("EXIT, result %u\n", result)) | 318 | UFSD(("EXIT, result %u\n", result)) |
333 | return result; | 319 | return result; |
@@ -379,7 +365,6 @@ unsigned ufs_new_fragments (struct inode * inode, __fs32 * p, unsigned fragment, | |||
379 | *err = 0; | 365 | *err = 0; |
380 | inode->i_blocks += count << uspi->s_nspfshift; | 366 | inode->i_blocks += count << uspi->s_nspfshift; |
381 | UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count); | 367 | UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count); |
382 | NULLIFY_FRAGMENTS | ||
383 | unlock_super(sb); | 368 | unlock_super(sb); |
384 | if (newcount < request) | 369 | if (newcount < request) |
385 | ufs_free_fragments (inode, result + newcount, request - newcount); | 370 | ufs_free_fragments (inode, result + newcount, request - newcount); |
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index 3c3f62ce2ad9..2b2366360e5a 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c | |||
@@ -161,6 +161,17 @@ out: | |||
161 | return ret; | 161 | return ret; |
162 | } | 162 | } |
163 | 163 | ||
164 | static void ufs_clear_block(struct inode *inode, struct buffer_head *bh) | ||
165 | { | ||
166 | lock_buffer(bh); | ||
167 | memset(bh->b_data, 0, inode->i_sb->s_blocksize); | ||
168 | set_buffer_uptodate(bh); | ||
169 | mark_buffer_dirty(bh); | ||
170 | unlock_buffer(bh); | ||
171 | if (IS_SYNC(inode)) | ||
172 | sync_dirty_buffer(bh); | ||
173 | } | ||
174 | |||
164 | static struct buffer_head * ufs_inode_getfrag (struct inode *inode, | 175 | static struct buffer_head * ufs_inode_getfrag (struct inode *inode, |
165 | unsigned int fragment, unsigned int new_fragment, | 176 | unsigned int fragment, unsigned int new_fragment, |
166 | unsigned int required, int *err, int metadata, long *phys, int *new) | 177 | unsigned int required, int *err, int metadata, long *phys, int *new) |
@@ -204,7 +215,7 @@ repeat: | |||
204 | brelse (result); | 215 | brelse (result); |
205 | goto repeat; | 216 | goto repeat; |
206 | } else { | 217 | } else { |
207 | *phys = tmp; | 218 | *phys = tmp + blockoff; |
208 | return NULL; | 219 | return NULL; |
209 | } | 220 | } |
210 | } | 221 | } |
@@ -259,14 +270,11 @@ repeat: | |||
259 | return NULL; | 270 | return NULL; |
260 | } | 271 | } |
261 | 272 | ||
262 | /* The nullification of framgents done in ufs/balloc.c is | ||
263 | * something I don't have the stomache to move into here right | ||
264 | * now. -DaveM | ||
265 | */ | ||
266 | if (metadata) { | 273 | if (metadata) { |
267 | result = sb_getblk(inode->i_sb, tmp + blockoff); | 274 | result = sb_getblk(inode->i_sb, tmp + blockoff); |
275 | ufs_clear_block(inode, result); | ||
268 | } else { | 276 | } else { |
269 | *phys = tmp; | 277 | *phys = tmp + blockoff; |
270 | result = NULL; | 278 | result = NULL; |
271 | *err = 0; | 279 | *err = 0; |
272 | *new = 1; | 280 | *new = 1; |
@@ -333,7 +341,7 @@ repeat: | |||
333 | brelse (result); | 341 | brelse (result); |
334 | goto repeat; | 342 | goto repeat; |
335 | } else { | 343 | } else { |
336 | *phys = tmp; | 344 | *phys = tmp + blockoff; |
337 | goto out; | 345 | goto out; |
338 | } | 346 | } |
339 | } | 347 | } |
@@ -349,14 +357,12 @@ repeat: | |||
349 | goto out; | 357 | goto out; |
350 | } | 358 | } |
351 | 359 | ||
352 | /* The nullification of framgents done in ufs/balloc.c is | 360 | |
353 | * something I don't have the stomache to move into here right | ||
354 | * now. -DaveM | ||
355 | */ | ||
356 | if (metadata) { | 361 | if (metadata) { |
357 | result = sb_getblk(sb, tmp + blockoff); | 362 | result = sb_getblk(sb, tmp + blockoff); |
363 | ufs_clear_block(inode, result); | ||
358 | } else { | 364 | } else { |
359 | *phys = tmp; | 365 | *phys = tmp + blockoff; |
360 | *new = 1; | 366 | *new = 1; |
361 | } | 367 | } |
362 | 368 | ||