summaryrefslogtreecommitdiff
path: root/ext2fs
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-04-26 00:15:35 +0000
committerMiles Bader <miles@gnu.org>1995-04-26 00:15:35 +0000
commit77ccd71befdd50299f33a853eded98938e90b98a (patch)
tree34bb69d73c2c93ec6532f242b53353843f8db0c6 /ext2fs
parentc7046ef73ae6ac3af08f797d3957ad571317cdfb (diff)
Formerly truncate.c.~15~
Diffstat (limited to 'ext2fs')
-rw-r--r--ext2fs/truncate.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/ext2fs/truncate.c b/ext2fs/truncate.c
index b2d23bea..480b3462 100644
--- a/ext2fs/truncate.c
+++ b/ext2fs/truncate.c
@@ -75,7 +75,7 @@ poke_pages (memory_object_t obj,
/* ---------------------------------------------------------------- */
#define DIRECT_BLOCK(length) \
- ((length + block_size - 1) / block_size)
+ ((length + block_size - 1) >> log2_block_size)
#define INDIRECT_BLOCK(length, offset) \
((int)DIRECT_BLOCK(length) - offset)
#define DINDIRECT_BLOCK(length, offset) \
@@ -422,6 +422,7 @@ diskfs_truncate (struct node *node, off_t length)
EXT2_ADDR_PER_BLOCK(sblock),
(u32 *) &node->dn->info.i_data[EXT2_DIND_BLOCK]);
trunc_tindirect (node, length);
+ node->allocsize = trunc_block (length + block_size - 1);
}
node->dn_set_mtime = 1;
@@ -431,18 +432,7 @@ diskfs_truncate (struct node *node, off_t length)
/* Now we can permit delayed copies again. */
enable_delayed_copies (node);
- return 0;
-}
+ rwlock_writer_unlock (&node->dn->alloc_lock);
-/* The user must define this function. Grow the disk allocated to locked node
- NODE to be at least SIZE bytes, and set NODE->allocsize to the actual
- allocated size. (If the allocated size is already SIZE bytes, do
- nothing.) CRED identifies the user responsible for the call. */
-error_t
-diskfs_grow (struct node *node, off_t size, struct protid *cred)
-{
- assert (!diskfs_readonly);
- if (size > node->allocsize)
- node->allocsize = size;
- return 0;
+ return err;
}