summaryrefslogtreecommitdiff
path: root/debian/patches/0013-xxx-half-assed-try-to-port-isofs-to-the-node-cache.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/0013-xxx-half-assed-try-to-port-isofs-to-the-node-cache.patch')
-rw-r--r--debian/patches/0013-xxx-half-assed-try-to-port-isofs-to-the-node-cache.patch356
1 files changed, 0 insertions, 356 deletions
diff --git a/debian/patches/0013-xxx-half-assed-try-to-port-isofs-to-the-node-cache.patch b/debian/patches/0013-xxx-half-assed-try-to-port-isofs-to-the-node-cache.patch
deleted file mode 100644
index 64cc167e..00000000
--- a/debian/patches/0013-xxx-half-assed-try-to-port-isofs-to-the-node-cache.patch
+++ /dev/null
@@ -1,356 +0,0 @@
-From 128449af8811d49a7cd4f8b686ad15e58a5ba19b Mon Sep 17 00:00:00 2001
-From: Justus Winter <4winter@informatik.uni-hamburg.de>
-Date: Wed, 15 Apr 2015 16:26:31 +0200
-Subject: [PATCH hurd 13/16] xxx half-assed try to port isofs to the node cache
-
----
- isofs/inode.c | 88 ++++++++++++++++++++++++++++------------------------------
- isofs/isofs.h | 6 +++-
- isofs/lookup.c | 18 +++++++++---
- isofs/main.c | 6 +++-
- isofs/rr.c | 4 +++
- 5 files changed, 70 insertions(+), 52 deletions(-)
-
-diff --git a/isofs/inode.c b/isofs/inode.c
-index e79ebdd..16abd86 100644
---- a/isofs/inode.c
-+++ b/isofs/inode.c
-@@ -40,8 +40,8 @@
-
- struct node_cache
- {
-- struct dirrect *dr; /* somewhere in disk_image */
-- off_t file_start; /* start of file */
-+ //struct dirrect *dr; /* somewhere in disk_image */
-+ //off_t file_start; /* start of file */
-
- off_t id; /* UNIQUE identifier. */
-
-@@ -63,8 +63,7 @@ struct node_cache *node_cache = 0;
- static pthread_rwlock_t nodecache_lock = PTHREAD_RWLOCK_INITIALIZER;
-
- /* Forward */
--static error_t read_disknode (struct node *,
-- struct dirrect *, struct rrip_lookup *);
-+static error_t read_disknode (struct node *);
-
-
- /* Lookup node with id ID. Returns NULL if the node is not found in
-@@ -111,21 +110,14 @@ use_file_start_id (struct dirrect *record, struct rrip_lookup *rr)
- /* Enter NP into the cache. The directory entry we used is DR, the
- cached Rock-Ridge info RR. nodecache_lock must be held. */
- void
--cache_inode (struct node *np, struct dirrect *record,
-- struct rrip_lookup *rr)
-+cache_inode (ino_t id, struct node *np)
- {
- int i;
- struct node_cache *c = 0;
-- off_t id;
--
-- if (use_file_start_id (record, rr))
-- id = np->dn->file_start << store->log2_block_size;
-- else
-- id = (off_t) ((void *) record - (void *) disk_image);
-
- /* First see if there's already an entry. */
- for (i = 0; i < node_cache_size; i++)
-- if (node_cache[i].id == id)
-+ if (node_cache[i].id == (off_t) id)
- break;
-
- if (i == node_cache_size)
-@@ -151,14 +143,9 @@ cache_inode (struct node *np, struct dirrect *record,
- }
-
- c = &node_cache[i];
-- c->id = id;
-- c->dr = record;
-- c->file_start = np->dn->file_start;
-+ c->id = (off_t) id;
- diskfs_nref_light (np);
- c->np = np;
--
-- /* PLUS 1 so that we don't store zero cache ID's (not allowed by diskfs) */
-- np->cache_id = i + 1;
- }
-
- /* Fetch inode with cache id ID; set *NPP to the node structure;
-@@ -177,7 +164,7 @@ diskfs_cached_lookup (ino_t id, struct node **npp)
- assert (id < node_cache_size);
-
- np = node_cache[id].np;
--
-+ assert (np);
- if (!np)
- {
- struct node_cache *c = &node_cache[id];
-@@ -186,7 +173,7 @@ diskfs_cached_lookup (ino_t id, struct node **npp)
-
- pthread_rwlock_unlock (&nodecache_lock);
-
-- rrip_lookup (node_cache[id].dr, &rr, 1);
-+ //rrip_lookup (node_cache[id].dr, &rr, 1);
-
- /* We should never cache the wrong directory entry */
- assert (!(rr.valid & VALID_CL));
-@@ -199,8 +186,8 @@ diskfs_cached_lookup (ino_t id, struct node **npp)
- return ENOMEM;
- }
- dn->fileinfo = 0;
-- dn->dr = c->dr;
-- dn->file_start = c->file_start;
-+ //dn->dr = c->dr;
-+ //dn->file_start = c->file_start;
- np = diskfs_make_node (dn);
- if (!np)
- {
-@@ -224,7 +211,8 @@ diskfs_cached_lookup (ino_t id, struct node **npp)
- diskfs_nref_light (np);
- pthread_rwlock_unlock (&nodecache_lock);
-
-- err = read_disknode (np, dn->dr, &rr);
-+ dn->rr = rr;
-+ err = read_disknode (np);
- if (!err)
- *npp = np;
-
-@@ -327,33 +315,38 @@ calculate_file_start (struct dirrect *record, off_t *file_start,
- return 0;
- }
-
--
--/* Load the inode with directory entry RECORD and cached Rock-Ridge
-- info RR into NP. The directory entry is at OFFSET in BLOCK. */
-+/* Given RECORD and RR, calculate the cache id. */
- error_t
--load_inode (struct node **npp, struct dirrect *record,
-- struct rrip_lookup *rr)
-+cache_id (struct dirrect *record, struct rrip_lookup *rr, ino_t *idp)
- {
- error_t err;
- off_t file_start;
-- struct disknode *dn;
-- struct node *np, *tmp;
-- off_t id;
--
- err = calculate_file_start (record, &file_start, rr);
- if (err)
- return err;
-+
- if (rr->valid & VALID_CL)
- record = rr->realdirent;
-
-- /* First check the cache */
- if (use_file_start_id (record, rr))
-- id = file_start << store->log2_block_size;
-+ *idp = file_start << store->log2_block_size;
- else
-- id = (off_t) ((void *) record - (void *) disk_image);
-+ *idp = (off_t) ((void *) record - (void *) disk_image);
-+ return 0;
-+}
-+
-+/* Load the inode with directory entry RECORD and cached Rock-Ridge
-+ info RR into NP. The directory entry is at OFFSET in BLOCK. */
-+error_t
-+load_inode (ino_t id, struct node **npp, struct dirrect *record,
-+ struct rrip_lookup *rr)
-+{
-+ error_t err;
-+ struct disknode *dn;
-+ struct node *np, *tmp;
-
- pthread_rwlock_rdlock (&nodecache_lock);
-- inode_cache_find (id, npp);
-+ inode_cache_find ((off_t) id, npp);
- pthread_rwlock_unlock (&nodecache_lock);
- if (*npp)
- return 0;
-@@ -363,9 +356,14 @@ load_inode (struct node **npp, struct dirrect *record,
- if (!dn)
- return ENOMEM;
-
-+ err = calculate_file_start (record, &dn->file_start, rr);
-+ if (err)
-+ {
-+ free (dn);
-+ return err;
-+ }
- dn->fileinfo = 0;
- dn->dr = record;
-- dn->file_start = file_start;
-
- np = diskfs_make_node (dn);
- if (!np)
-@@ -388,10 +386,10 @@ load_inode (struct node **npp, struct dirrect *record,
- return 0;
- }
-
-- cache_inode (np, record, rr);
-+ cache_inode (id, np);
- pthread_rwlock_unlock (&nodecache_lock);
-
-- err = read_disknode (np, record, rr);
-+ err = read_disknode (np);
- *npp = np;
- return err;
- }
-@@ -400,17 +398,15 @@ load_inode (struct node **npp, struct dirrect *record,
- /* Read stat information from the directory entry at DR and the
- contents of RL. */
- static error_t
--read_disknode (struct node *np, struct dirrect *dr,
-- struct rrip_lookup *rl)
-+read_disknode (struct node *np)
- {
- error_t err;
- struct stat *st = &np->dn_stat;
-+ struct dirrect *dr = np->dn->dr;
-+ struct rrip_lookup *rl = &np->dn->rr;
- st->st_fstype = FSTYPE_ISO9660;
- st->st_fsid = getpid ();
-- if (use_file_start_id (dr, rl))
-- st->st_ino = (ino_t) np->dn->file_start << store->log2_block_size;
-- else
-- st->st_ino = (ino_t) ((void *) dr - (void *) disk_image);
-+ st->st_ino = np->cache_id;
- st->st_gen = 0;
- st->st_rdev = 0;
-
-diff --git a/isofs/isofs.h b/isofs/isofs.h
-index 68a94e9..9aa9608 100644
---- a/isofs/isofs.h
-+++ b/isofs/isofs.h
-@@ -34,6 +34,7 @@
- struct disknode
- {
- struct dirrect *dr; /* Somewhere in disk_image. */
-+ struct rrip_lookup rr;
-
- off_t file_start; /* In store->block_size units */
-
-@@ -87,7 +88,10 @@ void drop_pager_softrefs (struct node *);
- void allow_pager_softrefs (struct node *);
- void create_disk_pager (void);
-
--error_t load_inode (struct node **, struct dirrect *, struct rrip_lookup *);
-+/* Given RECORD and RR, calculate the cache id. */
-+error_t cache_id (struct dirrect *record, struct rrip_lookup *rr, ino_t *idp);
-+
-+error_t load_inode (ino_t, struct node **, struct dirrect *, struct rrip_lookup *);
- error_t calculate_file_start (struct dirrect *, off_t *, struct rrip_lookup *);
-
- char *isodate_915 (char *, struct timespec *);
-diff --git a/isofs/lookup.c b/isofs/lookup.c
-index e51b9cb..f0bd73b 100644
---- a/isofs/lookup.c
-+++ b/isofs/lookup.c
-@@ -76,6 +76,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
- void *buf;
- void *blockaddr;
- struct rrip_lookup rr;
-+ ino_t id;
-
- if ((type == REMOVE) || (type == RENAME))
- assert (npp);
-@@ -115,6 +116,10 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
- if (err)
- return err;
-
-+ err = cache_id (record, &rr, &id);
-+ if (err)
-+ return err;
-+
- /* Load the inode */
- if (namelen == 2 && name[0] == '.' && name[1] == '.')
- {
-@@ -125,7 +130,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 = load_inode (id, npp, record, &rr);
- }
- else
- {
-@@ -133,7 +138,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 = load_inode (id, npp, record, &rr);
- pthread_mutex_lock (&dp->lock);
- }
- }
-@@ -143,9 +148,14 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
- diskfs_nref (dp);
- }
- else
-- err = load_inode (npp, record, &rr);
-+ err = load_inode (id, npp, record, &rr);
-+
-+ (*npp)->dn->dr = record;
-+ if ((*npp)->dn->rr.valid)
-+ release_rrip (&rr);
-+ else
-+ (*npp)->dn->rr = rr;
-
-- release_rrip (&rr);
- return err;
- }
-
-diff --git a/isofs/main.c b/isofs/main.c
-index 4f531f7..fb111dd 100644
---- a/isofs/main.c
-+++ b/isofs/main.c
-@@ -46,6 +46,7 @@ fetch_root ()
- {
- struct rrip_lookup rl;
- struct dirrect *dr;
-+ ino_t id;
- error_t err;
-
- dr = (struct dirrect *) sblock->root;
-@@ -56,8 +57,11 @@ fetch_root ()
- /* Now rescan the node for real */
- rrip_lookup (dr, &rl, 1);
-
-+ err = cache_id (dr, &rl, &id);
-+ assert_perror (err);
-+
- /* And fetch the node. */
-- err = load_inode (&diskfs_root_node, dr, &rl);
-+ err = load_inode (id, &diskfs_root_node, dr, &rl);
- assert_perror (err);
-
- pthread_mutex_unlock (&diskfs_root_node->lock);
-diff --git a/isofs/rr.c b/isofs/rr.c
-index adc95c3..2429fae 100644
---- a/isofs/rr.c
-+++ b/isofs/rr.c
-@@ -38,10 +38,13 @@ release_rrip (struct rrip_lookup *rr)
- {
- if ((rr->valid & VALID_NM) && rr->name)
- free (rr->name);
-+ rr->name = NULL;
- if ((rr->valid & VALID_SL) && rr->target)
- free (rr->target);
-+ rr->target = NULL;
- if ((rr->valid & VALID_TR) && rr->trans)
- free (rr->trans);
-+ rr->trans = NULL;
- }
-
-
-@@ -51,6 +54,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr,
- const char *match_name, size_t match_name_len,
- int initializing, int ignorenm)
- {
-+ // error (0, 0, "rrip_work %p %p %s %d %d %d", dr, rr, match_name, match_name_len, initializing, ignorenm);
- void *bp, *terminus;
- void *slbuf, *nmbuf;
- size_t slbufsize, nmbufsize;
---
-2.1.4
-