From bf06e6535f7e00a3711978fa7835a3394b82b547 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Tue, 14 Apr 2015 22:37:31 +0200 Subject: ext2fs: use fat nodes Use `diskfs_make_node_alloc' to allocate both the node and the disknode in a continuous chunk of memory. This increases locality and reduces the pressure on the memory allocator. * ext2fs/inode.c: Use `diskfs_node_disknode' to access the disknode. (diskfs_cached_lookup): Use `diskfs_make_node_alloc' to allocate the node. (diskfs_node_norefs): Only free `np'. * ext2fs/dir.c: Use `diskfs_node_disknode' to access the disknode. * ext2fs/ext2fs.h: Likewise. * ext2fs/getblk.c: Likewise. * ext2fs/ialloc.c: Likewise. * ext2fs/pager.c: Likewise. * ext2fs/truncate.c: Likewise. --- ext2fs/truncate.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'ext2fs/truncate.c') diff --git a/ext2fs/truncate.c b/ext2fs/truncate.c index 63d22955..15e5541a 100644 --- a/ext2fs/truncate.c +++ b/ext2fs/truncate.c @@ -100,7 +100,7 @@ free_block_run_finish (struct free_block_run *fbr) static void trunc_direct (struct node *node, block_t end, struct free_block_run *fbr) { - block_t *blocks = node->dn->info.i_data; + block_t *blocks = diskfs_node_disknode (node)->info.i_data; ext2_debug ("truncating direct blocks from %d", end); @@ -230,7 +230,7 @@ force_delayed_copies (struct node *node, off_t length) struct pager *pager; pthread_spin_lock (&node_to_page_lock); - pager = node->dn->pager; + pager = diskfs_node_disknode (node)->pager; if (pager) ports_port_ref (pager); pthread_spin_unlock (&node_to_page_lock); @@ -260,7 +260,7 @@ enable_delayed_copies (struct node *node) struct pager *pager; pthread_spin_lock (&node_to_page_lock); - pager = node->dn->pager; + pager = diskfs_node_disknode (node)->pager; if (pager) ports_port_ref (pager); pthread_spin_unlock (&node_to_page_lock); @@ -322,7 +322,7 @@ diskfs_truncate (struct node *node, off_t length) force_delayed_copies (node, length); - pthread_rwlock_wrlock (&node->dn->alloc_lock); + pthread_rwlock_wrlock (&diskfs_node_disknode (node)->alloc_lock); /* Update the size on disk; fsck will finish freeing blocks if necessary should we crash. */ @@ -335,7 +335,7 @@ diskfs_truncate (struct node *node, off_t length) if (!err) { block_t end = boffs_block (round_block (length)), offs; - block_t *bptrs = node->dn->info.i_data; + block_t *bptrs = diskfs_node_disknode (node)->info.i_data; struct free_block_run fbr; free_block_run_init (&fbr, node); @@ -355,8 +355,8 @@ diskfs_truncate (struct node *node, off_t length) /* Set our last_page_partially_writable to a pessimistic state -- it won't hurt if is wrong. */ - node->dn->last_page_partially_writable = - trunc_page (node->allocsize) != node->allocsize; + diskfs_node_disknode (node)->last_page_partially_writable = + trunc_page (node->allocsize) != node->allocsize; diskfs_end_catch_exception (); } @@ -368,7 +368,7 @@ diskfs_truncate (struct node *node, off_t length) /* Now we can permit delayed copies again. */ enable_delayed_copies (node); - pthread_rwlock_unlock (&node->dn->alloc_lock); + pthread_rwlock_unlock (&diskfs_node_disknode (node)->alloc_lock); return err; } -- cgit v1.2.3