[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>
This commit is contained in:
parent
2061df0f89
commit
c9a27b5dca
@ -223,18 +223,6 @@ failed:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define NULLIFY_FRAGMENTS \
|
|
||||||
for (i = oldcount; i < newcount; i++) { \
|
|
||||||
bh = sb_getblk(sb, result + i); \
|
|
||||||
memset (bh->b_data, 0, sb->s_blocksize); \
|
|
||||||
set_buffer_uptodate(bh); \
|
|
||||||
mark_buffer_dirty (bh); \
|
|
||||||
if (IS_SYNC(inode)) \
|
|
||||||
sync_dirty_buffer(bh); \
|
|
||||||
brelse (bh); \
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned ufs_new_fragments (struct inode * inode, __fs32 * p, unsigned fragment,
|
unsigned ufs_new_fragments (struct inode * inode, __fs32 * p, unsigned fragment,
|
||||||
unsigned goal, unsigned count, int * err )
|
unsigned goal, unsigned count, int * err )
|
||||||
{
|
{
|
||||||
@ -312,7 +300,6 @@ unsigned ufs_new_fragments (struct inode * inode, __fs32 * p, unsigned fragment,
|
|||||||
*err = 0;
|
*err = 0;
|
||||||
inode->i_blocks += count << uspi->s_nspfshift;
|
inode->i_blocks += count << uspi->s_nspfshift;
|
||||||
UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);
|
UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);
|
||||||
NULLIFY_FRAGMENTS
|
|
||||||
}
|
}
|
||||||
unlock_super(sb);
|
unlock_super(sb);
|
||||||
UFSD(("EXIT, result %u\n", result))
|
UFSD(("EXIT, result %u\n", result))
|
||||||
@ -327,7 +314,6 @@ unsigned ufs_new_fragments (struct inode * inode, __fs32 * p, unsigned fragment,
|
|||||||
*err = 0;
|
*err = 0;
|
||||||
inode->i_blocks += count << uspi->s_nspfshift;
|
inode->i_blocks += count << uspi->s_nspfshift;
|
||||||
UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);
|
UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);
|
||||||
NULLIFY_FRAGMENTS
|
|
||||||
unlock_super(sb);
|
unlock_super(sb);
|
||||||
UFSD(("EXIT, result %u\n", result))
|
UFSD(("EXIT, result %u\n", result))
|
||||||
return result;
|
return result;
|
||||||
@ -379,7 +365,6 @@ unsigned ufs_new_fragments (struct inode * inode, __fs32 * p, unsigned fragment,
|
|||||||
*err = 0;
|
*err = 0;
|
||||||
inode->i_blocks += count << uspi->s_nspfshift;
|
inode->i_blocks += count << uspi->s_nspfshift;
|
||||||
UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);
|
UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);
|
||||||
NULLIFY_FRAGMENTS
|
|
||||||
unlock_super(sb);
|
unlock_super(sb);
|
||||||
if (newcount < request)
|
if (newcount < request)
|
||||||
ufs_free_fragments (inode, result + newcount, request - newcount);
|
ufs_free_fragments (inode, result + newcount, request - newcount);
|
||||||
|
@ -161,6 +161,17 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ufs_clear_block(struct inode *inode, struct buffer_head *bh)
|
||||||
|
{
|
||||||
|
lock_buffer(bh);
|
||||||
|
memset(bh->b_data, 0, inode->i_sb->s_blocksize);
|
||||||
|
set_buffer_uptodate(bh);
|
||||||
|
mark_buffer_dirty(bh);
|
||||||
|
unlock_buffer(bh);
|
||||||
|
if (IS_SYNC(inode))
|
||||||
|
sync_dirty_buffer(bh);
|
||||||
|
}
|
||||||
|
|
||||||
static struct buffer_head * ufs_inode_getfrag (struct inode *inode,
|
static struct buffer_head * ufs_inode_getfrag (struct inode *inode,
|
||||||
unsigned int fragment, unsigned int new_fragment,
|
unsigned int fragment, unsigned int new_fragment,
|
||||||
unsigned int required, int *err, int metadata, long *phys, int *new)
|
unsigned int required, int *err, int metadata, long *phys, int *new)
|
||||||
@ -204,7 +215,7 @@ repeat:
|
|||||||
brelse (result);
|
brelse (result);
|
||||||
goto repeat;
|
goto repeat;
|
||||||
} else {
|
} else {
|
||||||
*phys = tmp;
|
*phys = tmp + blockoff;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -259,14 +270,11 @@ repeat:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The nullification of framgents done in ufs/balloc.c is
|
|
||||||
* something I don't have the stomache to move into here right
|
|
||||||
* now. -DaveM
|
|
||||||
*/
|
|
||||||
if (metadata) {
|
if (metadata) {
|
||||||
result = sb_getblk(inode->i_sb, tmp + blockoff);
|
result = sb_getblk(inode->i_sb, tmp + blockoff);
|
||||||
|
ufs_clear_block(inode, result);
|
||||||
} else {
|
} else {
|
||||||
*phys = tmp;
|
*phys = tmp + blockoff;
|
||||||
result = NULL;
|
result = NULL;
|
||||||
*err = 0;
|
*err = 0;
|
||||||
*new = 1;
|
*new = 1;
|
||||||
@ -333,7 +341,7 @@ repeat:
|
|||||||
brelse (result);
|
brelse (result);
|
||||||
goto repeat;
|
goto repeat;
|
||||||
} else {
|
} else {
|
||||||
*phys = tmp;
|
*phys = tmp + blockoff;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -349,14 +357,12 @@ repeat:
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The nullification of framgents done in ufs/balloc.c is
|
|
||||||
* something I don't have the stomache to move into here right
|
|
||||||
* now. -DaveM
|
|
||||||
*/
|
|
||||||
if (metadata) {
|
if (metadata) {
|
||||||
result = sb_getblk(sb, tmp + blockoff);
|
result = sb_getblk(sb, tmp + blockoff);
|
||||||
|
ufs_clear_block(inode, result);
|
||||||
} else {
|
} else {
|
||||||
*phys = tmp;
|
*phys = tmp + blockoff;
|
||||||
*new = 1;
|
*new = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user