diff options
author | Bob Peterson <rpeterso@redhat.com> | 2011-11-18 10:58:32 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2011-11-21 05:04:09 -0500 |
commit | 6e87ed0fc93ffbe2aec296e6912b1dcb19034d6c (patch) | |
tree | 4f4ac522d34f35de3e3671996ddc35977aaa49ad /fs/gfs2/inode.c | |
parent | 4442f2e03ed9646664c94e197e637b03324a6664 (diff) |
GFS2: move toward a generic multi-block allocator
This patch is a revision of the one I previously posted.
I tried to integrate all the suggestions Steve gave.
The purpose of the patch is to change function gfs2_alloc_block
(allocate either a dinode block or an extent of data blocks)
to a more generic gfs2_alloc_blocks function that can
allocate both a dinode _and_ an extent of data blocks in the
same call. This will ultimately help us create a multi-block
reservation scheme to reduce file fragmentation.
This patch moves more toward a generic multi-block allocator that
takes a pointer to the number of data blocks to allocate, plus whether
or not to allocate a dinode. In theory, it could be called to allocate
(1) a single dinode block, (2) a group of one or more data blocks, or
(3) a dinode plus several data blocks.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r-- | fs/gfs2/inode.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index de2668f5c974..3ab192bac7d3 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -389,6 +389,7 @@ static int alloc_dinode(struct gfs2_inode *dip, u64 *no_addr, u64 *generation) | |||
389 | { | 389 | { |
390 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); | 390 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); |
391 | int error; | 391 | int error; |
392 | int dblocks = 0; | ||
392 | 393 | ||
393 | if (gfs2_alloc_get(dip) == NULL) | 394 | if (gfs2_alloc_get(dip) == NULL) |
394 | return -ENOMEM; | 395 | return -ENOMEM; |
@@ -402,7 +403,7 @@ static int alloc_dinode(struct gfs2_inode *dip, u64 *no_addr, u64 *generation) | |||
402 | if (error) | 403 | if (error) |
403 | goto out_ipreserv; | 404 | goto out_ipreserv; |
404 | 405 | ||
405 | error = gfs2_alloc_block(dip, no_addr, NULL, 1, generation); | 406 | error = gfs2_alloc_blocks(dip, no_addr, &dblocks, 1, generation); |
406 | 407 | ||
407 | gfs2_trans_end(sdp); | 408 | gfs2_trans_end(sdp); |
408 | 409 | ||