afs/fs/afs volume.h,1.6,1.7 volume.c,1.9,1.10 vnode.h,1.5,1.6
vnode.c,1.8,1.9 vlocation.c,1.11,1.12 main.c,1.12,1.13
internal.h,1.16,1.17 inode.c,1.11,1.12 file.c,1.8,1.9
cell.h,1.5,1.6 cell.c,1.10,1.11 cache.h,1.13,1.14
dwh at infradead.org
dwh at infradead.org
Fri Aug 15 16:16:59 BST 2003
Update of /home/cvs/afs/fs/afs
In directory phoenix.infradead.org:/tmp/cvs-serv19847/fs/afs
Modified Files:
volume.h volume.c vnode.h vnode.c vlocation.c main.c
internal.h inode.c file.c cell.h cell.c cache.h
Log Message:
#ifdef out requirement for caching support
Index: volume.h
===================================================================
RCS file: /home/cvs/afs/fs/afs/volume.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- volume.h 13 Aug 2003 10:05:28 -0000 1.6
+++ volume.h 15 Aug 2003 14:16:56 -0000 1.7
@@ -48,7 +48,9 @@
time_t rtime; /* last retrieval time */
};
+#ifdef AFS_CACHING_SUPPORT
extern struct cachefs_index_def afs_vlocation_cache_index_def;
+#endif
/*****************************************************************************/
/*
@@ -60,7 +62,9 @@
uint8_t hash_bucket; /* which hash bucket this represents */
} __attribute__((packed));
+#ifdef AFS_CACHING_SUPPORT
extern struct cachefs_index_def afs_volume_cache_index_def;
+#endif
/*****************************************************************************/
/*
@@ -72,7 +76,9 @@
struct list_head link; /* link in cell volume location list */
struct afs_timer timeout; /* decaching timer */
struct afs_cell *cell; /* cell to which volume belongs */
+#ifdef AFS_CACHING_SUPPORT
struct cachefs_cookie *cache; /* caching cookie */
+#endif
struct afs_cache_vlocation vldb; /* volume information DB record */
struct afs_volume *vols[3]; /* volume access record pointer (index by type) */
rwlock_t lock; /* access lock */
@@ -107,7 +113,9 @@
atomic_t usage;
struct afs_cell *cell; /* cell to which belongs (unrefd ptr) */
struct afs_vlocation *vlocation; /* volume location */
+#ifdef AFS_CACHING_SUPPORT
struct cachefs_cookie *cache; /* caching cookie */
+#endif
afs_volid_t vid; /* volume ID */
afs_voltype_t __packed type; /* type of volume */
char type_force; /* force volume type (suppress R/O -> R/W) */
Index: volume.c
===================================================================
RCS file: /home/cvs/afs/fs/afs/volume.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- volume.c 10 Jul 2003 11:07:01 -0000 1.9
+++ volume.c 15 Aug 2003 14:16:56 -0000 1.10
@@ -25,6 +25,7 @@
const char *afs_voltypes[] = { "R/W", "R/O", "BAK" };
+#ifdef AFS_CACHING_SUPPORT
static cachefs_match_val_t afs_volume_cache_match(void *target, const void *entry);
static void afs_volume_cache_update(void *source, void *entry);
@@ -36,6 +37,7 @@
.match = afs_volume_cache_match,
.update = afs_volume_cache_update,
};
+#endif
/*****************************************************************************/
/*
@@ -201,10 +203,12 @@
}
/* attach the cache and volume location */
+#ifdef AFS_CACHING_SUPPORT
cachefs_acquire_cookie(vlocation->cache,
&afs_vnode_cache_index_def,
volume,
&volume->cache);
+#endif
afs_get_vlocation(vlocation);
volume->vlocation = vlocation;
@@ -270,7 +274,9 @@
up_write(&vlocation->cell->vl_sem);
/* finish cleaning up the volume */
+#ifdef AFS_CACHING_SUPPORT
cachefs_relinquish_cookie(volume->cache,0);
+#endif
afs_put_vlocation(vlocation);
for (loop=volume->nservers-1; loop>=0; loop--)
@@ -452,6 +458,7 @@
/*
* match a volume hash record stored in the cache
*/
+#ifdef AFS_CACHING_SUPPORT
static cachefs_match_val_t afs_volume_cache_match(void *target, const void *entry)
{
const struct afs_cache_vhash *vhash = entry;
@@ -467,11 +474,13 @@
_leave(" = FAILED");
return CACHEFS_MATCH_FAILED;
} /* end afs_volume_cache_match() */
+#endif
/*****************************************************************************/
/*
* update a volume hash record stored in the cache
*/
+#ifdef AFS_CACHING_SUPPORT
static void afs_volume_cache_update(void *source, void *entry)
{
struct afs_cache_vhash *vhash = entry;
@@ -482,3 +491,4 @@
vhash->vtype = volume->type;
} /* end afs_volume_cache_update() */
+#endif
Index: vnode.h
===================================================================
RCS file: /home/cvs/afs/fs/afs/vnode.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- vnode.h 4 Jul 2003 15:26:31 -0000 1.5
+++ vnode.h 15 Aug 2003 14:16:56 -0000 1.6
@@ -32,7 +32,9 @@
afs_dataversion_t data_version; /* data version */
};
+#ifdef AFS_CACHING_SUPPORT
extern struct cachefs_index_def afs_vnode_cache_index_def;
+#endif
/*****************************************************************************/
/*
@@ -45,7 +47,9 @@
struct afs_volume *volume; /* volume on which vnode resides */
struct afs_fid fid; /* the file identifier for this inode */
struct afs_file_status status; /* AFS status info for this file */
+#ifdef AFS_CACHING_SUPPORT
struct cachefs_cookie *cache; /* caching cookie */
+#endif
wait_queue_head_t update_waitq; /* status fetch waitqueue */
unsigned update_cnt; /* number of outstanding ops that will update the
Index: vnode.c
===================================================================
RCS file: /home/cvs/afs/fs/afs/vnode.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- vnode.c 10 Jul 2003 11:07:01 -0000 1.8
+++ vnode.c 15 Aug 2003 14:16:56 -0000 1.9
@@ -29,6 +29,7 @@
.timed_out = afs_vnode_cb_timed_out,
};
+#ifdef AFS_CACHING_SUPPORT
static cachefs_match_val_t afs_vnode_cache_match(void *target, const void *entry);
static void afs_vnode_cache_update(void *source, void *entry);
@@ -39,6 +40,7 @@
.match = afs_vnode_cache_match,
.update = afs_vnode_cache_update,
};
+#endif
/*****************************************************************************/
/*
@@ -328,6 +330,7 @@
/*
* match a vnode record stored in the cache
*/
+#ifdef AFS_CACHING_SUPPORT
static cachefs_match_val_t afs_vnode_cache_match(void *target, const void *entry)
{
const struct afs_cache_vnode *cvnode = entry;
@@ -355,11 +358,13 @@
_leave(" = SUCCESS");
return CACHEFS_MATCH_SUCCESS;
} /* end afs_vnode_cache_match() */
+#endif
/*****************************************************************************/
/*
* update a vnode record stored in the cache
*/
+#ifdef AFS_CACHING_SUPPORT
static void afs_vnode_cache_update(void *source, void *entry)
{
struct afs_cache_vnode *cvnode = entry;
@@ -372,3 +377,4 @@
cvnode->data_version = vnode->status.version;
} /* end afs_vnode_cache_update() */
+#endif
Index: vlocation.c
===================================================================
RCS file: /home/cvs/afs/fs/afs/vlocation.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- vlocation.c 13 Aug 2003 10:05:28 -0000 1.11
+++ vlocation.c 15 Aug 2003 14:16:56 -0000 1.12
@@ -56,6 +56,7 @@
static afs_vlocation_t *afs_vlocation_update; /* VL currently being updated */
static spinlock_t afs_vlocation_update_lock = SPIN_LOCK_UNLOCKED; /* lock guarding update queue */
+#ifdef AFS_CACHING_SUPPORT
static cachefs_match_val_t afs_vlocation_cache_match(void *target, const void *entry);
static void afs_vlocation_cache_update(void *source, void *entry);
@@ -66,6 +67,7 @@
.match = afs_vlocation_cache_match,
.update = afs_vlocation_cache_update,
};
+#endif
/*****************************************************************************/
/*
@@ -291,6 +293,7 @@
list_add_tail(&vlocation->link, &cell->vl_list);
+#ifdef AFS_CACHING_SUPPORT
/* we want to store it in the cache, plus it might already be encached */
cachefs_acquire_cookie(cell->cache,
&afs_volume_cache_index_def,
@@ -299,6 +302,7 @@
if (vlocation->valid)
goto found_in_cache;
+#endif
/* try to look up an unknown volume in the cell VL databases by name */
ret = afs_vlocation_access_vl_by_name(vlocation, name, namesz, &vldb);
@@ -329,7 +333,9 @@
active:
active = 1;
+#ifdef AFS_CACHING_SUPPORT
found_in_cache:
+#endif
/* try to look up a cached volume in the cell VL databases by ID */
_debug("found in cache");
@@ -421,7 +427,9 @@
}
else {
list_del(&vlocation->link);
+#ifdef AFS_CACHING_SUPPORT
cachefs_relinquish_cookie(vlocation->cache, 0);
+#endif
afs_put_cell(vlocation->cell);
kfree(vlocation);
}
@@ -518,7 +526,9 @@
}
/* we can now destroy it properly */
+#ifdef AFS_CACHING_SUPPORT
cachefs_relinquish_cookie(vlocation->cache,0);
+#endif
afs_put_cell(cell);
kfree(vlocation);
@@ -851,6 +861,7 @@
* match a VLDB record stored in the cache
* - may also load target from entry
*/
+#ifdef AFS_CACHING_SUPPORT
static cachefs_match_val_t afs_vlocation_cache_match(void *target,
const void *entry)
{
@@ -891,11 +902,13 @@
_leave(" = FAILED");
return CACHEFS_MATCH_FAILED;
} /* end afs_vlocation_cache_match() */
+#endif
/*****************************************************************************/
/*
* update a VLDB record stored in the cache
*/
+#ifdef AFS_CACHING_SUPPORT
static void afs_vlocation_cache_update(void *source, void *entry)
{
struct afs_cache_vlocation *vldb = entry;
@@ -906,3 +919,4 @@
struct_cpy(vldb,&vlocation->vldb);
} /* end afs_vlocation_cache_update() */
+#endif
Index: main.c
===================================================================
RCS file: /home/cvs/afs/fs/afs/main.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- main.c 4 Jul 2003 15:26:31 -0000 1.12
+++ main.c 15 Aug 2003 14:16:56 -0000 1.13
@@ -48,6 +48,7 @@
struct list_head afs_cb_hash_tbl[AFS_CB_HASH_COUNT];
spinlock_t afs_cb_hash_lock = SPIN_LOCK_UNLOCKED;
+#ifdef AFS_CACHING_SUPPORT
static struct cachefs_netfs_operations afs_cache_ops = {
.get_page_cookie = afs_cache_get_page_cookie,
};
@@ -57,6 +58,7 @@
.version = 0,
.ops = &afs_cache_ops,
};
+#endif
/*****************************************************************************/
/*
@@ -78,10 +80,12 @@
if (ret<0)
return ret;
+#ifdef AFS_CACHING_SUPPORT
/* we want to be able to cache */
ret = cachefs_register_netfs(&afs_cache_netfs,&afs_cache_cell_index_def);
if (ret<0)
goto error;
+#endif
/* initialise the cell DB */
ret = afs_cell_init();
@@ -119,7 +123,9 @@
error_kafstimod:
afs_kafstimod_stop();
error_cache:
+#ifdef AFS_CACHING_SUPPORT
cachefs_unregister_netfs(&afs_cache_netfs);
+#endif
error:
afs_cell_purge();
afs_proc_cleanup();
@@ -140,7 +146,9 @@
afs_kafstimod_stop();
afs_kafsasyncd_stop();
afs_cell_purge();
+#ifdef AFS_CACHING_SUPPORT
cachefs_unregister_netfs(&afs_cache_netfs);
+#endif
afs_proc_cleanup();
} /* end afs_exit() */
Index: internal.h
===================================================================
RCS file: /home/cvs/afs/fs/afs/internal.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- internal.h 15 Aug 2003 13:02:20 -0000 1.16
+++ internal.h 15 Aug 2003 14:16:56 -0000 1.17
@@ -17,7 +17,10 @@
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/pagemap.h>
+
+#ifdef AFS_CACHING_SUPPORT
#include <linux/cachefs.h>
+#endif
/*
* debug tracing
@@ -58,7 +61,9 @@
*/
extern struct rw_semaphore afs_proc_cells_sem;
extern struct list_head afs_proc_cells;
+#ifdef AFS_CACHING_SUPPORT
extern struct cachefs_index_def afs_cache_cell_index_def;
+#endif
/*
* dir.c
@@ -73,7 +78,9 @@
extern struct inode_operations afs_file_inode_operations;
extern struct file_operations afs_file_file_operations;
+#ifdef AFS_CACHING_SUPPORT
extern int afs_cache_get_page_cookie(struct page *page, struct cachefs_page **_page_cookie);
+#endif
/*
* inode.c
@@ -85,7 +92,9 @@
/*
* main.c
*/
+#ifdef AFS_CACHING_SUPPORT
extern struct cachefs_netfs afs_cache_netfs;
+#endif
/*
* mntpt.c
Index: inode.c
===================================================================
RCS file: /home/cvs/afs/fs/afs/inode.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- inode.c 4 Jul 2003 15:26:31 -0000 1.11
+++ inode.c 15 Aug 2003 14:16:56 -0000 1.12
@@ -179,12 +179,14 @@
return ret;
}
+#ifdef AFS_CACHING_SUPPORT
/* set up caching before reading the status, as fetch-status reads the
* first page of symlinks to see if they're really mntpts */
cachefs_acquire_cookie(vnode->volume->cache,
NULL,
vnode,
&vnode->cache);
+#endif
/* okay... it's a new inode */
vnode->flags |= AFS_VNODE_CHANGED;
@@ -277,8 +279,10 @@
afs_vnode_give_up_callback(vnode);
+#ifdef AFS_CACHING_SUPPORT
cachefs_relinquish_cookie(vnode->cache, 0);
vnode->cache = NULL;
+#endif
_leave("");
} /* end afs_clear_inode() */
Index: file.c
===================================================================
RCS file: /home/cvs/afs/fs/afs/file.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- file.c 4 Jul 2003 15:26:31 -0000 1.8
+++ file.c 15 Aug 2003 14:16:56 -0000 1.9
@@ -75,6 +75,7 @@
/*
* deal with notification that a page was read from the cache
*/
+#ifdef AFS_CACHING_SUPPORT
static void afs_file_readpage_read_complete(void *cookie_data, struct page *page, void *data,
int error)
{
@@ -87,11 +88,13 @@
unlock_page(page);
} /* end afs_file_readpage_read_complete() */
+#endif
/*****************************************************************************/
/*
* deal with notification that a page was written to the cache
*/
+#ifdef AFS_CACHING_SUPPORT
static void afs_file_readpage_write_complete(void *cookie_data, struct page *page, void *data,
int error)
{
@@ -100,6 +103,7 @@
unlock_page(page);
} /* end afs_file_readpage_write_complete() */
+#endif
/*****************************************************************************/
/*
@@ -108,7 +112,9 @@
static int afs_file_readpage(struct file *file, struct page *page)
{
struct afs_rxfs_fetch_descriptor desc;
+#ifdef AFS_CACHING_SUPPORT
struct cachefs_page *pageio;
+#endif
struct inode *inode;
afs_vnode_t *vnode;
int ret;
@@ -126,6 +132,7 @@
if (vnode->flags & AFS_VNODE_DELETED)
goto error;
+#ifdef AFS_CACHING_SUPPORT
ret = cachefs_page_get_private(page,&pageio,GFP_NOIO);
if (ret<0)
goto error;
@@ -136,6 +143,10 @@
afs_file_readpage_read_complete,
NULL,
GFP_KERNEL);
+#else
+ ret = -ENOBUFS;
+#endif
+
switch (ret) {
/* read BIO submitted and wb-journal entry found */
case 1:
@@ -166,12 +177,15 @@
ret = -ESTALE;
}
+#ifdef AFS_CACHING_SUPPORT
cachefs_uncache_page(vnode->cache,page);
+#endif
goto error;
}
SetPageUptodate(page);
+#ifdef AFS_CACHING_SUPPORT
if (cachefs_write_page(vnode->cache,
page,
afs_file_readpage_write_complete,
@@ -181,6 +195,9 @@
cachefs_uncache_page(vnode->cache,page);
unlock_page(page);
}
+#else
+ unlock_page(page);
+#endif
}
_leave(" = 0");
@@ -199,6 +216,7 @@
/*
* get a page cookie for the specified page
*/
+#ifdef AFS_CACHING_SUPPORT
int afs_cache_get_page_cookie(struct page *page, struct cachefs_page **_page_cookie)
{
int ret;
@@ -209,6 +227,7 @@
_leave(" = %d",ret);
return ret;
} /* end afs_cache_get_page_cookie() */
+#endif
/*****************************************************************************/
/*
@@ -216,14 +235,16 @@
*/
static int afs_file_invalidatepage(struct page *page, unsigned long offset)
{
- struct afs_vnode *vnode = AFS_FS_I(page->mapping->host);
int ret = 1;
_enter("{%lu},%lu",page->index,offset);
BUG_ON(!PageLocked(page));
if (PagePrivate(page)) {
+#ifdef AFS_CACHING_SUPPORT
+ struct afs_vnode *vnode = AFS_FS_I(page->mapping->host);
cachefs_uncache_page(vnode->cache,page);
+#endif
/*
* We release buffers only if the entire page is being invalidated.
@@ -250,12 +271,14 @@
static int afs_file_releasepage(struct page *page, int gfp_flags)
{
struct cachefs_page *pageio;
- struct afs_vnode *vnode = AFS_FS_I(page->mapping->host);
_enter("{%lu},%x",page->index,gfp_flags);
if (PagePrivate(page)) {
+#ifdef AFS_CACHING_SUPPORT
+ struct afs_vnode *vnode = AFS_FS_I(page->mapping->host);
cachefs_uncache_page(vnode->cache,page);
+#endif
pageio = (struct cachefs_page *) page->private;
page->private = 0;
Index: cell.h
===================================================================
RCS file: /home/cvs/afs/fs/afs/cell.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- cell.h 4 Jul 2003 15:26:31 -0000 1.5
+++ cell.h 15 Aug 2003 14:16:56 -0000 1.6
@@ -38,7 +38,9 @@
struct list_head link; /* main cell list link */
struct list_head proc_link; /* /proc cell list link */
struct proc_dir_entry *proc_dir; /* /proc dir for this cell */
+#ifdef AFS_CACHING_SUPPORT
struct cachefs_cookie *cache; /* caching cookie */
+#endif
/* server record management */
rwlock_t sv_lock; /* active server list lock */
Index: cell.c
===================================================================
RCS file: /home/cvs/afs/fs/afs/cell.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- cell.c 10 Jul 2003 11:07:01 -0000 1.10
+++ cell.c 15 Aug 2003 14:16:56 -0000 1.11
@@ -36,6 +36,7 @@
MODULE_PARM(rootcell,"s");
MODULE_PARM_DESC(rootcell,"root AFS cell name and VL server IP addr list");
+#ifdef AFS_CACHING_SUPPORT
static cachefs_match_val_t afs_cell_cache_match(void *target, const void *entry);
static void afs_cell_cache_update(void *source, void *entry);
@@ -46,6 +47,7 @@
.match = afs_cell_cache_match,
.update = afs_cell_cache_update,
};
+#endif
/*****************************************************************************/
/*
@@ -116,11 +118,13 @@
if (ret<0)
goto error;
+#ifdef AFS_CACHING_SUPPORT
/* put it up for caching */
cachefs_acquire_cookie(afs_cache_netfs.primary_index,
&afs_vlocation_cache_index_def,
cell,
&cell->cache);
+#endif
/* add to the cell lists */
write_lock(&afs_cells_lock);
@@ -306,7 +310,9 @@
list_del_init(&cell->proc_link);
up_write(&afs_proc_cells_sem);
+#ifdef AFS_CACHING_SUPPORT
cachefs_relinquish_cookie(cell->cache,0);
+#endif
up_write(&afs_cells_sem);
@@ -484,6 +490,7 @@
/*
* match a cell record obtained from the cache
*/
+#ifdef AFS_CACHING_SUPPORT
static cachefs_match_val_t afs_cell_cache_match(void *target, const void *entry)
{
const struct afs_cache_cell *ccell = entry;
@@ -499,11 +506,13 @@
_leave(" = FAILED");
return CACHEFS_MATCH_FAILED;
} /* end afs_cell_cache_match() */
+#endif
/*****************************************************************************/
/*
* update a cell record in the cache
*/
+#ifdef AFS_CACHING_SUPPORT
static void afs_cell_cache_update(void *source, void *entry)
{
struct afs_cache_cell *ccell = entry;
@@ -518,3 +527,4 @@
min(sizeof(ccell->vl_servers), sizeof(cell->vl_addrs)));
} /* end afs_cell_cache_update() */
+#endif
Index: cache.h
===================================================================
RCS file: /home/cvs/afs/fs/afs/cache.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- cache.h 6 Jun 2003 08:33:37 -0000 1.13
+++ cache.h 15 Aug 2003 14:16:56 -0000 1.14
@@ -14,7 +14,9 @@
#include <linux/version.h>
#include <linux/mm.h>
+#ifdef AFS_CACHING_SUPPORT
#include <linux/cachefs.h>
+#endif
#include "types.h"
#ifdef __KERNEL__
More information about the linux-afs-cvs
mailing list