summaryrefslogtreecommitdiff
path: root/isofs/lookup.c
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2015-04-15 16:26:31 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2015-04-17 22:16:14 +0200
commit4266bb02b1f3342d3fc4920c07c71592a14acdd9 (patch)
treea8312d2209709d962cd3f71cc3cf0b3641a6b951 /isofs/lookup.c
parentc234e34ad80801acd902c6d4892a7722fd084a87 (diff)
isofs: port to libdiskfs' node cache
* isofs/inode.c: Drop all cache-related code. (diskfs_user_make_node): New function. (calculate_file_start): Check for `record' being null. (cache_id): New function. (read_node): Rename to diskfs_user_read_node and adopt accordingly. (diskfs_try_dropping_softrefs): Rename to diskfs_user_try_dropping_softrefs. * isofs/isofs.h (struct lookup_context): New definition. (cache_id): New declaration. * isofs/lookup.c (diskfs_lookup_hard): Adjust accordingly. * isofs/main.c (fetch_root): Likewise.
Diffstat (limited to 'isofs/lookup.c')
-rw-r--r--isofs/lookup.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/isofs/lookup.c b/isofs/lookup.c
index e51b9cb1..f375212a 100644
--- a/isofs/lookup.c
+++ b/isofs/lookup.c
@@ -70,12 +70,12 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
struct node **npp, struct dirstat *ds, struct protid *cred)
{
error_t err = 0;
- struct dirrect *record;
+ struct lookup_context ctx;
int namelen;
int spec_dotdot;
void *buf;
void *blockaddr;
- struct rrip_lookup rr;
+ ino_t id;
if ((type == REMOVE) || (type == RENAME))
assert (npp);
@@ -99,7 +99,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
blockaddr < buf + dp->dn_stat.st_size;
blockaddr += logical_sector_size)
{
- err = dirscanblock (blockaddr, name, namelen, &record, &rr);
+ err = dirscanblock (blockaddr, name, namelen, &ctx.dr, &ctx.rr);
if (!err)
break;
@@ -115,6 +115,10 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
if (err)
return err;
+ err = cache_id (ctx.dr, &ctx.rr, &id);
+ if (err)
+ return err;
+
/* Load the inode */
if (namelen == 2 && name[0] == '.' && name[1] == '.')
{
@@ -125,7 +129,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
/* renames and removes can't get this far. */
assert (type == LOOKUP);
diskfs_nput (dp);
- err = load_inode (npp, record, &rr);
+ err = diskfs_cached_lookup_context (id, npp, &ctx);
}
else
{
@@ -133,7 +137,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
we are permanently read-only, so things are necessarily
quiescent. Just be careful to honor the locking order. */
pthread_mutex_unlock (&dp->lock);
- err = load_inode (npp, record, &rr);
+ err = diskfs_cached_lookup_context (id, npp, &ctx);
pthread_mutex_lock (&dp->lock);
}
}
@@ -143,9 +147,9 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
diskfs_nref (dp);
}
else
- err = load_inode (npp, record, &rr);
+ err = diskfs_cached_lookup_context (id, npp, &ctx);
- release_rrip (&rr);
+ release_rrip (&ctx.rr);
return err;
}