diff options
Diffstat (limited to 'ext2fs/getblk.c')
-rw-r--r-- | ext2fs/getblk.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/ext2fs/getblk.c b/ext2fs/getblk.c index 86e94aa9..8dac694c 100644 --- a/ext2fs/getblk.c +++ b/ext2fs/getblk.c @@ -104,7 +104,7 @@ ext2_alloc_block (struct node *node, block_t goal, int zero) if (result && zero) { - char *bh = bptr (result); + char *bh = disk_cache_block_ref (result); memset (bh, 0, block_size); record_indir_poke (node, bh); } @@ -180,14 +180,20 @@ block_getblk (struct node *node, block_t block, int nr, int create, int zero, { int i; block_t goal = 0; - block_t *bh = (block_t *)bptr (block); + block_t *bh = (block_t *)disk_cache_block_ref (block); *result = bh[nr]; if (*result) - return 0; + { + disk_cache_block_deref (bh); + return 0; + } if (!create) - return EINVAL; + { + disk_cache_block_deref (bh); + return EINVAL; + } if (node->dn->info.i_next_alloc_block == new_block) goal = node->dn->info.i_next_alloc_goal; @@ -207,7 +213,10 @@ block_getblk (struct node *node, block_t block, int nr, int create, int zero, *result = ext2_alloc_block (node, goal, zero); if (!*result) - return ENOSPC; + { + disk_cache_block_deref (bh); + return ENOSPC; + } bh[nr] = *result; |