summaryrefslogtreecommitdiffstats
path: root/fs/hfs/extent.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-02-16 01:07:24 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-02-16 01:07:24 +0000
commit95db6b748fc86297827fbd9c9ef174d491c9ad89 (patch)
tree27a92a942821cde1edda9a1b088718d436b3efe4 /fs/hfs/extent.c
parent45b27b0a0652331d104c953a5b192d843fff88f8 (diff)
Merge with Linux 2.3.40.
Diffstat (limited to 'fs/hfs/extent.c')
-rw-r--r--fs/hfs/extent.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/fs/hfs/extent.c b/fs/hfs/extent.c
index 3c92e7def..eca17bc63 100644
--- a/fs/hfs/extent.c
+++ b/fs/hfs/extent.c
@@ -523,7 +523,7 @@ static void shrink_fork(struct hfs_fork *fork, int ablocks)
* Try to add enough allocation blocks to 'fork'
* so that it is 'ablock' allocation blocks long.
*/
-static void grow_fork(struct hfs_fork *fork, int ablocks)
+static int grow_fork(struct hfs_fork *fork, int ablocks)
{
struct hfs_cat_entry *entry = fork->entry;
struct hfs_mdb *mdb = entry->mdb;
@@ -535,8 +535,8 @@ static void grow_fork(struct hfs_fork *fork, int ablocks)
blocks = fork->psize;
need = ablocks - blocks/ablksz;
- if (need < 1) {
- return;
+ if (need < 1) { /* no need to grow the fork */
+ return 0;
}
/* round up to clumpsize */
@@ -550,7 +550,7 @@ static void grow_fork(struct hfs_fork *fork, int ablocks)
/* find last extent record and try to extend it */
if (!(ext = find_ext(fork, blocks/ablksz - 1))) {
/* somehow we couldn't find the end of the file! */
- return;
+ return -1;
}
/* determine which is the last used extent in the record */
@@ -574,7 +574,7 @@ static void grow_fork(struct hfs_fork *fork, int ablocks)
unlock_bitmap(mdb);
if (err) {
relse_ext(ext);
- return;
+ return -1;
}
zero_blocks(mdb, start, len);
@@ -600,7 +600,7 @@ more_extents:
unlock_bitmap(mdb);
if (!len || err) {
relse_ext(ext);
- return;
+ return -1;
}
zero_blocks(mdb, start, len);
@@ -617,7 +617,7 @@ more_extents:
lock_bitmap(mdb);
hfs_clear_vbm_bits(mdb, start, len);
unlock_bitmap(mdb);
- return;
+ return -1;
}
}
blocks = (fork->psize += len * ablksz);
@@ -625,7 +625,7 @@ more_extents:
}
set_cache(fork, ext);
relse_ext(ext);
- return;
+ return 0;
}
/*================ Global functions ================*/
@@ -738,11 +738,8 @@ int hfs_extent_map(struct hfs_fork *fork, int block, int create)
ablock = block / ablksz;
if (block >= fork->psize) {
- if (create) {
- grow_fork(fork, ablock + 1);
- } else {
+ if (!create || (grow_fork(fork, ablock + 1) < 0))
return 0;
- }
}
#if defined(DEBUG_EXTENTS) || defined(DEBUG_ALL)