Commit ec26815a authored by David Howells's avatar David Howells Committed by David S. Miller

[AFS]: Clean up the AFS sources

Clean up the AFS sources.

Also remove references to AFS keys.  RxRPC keys are used instead.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 17926a79
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
# Makefile for Red Hat Linux AFS client. # Makefile for Red Hat Linux AFS client.
# #
#CFLAGS += -finstrument-functions
kafs-objs := \ kafs-objs := \
callback.o \ callback.o \
cell.o \ cell.o \
......
/* cache.h: AFS local cache management interface /* AFS local cache management interface
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#ifndef _LINUX_AFS_CACHE_H #ifndef AFS_CACHE_H
#define _LINUX_AFS_CACHE_H #define AFS_CACHE_H
#undef AFS_CACHING_SUPPORT #undef AFS_CACHING_SUPPORT
...@@ -20,8 +20,4 @@ ...@@ -20,8 +20,4 @@
#endif #endif
#include "types.h" #include "types.h"
#ifdef __KERNEL__ #endif /* AFS_CACHE_H */
#endif /* __KERNEL__ */
#endif /* _LINUX_AFS_CACHE_H */
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "internal.h" #include "internal.h"
#include "cmservice.h" #include "cmservice.h"
/*****************************************************************************/
/* /*
* allow the fileserver to request callback state (re-)initialisation * allow the fileserver to request callback state (re-)initialisation
*/ */
...@@ -79,9 +78,8 @@ int SRXAFSCM_InitCallBackState(struct afs_server *server) ...@@ -79,9 +78,8 @@ int SRXAFSCM_InitCallBackState(struct afs_server *server)
_leave(" = 0"); _leave(" = 0");
return 0; return 0;
} /* end SRXAFSCM_InitCallBackState() */ }
/*****************************************************************************/
/* /*
* allow the fileserver to break callback promises * allow the fileserver to break callback promises
*/ */
...@@ -156,9 +154,8 @@ int SRXAFSCM_CallBack(struct afs_server *server, size_t count, ...@@ -156,9 +154,8 @@ int SRXAFSCM_CallBack(struct afs_server *server, size_t count,
_leave(" = 0"); _leave(" = 0");
return 0; return 0;
} /* end SRXAFSCM_CallBack() */ }
/*****************************************************************************/
/* /*
* allow the fileserver to see if the cache manager is still alive * allow the fileserver to see if the cache manager is still alive
*/ */
...@@ -166,4 +163,4 @@ int SRXAFSCM_Probe(struct afs_server *server) ...@@ -166,4 +163,4 @@ int SRXAFSCM_Probe(struct afs_server *server)
{ {
_debug("SRXAFSCM_Probe(%p)\n", server); _debug("SRXAFSCM_Probe(%p)\n", server);
return 0; return 0;
} /* end SRXAFSCM_Probe() */ }
/* cell.c: AFS cell and server record management /* AFS cell and server record management
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -44,7 +44,6 @@ struct cachefs_index_def afs_cache_cell_index_def = { ...@@ -44,7 +44,6 @@ struct cachefs_index_def afs_cache_cell_index_def = {
}; };
#endif #endif
/*****************************************************************************/
/* /*
* create a cell record * create a cell record
* - "name" is the name of the cell * - "name" is the name of the cell
...@@ -137,16 +136,15 @@ int afs_cell_create(const char *name, char *vllist, struct afs_cell **_cell) ...@@ -137,16 +136,15 @@ int afs_cell_create(const char *name, char *vllist, struct afs_cell **_cell)
_leave(" = 0 (%p)", cell); _leave(" = 0 (%p)", cell);
return 0; return 0;
badaddr: badaddr:
printk(KERN_ERR "kAFS: bad VL server IP address: '%s'\n", vllist); printk(KERN_ERR "kAFS: bad VL server IP address: '%s'\n", vllist);
error: error:
up_write(&afs_cells_sem); up_write(&afs_cells_sem);
kfree(cell); kfree(cell);
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
} /* end afs_cell_create() */ }
/*****************************************************************************/
/* /*
* initialise the cell database from module parameters * initialise the cell database from module parameters
*/ */
...@@ -199,10 +197,8 @@ int afs_cell_init(char *rootcell) ...@@ -199,10 +197,8 @@ int afs_cell_init(char *rootcell)
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
}
} /* end afs_cell_init() */
/*****************************************************************************/
/* /*
* lookup a cell record * lookup a cell record
*/ */
...@@ -234,8 +230,7 @@ int afs_cell_lookup(const char *name, unsigned namesz, struct afs_cell **_cell) ...@@ -234,8 +230,7 @@ int afs_cell_lookup(const char *name, unsigned namesz, struct afs_cell **_cell)
if (cell) if (cell)
ret = 0; ret = 0;
} } else {
else {
read_lock(&afs_cells_lock); read_lock(&afs_cells_lock);
cell = afs_cell_root; cell = afs_cell_root;
...@@ -247,8 +242,7 @@ int afs_cell_lookup(const char *name, unsigned namesz, struct afs_cell **_cell) ...@@ -247,8 +242,7 @@ int afs_cell_lookup(const char *name, unsigned namesz, struct afs_cell **_cell)
* for other reasons. * for other reasons.
*/ */
ret = -EDESTADDRREQ; ret = -EDESTADDRREQ;
} } else {
else {
afs_get_cell(cell); afs_get_cell(cell);
ret = 0; ret = 0;
} }
...@@ -259,10 +253,8 @@ int afs_cell_lookup(const char *name, unsigned namesz, struct afs_cell **_cell) ...@@ -259,10 +253,8 @@ int afs_cell_lookup(const char *name, unsigned namesz, struct afs_cell **_cell)
*_cell = cell; *_cell = cell;
_leave(" = %d (%p)", ret, cell); _leave(" = %d (%p)", ret, cell);
return ret; return ret;
}
} /* end afs_cell_lookup() */
/*****************************************************************************/
/* /*
* try and get a cell record * try and get a cell record
*/ */
...@@ -281,9 +273,8 @@ struct afs_cell *afs_get_cell_maybe(struct afs_cell **_cell) ...@@ -281,9 +273,8 @@ struct afs_cell *afs_get_cell_maybe(struct afs_cell **_cell)
write_unlock(&afs_cells_lock); write_unlock(&afs_cells_lock);
return cell; return cell;
} /* end afs_get_cell_maybe() */ }
/*****************************************************************************/
/* /*
* destroy a cell record * destroy a cell record
*/ */
...@@ -315,9 +306,8 @@ void afs_put_cell(struct afs_cell *cell) ...@@ -315,9 +306,8 @@ void afs_put_cell(struct afs_cell *cell)
BUG_ON(!list_empty(&cell->vl_graveyard)); BUG_ON(!list_empty(&cell->vl_graveyard));
_leave(" [unused]"); _leave(" [unused]");
} /* end afs_put_cell() */ }
/*****************************************************************************/
/* /*
* destroy a cell record * destroy a cell record
*/ */
...@@ -359,9 +349,8 @@ static void afs_cell_destroy(struct afs_cell *cell) ...@@ -359,9 +349,8 @@ static void afs_cell_destroy(struct afs_cell *cell)
kfree(cell); kfree(cell);
_leave(" [destroyed]"); _leave(" [destroyed]");
} /* end afs_cell_destroy() */ }
/*****************************************************************************/
/* /*
* lookup the server record corresponding to an Rx RPC peer * lookup the server record corresponding to an Rx RPC peer
*/ */
...@@ -411,7 +400,7 @@ int afs_server_find_by_peer(const struct rxrpc_peer *peer, ...@@ -411,7 +400,7 @@ int afs_server_find_by_peer(const struct rxrpc_peer *peer,
return -ENOENT; return -ENOENT;
/* we found it in the graveyard - resurrect it */ /* we found it in the graveyard - resurrect it */
found_dead_server: found_dead_server:
list_move_tail(&server->link, &cell->sv_list); list_move_tail(&server->link, &cell->sv_list);
afs_get_server(server); afs_get_server(server);
afs_kafstimod_del_timer(&server->timeout); afs_kafstimod_del_timer(&server->timeout);
...@@ -419,20 +408,18 @@ int afs_server_find_by_peer(const struct rxrpc_peer *peer, ...@@ -419,20 +408,18 @@ int afs_server_find_by_peer(const struct rxrpc_peer *peer,
goto success; goto success;
/* we found it - increment its ref count and return it */ /* we found it - increment its ref count and return it */
found_server: found_server:
afs_get_server(server); afs_get_server(server);
success: success:
write_unlock(&cell->sv_lock); write_unlock(&cell->sv_lock);
read_unlock(&afs_cells_lock); read_unlock(&afs_cells_lock);
*_server = server; *_server = server;
_leave(" = 0 (s=%p c=%p)", server, cell); _leave(" = 0 (s=%p c=%p)", server, cell);
return 0; return 0;
}
} /* end afs_server_find_by_peer() */
/*****************************************************************************/
/* /*
* purge in-memory cell database on module unload or afs_init() failure * purge in-memory cell database on module unload or afs_init() failure
* - the timeout daemon is stopped before calling this * - the timeout daemon is stopped before calling this
...@@ -520,9 +507,8 @@ void afs_cell_purge(void) ...@@ -520,9 +507,8 @@ void afs_cell_purge(void)
} }
_leave(""); _leave("");
} /* end afs_cell_purge() */ }
/*****************************************************************************/
/* /*
* match a cell record obtained from the cache * match a cell record obtained from the cache
*/ */
...@@ -542,10 +528,9 @@ static cachefs_match_val_t afs_cell_cache_match(void *target, ...@@ -542,10 +528,9 @@ static cachefs_match_val_t afs_cell_cache_match(void *target,
_leave(" = FAILED"); _leave(" = FAILED");
return CACHEFS_MATCH_FAILED; return CACHEFS_MATCH_FAILED;
} /* end afs_cell_cache_match() */ }
#endif #endif
/*****************************************************************************/
/* /*
* update a cell record in the cache * update a cell record in the cache
*/ */
...@@ -563,5 +548,5 @@ static void afs_cell_cache_update(void *source, void *entry) ...@@ -563,5 +548,5 @@ static void afs_cell_cache_update(void *source, void *entry)
cell->vl_addrs, cell->vl_addrs,
min(sizeof(ccell->vl_servers), sizeof(cell->vl_addrs))); min(sizeof(ccell->vl_servers), sizeof(cell->vl_addrs)));
} /* end afs_cell_cache_update() */ }
#endif #endif
/* cell.h: AFS cell record /* AFS cell record
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#ifndef _LINUX_AFS_CELL_H #ifndef AFS_CELL_H
#define _LINUX_AFS_CELL_H #define AFS_CELL_H
#include "types.h" #include "types.h"
#include "cache.h" #include "cache.h"
...@@ -19,22 +19,18 @@ ...@@ -19,22 +19,18 @@
extern volatile int afs_cells_being_purged; /* T when cells are being purged by rmmod */ extern volatile int afs_cells_being_purged; /* T when cells are being purged by rmmod */
/*****************************************************************************/
/* /*
* entry in the cached cell catalogue * entry in the cached cell catalogue
*/ */
struct afs_cache_cell struct afs_cache_cell {
{
char name[64]; /* cell name (padded with NULs) */ char name[64]; /* cell name (padded with NULs) */
struct in_addr vl_servers[15]; /* cached cell VL servers */ struct in_addr vl_servers[15]; /* cached cell VL servers */
}; };
/*****************************************************************************/
/* /*
* AFS cell record * AFS cell record
*/ */
struct afs_cell struct afs_cell {
{
atomic_t usage; atomic_t usage;
struct list_head link; /* main cell list link */ struct list_head link; /* main cell list link */
struct list_head proc_link; /* /proc cell list link */ struct list_head proc_link; /* /proc cell list link */
...@@ -61,18 +57,14 @@ struct afs_cell ...@@ -61,18 +57,14 @@ struct afs_cell
char name[0]; /* cell name - must go last */ char name[0]; /* cell name - must go last */
}; };
extern int afs_cell_init(char *rootcell); extern int afs_cell_init(char *);
extern int afs_cell_create(const char *, char *, struct afs_cell **);
extern int afs_cell_create(const char *name, char *vllist, struct afs_cell **_cell); extern int afs_cell_lookup(const char *, unsigned, struct afs_cell **);
extern int afs_cell_lookup(const char *name, unsigned nmsize, struct afs_cell **_cell);
#define afs_get_cell(C) do { atomic_inc(&(C)->usage); } while(0) #define afs_get_cell(C) do { atomic_inc(&(C)->usage); } while(0)
extern struct afs_cell *afs_get_cell_maybe(struct afs_cell **_cell); extern struct afs_cell *afs_get_cell_maybe(struct afs_cell **);
extern void afs_put_cell(struct afs_cell *);
extern void afs_put_cell(struct afs_cell *cell);
extern void afs_cell_purge(void); extern void afs_cell_purge(void);
#endif /* _LINUX_AFS_CELL_H */ #endif /* AFS_CELL_H */
/* cmservice.c: AFS Cache Manager Service /* AFS Cache Manager Service
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -106,7 +106,6 @@ static DEFINE_SPINLOCK(afscm_calls_lock); ...@@ -106,7 +106,6 @@ static DEFINE_SPINLOCK(afscm_calls_lock);
static DEFINE_SPINLOCK(kafscmd_attention_lock); static DEFINE_SPINLOCK(kafscmd_attention_lock);
static int kafscmd_die; static int kafscmd_die;
/*****************************************************************************/
/* /*
* AFS Cache Manager kernel thread * AFS Cache Manager kernel thread
*/ */
...@@ -177,10 +176,8 @@ static int kafscmd(void *arg) ...@@ -177,10 +176,8 @@ static int kafscmd(void *arg)
/* and that's all */ /* and that's all */
complete_and_exit(&kafscmd_dead, 0); complete_and_exit(&kafscmd_dead, 0);
}
} /* end kafscmd() */
/*****************************************************************************/
/* /*
* handle a call coming in to the cache manager * handle a call coming in to the cache manager
* - if I want to keep the call, I must increment its usage count * - if I want to keep the call, I must increment its usage count
...@@ -202,10 +199,8 @@ static int afscm_new_call(struct rxrpc_call *call) ...@@ -202,10 +199,8 @@ static int afscm_new_call(struct rxrpc_call *call)
_leave(" = 0"); _leave(" = 0");
return 0; return 0;
}
} /* end afscm_new_call() */
/*****************************************************************************/
/* /*
* queue on the kafscmd queue for attention * queue on the kafscmd queue for attention
*/ */
...@@ -226,9 +221,8 @@ static void afscm_attention(struct rxrpc_call *call) ...@@ -226,9 +221,8 @@ static void afscm_attention(struct rxrpc_call *call)
wake_up(&kafscmd_sleepq); wake_up(&kafscmd_sleepq);
_leave(" {u=%d}", atomic_read(&call->usage)); _leave(" {u=%d}", atomic_read(&call->usage));
} /* end afscm_attention() */ }
/*****************************************************************************/
/* /*
* handle my call being aborted * handle my call being aborted
* - clean up, dequeue and put my ref to the call * - clean up, dequeue and put my ref to the call
...@@ -266,9 +260,8 @@ static void afscm_error(struct rxrpc_call *call) ...@@ -266,9 +260,8 @@ static void afscm_error(struct rxrpc_call *call)
wake_up(&kafscmd_sleepq); wake_up(&kafscmd_sleepq);
_leave(""); _leave("");
} /* end afscm_error() */ }
/*****************************************************************************/
/* /*
* map afs abort codes to/from Linux error codes * map afs abort codes to/from Linux error codes
* - called with call->lock held * - called with call->lock held
...@@ -285,9 +278,8 @@ static void afscm_aemap(struct rxrpc_call *call) ...@@ -285,9 +278,8 @@ static void afscm_aemap(struct rxrpc_call *call)
default: default:
break; break;
} }
} /* end afscm_aemap() */ }
/*****************************************************************************/
/* /*
* start the cache manager service if not already started * start the cache manager service if not already started
*/ */
...@@ -316,18 +308,16 @@ int afscm_start(void) ...@@ -316,18 +308,16 @@ int afscm_start(void)
return 0; return 0;
kill: kill:
kafscmd_die = 1; kafscmd_die = 1;
wake_up(&kafscmd_sleepq); wake_up(&kafscmd_sleepq);
wait_for_completion(&kafscmd_dead); wait_for_completion(&kafscmd_dead);
out: out:
up_write(&afscm_sem); up_write(&afscm_sem);
return ret; return ret;
}
} /* end afscm_start() */
/*****************************************************************************/
/* /*
* stop the cache manager service * stop the cache manager service
*/ */
...@@ -394,10 +384,8 @@ void afscm_stop(void) ...@@ -394,10 +384,8 @@ void afscm_stop(void)
} }
up_write(&afscm_sem); up_write(&afscm_sem);
}
} /* end afscm_stop() */
/*****************************************************************************/
/* /*
* handle the fileserver breaking a set of callbacks * handle the fileserver breaking a set of callbacks
*/ */
...@@ -460,8 +448,7 @@ static void _SRXAFSCM_CallBack(struct rxrpc_call *call) ...@@ -460,8 +448,7 @@ static void _SRXAFSCM_CallBack(struct rxrpc_call *call)
pcb->version = ntohl(*bp++); pcb->version = ntohl(*bp++);
pcb->expiry = ntohl(*bp++); pcb->expiry = ntohl(*bp++);
pcb->type = ntohl(*bp++); pcb->type = ntohl(*bp++);
} } else {
else {
pcb->version = 0; pcb->version = 0;
pcb->expiry = 0; pcb->expiry = 0;
pcb->type = AFSCM_CB_UNTYPED; pcb->type = AFSCM_CB_UNTYPED;
...@@ -512,10 +499,8 @@ static void _SRXAFSCM_CallBack(struct rxrpc_call *call) ...@@ -512,10 +499,8 @@ static void _SRXAFSCM_CallBack(struct rxrpc_call *call)
afs_put_server(server); afs_put_server(server);
_leave(" = %d", ret); _leave(" = %d", ret);
}
} /* end _SRXAFSCM_CallBack() */
/*****************************************************************************/
/* /*
* handle the fileserver asking us to initialise our callback state * handle the fileserver asking us to initialise our callback state
*/ */
...@@ -580,10 +565,8 @@ static void _SRXAFSCM_InitCallBackState(struct rxrpc_call *call) ...@@ -580,10 +565,8 @@ static void _SRXAFSCM_InitCallBackState(struct rxrpc_call *call)
afs_put_server(server); afs_put_server(server);
_leave(" = %d", ret); _leave(" = %d", ret);
}
} /* end _SRXAFSCM_InitCallBackState() */
/*****************************************************************************/
/* /*
* handle a probe from a fileserver * handle a probe from a fileserver
*/ */
...@@ -648,5 +631,4 @@ static void _SRXAFSCM_Probe(struct rxrpc_call *call) ...@@ -648,5 +631,4 @@ static void _SRXAFSCM_Probe(struct rxrpc_call *call)
afs_put_server(server); afs_put_server(server);
_leave(" = %d", ret); _leave(" = %d", ret);
}
} /* end _SRXAFSCM_Probe() */
/* cmservice.h: AFS Cache Manager Service declarations /* AFS Cache Manager Service declarations
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#ifndef _LINUX_AFS_CMSERVICE_H #ifndef AFS_CMSERVICE_H
#define _LINUX_AFS_CMSERVICE_H #define AFS_CMSERVICE_H
#include <rxrpc/transport.h> #include <rxrpc/transport.h>
#include "types.h" #include "types.h"
...@@ -20,10 +20,9 @@ extern int afscm_start(void); ...@@ -20,10 +20,9 @@ extern int afscm_start(void);
extern void afscm_stop(void); extern void afscm_stop(void);
/* cache manager server functions */ /* cache manager server functions */
extern int SRXAFSCM_InitCallBackState(struct afs_server *server); extern int SRXAFSCM_InitCallBackState(struct afs_server *);
extern int SRXAFSCM_CallBack(struct afs_server *server, extern int SRXAFSCM_CallBack(struct afs_server *, size_t,
size_t count, struct afs_callback[]);
struct afs_callback callbacks[]); extern int SRXAFSCM_Probe(struct afs_server *);
extern int SRXAFSCM_Probe(struct afs_server *server);
#endif /* _LINUX_AFS_CMSERVICE_H */ #endif /* AFS_CMSERVICE_H */
...@@ -112,7 +112,6 @@ struct afs_dir_lookup_cookie { ...@@ -112,7 +112,6 @@ struct afs_dir_lookup_cookie {
int found; int found;
}; };
/*****************************************************************************/
/* /*
* check that a directory page is valid * check that a directory page is valid
*/ */
...@@ -157,13 +156,11 @@ static inline void afs_dir_check_page(struct inode *dir, struct page *page) ...@@ -157,13 +156,11 @@ static inline void afs_dir_check_page(struct inode *dir, struct page *page)
SetPageChecked(page); SetPageChecked(page);
return; return;
error: error:
SetPageChecked(page); SetPageChecked(page);
SetPageError(page); SetPageError(page);
}
} /* end afs_dir_check_page() */
/*****************************************************************************/
/* /*
* discard a page cached in the pagecache * discard a page cached in the pagecache
*/ */
...@@ -171,10 +168,8 @@ static inline void afs_dir_put_page(struct page *page) ...@@ -171,10 +168,8 @@ static inline void afs_dir_put_page(struct page *page)
{ {
kunmap(page); kunmap(page);
page_cache_release(page); page_cache_release(page);
}
} /* end afs_dir_put_page() */
/*****************************************************************************/
/* /*
* get a page into the pagecache * get a page into the pagecache
*/ */
...@@ -197,12 +192,11 @@ static struct page *afs_dir_get_page(struct inode *dir, unsigned long index) ...@@ -197,12 +192,11 @@ static struct page *afs_dir_get_page(struct inode *dir, unsigned long index)
} }
return page; return page;
fail: fail:
afs_dir_put_page(page); afs_dir_put_page(page);
return ERR_PTR(-EIO); return ERR_PTR(-EIO);
} /* end afs_dir_get_page() */ }
/*****************************************************************************/
/* /*
* open an AFS directory file * open an AFS directory file
*/ */
...@@ -218,10 +212,8 @@ static int afs_dir_open(struct inode *inode, struct file *file) ...@@ -218,10 +212,8 @@ static int afs_dir_open(struct inode *inode, struct file *file)
_leave(" = 0"); _leave(" = 0");
return 0; return 0;
}
} /* end afs_dir_open() */
/*****************************************************************************/
/* /*
* deal with one block in an AFS directory * deal with one block in an AFS directory
*/ */
...@@ -316,9 +308,8 @@ static int afs_dir_iterate_block(unsigned *fpos, ...@@ -316,9 +308,8 @@ static int afs_dir_iterate_block(unsigned *fpos,
_leave(" = 1 [more]"); _leave(" = 1 [more]");
return 1; return 1;
} /* end afs_dir_iterate_block() */ }
/*****************************************************************************/
/* /*
* read an AFS directory * read an AFS directory
*/ */
...@@ -377,12 +368,11 @@ static int afs_dir_iterate(struct inode *dir, unsigned *fpos, void *cookie, ...@@ -377,12 +368,11 @@ static int afs_dir_iterate(struct inode *dir, unsigned *fpos, void *cookie,
ret = 0; ret = 0;
} }
out: out:
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
} /* end afs_dir_iterate() */ }
/*****************************************************************************/
/* /*
* read an AFS directory * read an AFS directory
*/ */
...@@ -399,9 +389,8 @@ static int afs_dir_readdir(struct file *file, void *cookie, filldir_t filldir) ...@@ -399,9 +389,8 @@ static int afs_dir_readdir(struct file *file, void *cookie, filldir_t filldir)
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
} /* end afs_dir_readdir() */ }
/*****************************************************************************/
/* /*
* search the directory for a name * search the directory for a name
* - if afs_dir_iterate_block() spots this function, it'll pass the FID * - if afs_dir_iterate_block() spots this function, it'll pass the FID
...@@ -426,9 +415,8 @@ static int afs_dir_lookup_filldir(void *_cookie, const char *name, int nlen, ...@@ -426,9 +415,8 @@ static int afs_dir_lookup_filldir(void *_cookie, const char *name, int nlen,
_leave(" = -1 [found]"); _leave(" = -1 [found]");
return -1; return -1;
} /* end afs_dir_lookup_filldir() */ }
/*****************************************************************************/
/* /*
* look up an entry in a directory * look up an entry in a directory
*/ */
...@@ -498,9 +486,8 @@ static struct dentry *afs_dir_lookup(struct inode *dir, struct dentry *dentry, ...@@ -498,9 +486,8 @@ static struct dentry *afs_dir_lookup(struct inode *dir, struct dentry *dentry,
dentry->d_inode->i_version); dentry->d_inode->i_version);
return NULL; return NULL;
} /* end afs_dir_lookup() */ }
/*****************************************************************************/
/* /*
* check that a dentry lookup hit has found a valid entry * check that a dentry lookup hit has found a valid entry
* - NOTE! the hit can be a negative hit too, so we can't assume we have an * - NOTE! the hit can be a negative hit too, so we can't assume we have an
...@@ -605,18 +592,18 @@ static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd) ...@@ -605,18 +592,18 @@ static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
(void *) (unsigned long) AFS_FS_I(dir)->status.version; (void *) (unsigned long) AFS_FS_I(dir)->status.version;
} }
out_valid: out_valid:
dput(parent); dput(parent);
_leave(" = 1 [valid]"); _leave(" = 1 [valid]");
return 1; return 1;
/* the dirent, if it exists, now points to a different vnode */ /* the dirent, if it exists, now points to a different vnode */
not_found: not_found:
spin_lock(&dentry->d_lock); spin_lock(&dentry->d_lock);
dentry->d_flags |= DCACHE_NFSFS_RENAMED; dentry->d_flags |= DCACHE_NFSFS_RENAMED;
spin_unlock(&dentry->d_lock); spin_unlock(&dentry->d_lock);
out_bad: out_bad:
if (inode) { if (inode) {
/* don't unhash if we have submounts */ /* don't unhash if we have submounts */
if (have_submounts(dentry)) if (have_submounts(dentry))
...@@ -633,9 +620,8 @@ static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd) ...@@ -633,9 +620,8 @@ static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
_leave(" = 0 [bad]"); _leave(" = 0 [bad]");
return 0; return 0;
} /* end afs_d_revalidate() */ }
/*****************************************************************************/
/* /*
* allow the VFS to enquire as to whether a dentry should be unhashed (mustn't * allow the VFS to enquire as to whether a dentry should be unhashed (mustn't
* sleep) * sleep)
...@@ -657,7 +643,7 @@ static int afs_d_delete(struct dentry *dentry) ...@@ -657,7 +643,7 @@ static int afs_d_delete(struct dentry *dentry)
_leave(" = 0 [keep]"); _leave(" = 0 [keep]");
return 0; return 0;
zap: zap:
_leave(" = 1 [zap]"); _leave(" = 1 [zap]");
return 1; return 1;
} /* end afs_d_delete() */ }
/* errors.h: AFS abort/error codes /* AFS abort/error codes
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -9,12 +9,14 @@ ...@@ -9,12 +9,14 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#ifndef _LINUX_AFS_ERRORS_H #ifndef AFS_ERRORS_H
#define _LINUX_AFS_ERRORS_H #define AFS_ERRORS_H
#include "types.h" #include "types.h"
/* file server abort codes */ /*
* file server abort codes
*/
typedef enum { typedef enum {
VSALVAGE = 101, /* volume needs salvaging */ VSALVAGE = 101, /* volume needs salvaging */
VNOVNODE = 102, /* no such file/dir (vnode) */ VNOVNODE = 102, /* no such file/dir (vnode) */
...@@ -29,6 +31,6 @@ typedef enum { ...@@ -29,6 +31,6 @@ typedef enum {
VMOVED = 111, /* volume moved to new server - ask this FS where */ VMOVED = 111, /* volume moved to new server - ask this FS where */
} afs_rxfs_abort_t; } afs_rxfs_abort_t;
extern int afs_abort_to_error(int abortcode); extern int afs_abort_to_error(int);
#endif /* _LINUX_AFS_ERRORS_H */ #endif /* AFS_ERRORS_H */
...@@ -40,7 +40,6 @@ const struct address_space_operations afs_fs_aops = { ...@@ -40,7 +40,6 @@ const struct address_space_operations afs_fs_aops = {
.invalidatepage = afs_file_invalidatepage, .invalidatepage = afs_file_invalidatepage,
}; };
/*****************************************************************************/
/* /*
* deal with notification that a page was read from the cache * deal with notification that a page was read from the cache
*/ */
...@@ -58,10 +57,9 @@ static void afs_file_readpage_read_complete(void *cookie_data, ...@@ -58,10 +57,9 @@ static void afs_file_readpage_read_complete(void *cookie_data,
SetPageUptodate(page); SetPageUptodate(page);
unlock_page(page); unlock_page(page);
} /* end afs_file_readpage_read_complete() */ }
#endif #endif
/*****************************************************************************/
/* /*
* deal with notification that a page was written to the cache * deal with notification that a page was written to the cache
*/ */
...@@ -74,11 +72,9 @@ static void afs_file_readpage_write_complete(void *cookie_data, ...@@ -74,11 +72,9 @@ static void afs_file_readpage_write_complete(void *cookie_data,
_enter("%p,%p,%p,%d", cookie_data, page, data, error); _enter("%p,%p,%p,%d", cookie_data, page, data, error);
unlock_page(page); unlock_page(page);
}
} /* end afs_file_readpage_write_complete() */
#endif #endif
/*****************************************************************************/
/* /*
* AFS read page from file (or symlink) * AFS read page from file (or symlink)
*/ */
...@@ -184,10 +180,8 @@ static int afs_file_readpage(struct file *file, struct page *page) ...@@ -184,10 +180,8 @@ static int afs_file_readpage(struct file *file, struct page *page)
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
}
} /* end afs_file_readpage() */
/*****************************************************************************/
/* /*
* get a page cookie for the specified page * get a page cookie for the specified page
*/ */
...@@ -202,10 +196,9 @@ int afs_cache_get_page_cookie(struct page *page, ...@@ -202,10 +196,9 @@ int afs_cache_get_page_cookie(struct page *page,
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
} /* end afs_cache_get_page_cookie() */ }
#endif #endif
/*****************************************************************************/
/* /*
* invalidate part or all of a page * invalidate part or all of a page
*/ */
...@@ -240,9 +233,8 @@ static void afs_file_invalidatepage(struct page *page, unsigned long offset) ...@@ -240,9 +233,8 @@ static void afs_file_invalidatepage(struct page *page, unsigned long offset)
} }
_leave(" = %d", ret); _leave(" = %d", ret);
} /* end afs_file_invalidatepage() */ }
/*****************************************************************************/
/* /*
* release a page and cleanup its private data * release a page and cleanup its private data
*/ */
...@@ -267,4 +259,4 @@ static int afs_file_releasepage(struct page *page, gfp_t gfp_flags) ...@@ -267,4 +259,4 @@ static int afs_file_releasepage(struct page *page, gfp_t gfp_flags)
_leave(" = 0"); _leave(" = 0");
return 0; return 0;
} /* end afs_file_releasepage() */ }
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#define FSGETROOTVOLUME 151 /* AFS Get root volume name */ #define FSGETROOTVOLUME 151 /* AFS Get root volume name */
#define FSLOOKUP 161 /* AFS lookup file in directory */ #define FSLOOKUP 161 /* AFS lookup file in directory */
/*****************************************************************************/
/* /*
* map afs abort codes to/from Linux error codes * map afs abort codes to/from Linux error codes
* - called with call->lock held * - called with call->lock held
...@@ -46,9 +45,8 @@ static void afs_rxfs_aemap(struct rxrpc_call *call) ...@@ -46,9 +45,8 @@ static void afs_rxfs_aemap(struct rxrpc_call *call)
default: default:
break; break;
} }
} /* end afs_rxfs_aemap() */ }
/*****************************************************************************/
/* /*
* get the root volume name from a fileserver * get the root volume name from a fileserver
* - this operation doesn't seem to work correctly in OpenAFS server 1.2.2 * - this operation doesn't seem to work correctly in OpenAFS server 1.2.2
...@@ -162,23 +160,22 @@ int afs_rxfs_get_root_volume(struct afs_server *server, ...@@ -162,23 +160,22 @@ int afs_rxfs_get_root_volume(struct afs_server *server,
BUG(); BUG();
} }
abort: abort:
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
rxrpc_call_abort(call, ret); rxrpc_call_abort(call, ret);
schedule(); schedule();
out_unwait: out_unwait:
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
remove_wait_queue(&call->waitq, &myself); remove_wait_queue(&call->waitq, &myself);
rxrpc_put_call(call); rxrpc_put_call(call);
out_put_conn: out_put_conn:
afs_server_release_fsconn(server, conn); afs_server_release_fsconn(server, conn);
out: out:
kleave(""); kleave("");
return ret; return ret;
} /* end afs_rxfs_get_root_volume() */ }
#endif #endif
/*****************************************************************************/
/* /*
* get information about a volume * get information about a volume
*/ */
...@@ -275,26 +272,24 @@ int afs_rxfs_get_volume_info(struct afs_server *server, ...@@ -275,26 +272,24 @@ int afs_rxfs_get_volume_info(struct afs_server *server,
/* success */ /* success */
ret = 0; ret = 0;
out_unwait: out_unwait:
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
remove_wait_queue(&call->waitq, &myself); remove_wait_queue(&call->waitq, &myself);
rxrpc_put_call(call); rxrpc_put_call(call);
out_put_conn: out_put_conn:
afs_server_release_fsconn(server, conn); afs_server_release_fsconn(server, conn);
out: out:
_leave(""); _leave("");
return ret; return ret;
abort: abort:
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
rxrpc_call_abort(call, ret); rxrpc_call_abort(call, ret);
schedule(); schedule();
goto out_unwait; goto out_unwait;
}
} /* end afs_rxfs_get_volume_info() */
#endif #endif
/*****************************************************************************/
/* /*
* fetch the status information for a file * fetch the status information for a file
*/ */
...@@ -401,24 +396,23 @@ int afs_rxfs_fetch_file_status(struct afs_server *server, ...@@ -401,24 +396,23 @@ int afs_rxfs_fetch_file_status(struct afs_server *server,
/* success */ /* success */
ret = 0; ret = 0;
out_unwait: out_unwait:
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
remove_wait_queue(&call->waitq, &myself); remove_wait_queue(&call->waitq, &myself);
rxrpc_put_call(call); rxrpc_put_call(call);
out_put_conn: out_put_conn:
afs_server_release_callslot(server, &callslot); afs_server_release_callslot(server, &callslot);
out: out:
_leave(""); _leave("");
return ret; return ret;
abort: abort:
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
rxrpc_call_abort(call, ret); rxrpc_call_abort(call, ret);
schedule(); schedule();
goto out_unwait; goto out_unwait;
} /* end afs_rxfs_fetch_file_status() */ }
/*****************************************************************************/
/* /*
* fetch the contents of a file or directory * fetch the contents of a file or directory
*/ */
...@@ -547,31 +541,29 @@ int afs_rxfs_fetch_file_data(struct afs_server *server, ...@@ -547,31 +541,29 @@ int afs_rxfs_fetch_file_data(struct afs_server *server,
/* success */ /* success */
ret = 0; ret = 0;
out_unwait: out_unwait:
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
remove_wait_queue(&call->waitq,&myself); remove_wait_queue(&call->waitq,&myself);
rxrpc_put_call(call); rxrpc_put_call(call);
out_put_conn: out_put_conn:
afs_server_release_callslot(server, &callslot); afs_server_release_callslot(server, &callslot);
out: out:
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
read_failed: read_failed:
if (ret == -ECONNABORTED) { if (ret == -ECONNABORTED) {
ret = call->app_errno; ret = call->app_errno;
goto out_unwait; goto out_unwait;
} }
abort: abort:
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
rxrpc_call_abort(call, ret); rxrpc_call_abort(call, ret);
schedule(); schedule();
goto out_unwait; goto out_unwait;
}
} /* end afs_rxfs_fetch_file_data() */
/*****************************************************************************/
/* /*
* ask the AFS fileserver to discard a callback request on a file * ask the AFS fileserver to discard a callback request on a file
*/ */
...@@ -655,24 +647,23 @@ int afs_rxfs_give_up_callback(struct afs_server *server, ...@@ -655,24 +647,23 @@ int afs_rxfs_give_up_callback(struct afs_server *server,
BUG(); BUG();
} }
out_unwait: out_unwait:
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
remove_wait_queue(&call->waitq, &myself); remove_wait_queue(&call->waitq, &myself);
rxrpc_put_call(call); rxrpc_put_call(call);
out_put_conn: out_put_conn:
afs_server_release_callslot(server, &callslot); afs_server_release_callslot(server, &callslot);
out: out:
_leave(""); _leave("");
return ret; return ret;
abort: abort:
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
rxrpc_call_abort(call, ret); rxrpc_call_abort(call, ret);
schedule(); schedule();
goto out_unwait; goto out_unwait;
} /* end afs_rxfs_give_up_callback() */ }
/*****************************************************************************/
/* /*
* look a filename up in a directory * look a filename up in a directory
* - this operation doesn't seem to work correctly in OpenAFS server 1.2.2 * - this operation doesn't seem to work correctly in OpenAFS server 1.2.2
...@@ -818,20 +809,20 @@ int afs_rxfs_lookup(struct afs_server *server, ...@@ -818,20 +809,20 @@ int afs_rxfs_lookup(struct afs_server *server,
/* success */ /* success */
ret = 0; ret = 0;
out_unwait: out_unwait:
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
remove_wait_queue(&call->waitq, &myself); remove_wait_queue(&call->waitq, &myself);
rxrpc_put_call(call); rxrpc_put_call(call);
out_put_conn: out_put_conn:
afs_server_release_fsconn(server, conn); afs_server_release_fsconn(server, conn);
out: out:
kleave(""); kleave("");
return ret; return ret;
abort: abort:
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
rxrpc_call_abort(call, ret); rxrpc_call_abort(call, ret);
schedule(); schedule();
goto out_unwait; goto out_unwait;
} /* end afs_rxfs_lookup() */ }
#endif #endif
/* fsclient.h: AFS File Server client stub declarations /* AFS File Server client stub declarations
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -9,18 +9,18 @@ ...@@ -9,18 +9,18 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#ifndef _LINUX_AFS_FSCLIENT_H #ifndef AFS_FSCLIENT_H
#define _LINUX_AFS_FSCLIENT_H #define AFS_FSCLIENT_H
#include "server.h" #include "server.h"
extern int afs_rxfs_get_volume_info(struct afs_server *server, extern int afs_rxfs_get_volume_info(struct afs_server *,
const char *name, const char *,
struct afs_volume_info *vinfo); struct afs_volume_info *);
extern int afs_rxfs_fetch_file_status(struct afs_server *server, extern int afs_rxfs_fetch_file_status(struct afs_server *,
struct afs_vnode *vnode, struct afs_vnode *,
struct afs_volsync *volsync); struct afs_volsync *);
struct afs_rxfs_fetch_descriptor { struct afs_rxfs_fetch_descriptor {
struct afs_fid fid; /* file ID to fetch */ struct afs_fid fid; /* file ID to fetch */
...@@ -30,25 +30,25 @@ struct afs_rxfs_fetch_descriptor { ...@@ -30,25 +30,25 @@ struct afs_rxfs_fetch_descriptor {
size_t actual; /* actual size sent back by server */ size_t actual; /* actual size sent back by server */
}; };
extern int afs_rxfs_fetch_file_data(struct afs_server *server, extern int afs_rxfs_fetch_file_data(struct afs_server *,
struct afs_vnode *vnode, struct afs_vnode *,
struct afs_rxfs_fetch_descriptor *desc, struct afs_rxfs_fetch_descriptor *,
struct afs_volsync *volsync); struct afs_volsync *);
extern int afs_rxfs_give_up_callback(struct afs_server *server, extern int afs_rxfs_give_up_callback(struct afs_server *,
struct afs_vnode *vnode); struct afs_vnode *);
/* this doesn't appear to work in OpenAFS server */ /* this doesn't appear to work in OpenAFS server */
extern int afs_rxfs_lookup(struct afs_server *server, extern int afs_rxfs_lookup(struct afs_server *,
struct afs_vnode *dir, struct afs_vnode *,
const char *filename, const char *,
struct afs_vnode *vnode, struct afs_vnode *,
struct afs_volsync *volsync); struct afs_volsync *);
/* this is apparently mis-implemented in OpenAFS server */ /* this is apparently mis-implemented in OpenAFS server */
extern int afs_rxfs_get_root_volume(struct afs_server *server, extern int afs_rxfs_get_root_volume(struct afs_server *,
char *buf, char *,
size_t *buflen); size_t *);
#endif /* _LINUX_AFS_FSCLIENT_H */ #endif /* AFS_FSCLIENT_H */
...@@ -29,7 +29,6 @@ struct afs_iget_data { ...@@ -29,7 +29,6 @@ struct afs_iget_data {
struct afs_volume *volume; /* volume on which resides */ struct afs_volume *volume; /* volume on which resides */
}; };
/*****************************************************************************/
/* /*
* map the AFS file status to the inode member variables * map the AFS file status to the inode member variables
*/ */
...@@ -87,9 +86,8 @@ static int afs_inode_map_status(struct afs_vnode *vnode) ...@@ -87,9 +86,8 @@ static int afs_inode_map_status(struct afs_vnode *vnode)
} }
return 0; return 0;
} /* end afs_inode_map_status() */ }
/*****************************************************************************/
/* /*
* attempt to fetch the status of an inode, coelescing multiple simultaneous * attempt to fetch the status of an inode, coelescing multiple simultaneous
* fetches * fetches
...@@ -107,10 +105,8 @@ static int afs_inode_fetch_status(struct inode *inode) ...@@ -107,10 +105,8 @@ static int afs_inode_fetch_status(struct inode *inode)
ret = afs_inode_map_status(vnode); ret = afs_inode_map_status(vnode);
return ret; return ret;
}
} /* end afs_inode_fetch_status() */
/*****************************************************************************/
/* /*
* iget5() comparator * iget5() comparator
*/ */
...@@ -120,9 +116,8 @@ static int afs_iget5_test(struct inode *inode, void *opaque) ...@@ -120,9 +116,8 @@ static int afs_iget5_test(struct inode *inode, void *opaque)
return inode->i_ino == data->fid.vnode && return inode->i_ino == data->fid.vnode &&
inode->i_version == data->fid.unique; inode->i_version == data->fid.unique;
} /* end afs_iget5_test() */ }
/*****************************************************************************/
/* /*
* iget5() inode initialiser * iget5() inode initialiser
*/ */
...@@ -137,9 +132,8 @@ static int afs_iget5_set(struct inode *inode, void *opaque) ...@@ -137,9 +132,8 @@ static int afs_iget5_set(struct inode *inode, void *opaque)
vnode->volume = data->volume; vnode->volume = data->volume;
return 0; return 0;
} /* end afs_iget5_set() */ }
/*****************************************************************************/
/* /*
* inode retrieval * inode retrieval
*/ */
...@@ -169,7 +163,7 @@ inline int afs_iget(struct super_block *sb, struct afs_fid *fid, ...@@ -169,7 +163,7 @@ inline int afs_iget(struct super_block *sb, struct afs_fid *fid,
/* deal with an existing inode */ /* deal with an existing inode */
if (!(inode->i_state & I_NEW)) { if (!(inode->i_state & I_NEW)) {
ret = afs_vnode_fetch_status(vnode); ret = afs_vnode_fetch_status(vnode);
if (ret==0) if (ret == 0)
*_inode = inode; *_inode = inode;
else else
iput(inode); iput(inode);
...@@ -204,16 +198,15 @@ inline int afs_iget(struct super_block *sb, struct afs_fid *fid, ...@@ -204,16 +198,15 @@ inline int afs_iget(struct super_block *sb, struct afs_fid *fid,
return 0; return 0;
/* failure */ /* failure */
bad_inode: bad_inode:
make_bad_inode(inode); make_bad_inode(inode);
unlock_new_inode(inode); unlock_new_inode(inode);
iput(inode); iput(inode);
_leave(" = %d [bad]", ret); _leave(" = %d [bad]", ret);
return ret; return ret;
} /* end afs_iget() */ }
/*****************************************************************************/
/* /*
* read the attributes of an inode * read the attributes of an inode
*/ */
...@@ -235,8 +228,7 @@ int afs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry, ...@@ -235,8 +228,7 @@ int afs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry,
_leave(" = %d [%d %p]", _leave(" = %d [%d %p]",
ret, atomic_read(&dentry->d_count), dentry->d_inode); ret, atomic_read(&dentry->d_count), dentry->d_inode);
return ret; return ret;
} } else if (ret < 0) {
else if (ret < 0) {
make_bad_inode(inode); make_bad_inode(inode);
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
...@@ -252,9 +244,8 @@ int afs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry, ...@@ -252,9 +244,8 @@ int afs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry,
vnode->cb_type); vnode->cb_type);
return 0; return 0;
} /* end afs_inode_getattr() */ }
/*****************************************************************************/
/* /*
* clear an AFS inode * clear an AFS inode
*/ */
...@@ -282,4 +273,4 @@ void afs_clear_inode(struct inode *inode) ...@@ -282,4 +273,4 @@ void afs_clear_inode(struct inode *inode)
#endif #endif
_leave(""); _leave("");
} /* end afs_clear_inode() */ }
/* internal.h: internal AFS stuff /* internal AFS stuff
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -73,26 +73,16 @@ extern const struct address_space_operations afs_fs_aops; ...@@ -73,26 +73,16 @@ extern const struct address_space_operations afs_fs_aops;
extern const struct inode_operations afs_file_inode_operations; extern const struct inode_operations afs_file_inode_operations;
#ifdef AFS_CACHING_SUPPORT #ifdef AFS_CACHING_SUPPORT
extern int afs_cache_get_page_cookie(struct page *page, extern int afs_cache_get_page_cookie(struct page *, struct cachefs_page **);
struct cachefs_page **_page_cookie);
#endif #endif
/* /*
* inode.c * inode.c
*/ */
extern int afs_iget(struct super_block *sb, struct afs_fid *fid, extern int afs_iget(struct super_block *, struct afs_fid *, struct inode **);
struct inode **_inode); extern int afs_inode_getattr(struct vfsmount *, struct dentry *,
extern int afs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *);
struct kstat *stat); extern void afs_clear_inode(struct inode *);
extern void afs_clear_inode(struct inode *inode);
/*
* key_afs.c
*/
#ifdef CONFIG_KEYS
extern int afs_key_register(void);
extern void afs_key_unregister(void);
#endif
/* /*
* main.c * main.c
...@@ -110,7 +100,7 @@ extern struct afs_timer afs_mntpt_expiry_timer; ...@@ -110,7 +100,7 @@ extern struct afs_timer afs_mntpt_expiry_timer;
extern struct afs_timer_ops afs_mntpt_expiry_timer_ops; extern struct afs_timer_ops afs_mntpt_expiry_timer_ops;
extern unsigned long afs_mntpt_expiry_timeout; extern unsigned long afs_mntpt_expiry_timeout;
extern int afs_mntpt_check_symlink(struct afs_vnode *vnode); extern int afs_mntpt_check_symlink(struct afs_vnode *);
/* /*
* super.c * super.c
...@@ -123,17 +113,17 @@ extern void afs_fs_exit(void); ...@@ -123,17 +113,17 @@ extern void afs_fs_exit(void);
extern struct list_head afs_cb_hash_tbl[]; extern struct list_head afs_cb_hash_tbl[];
extern spinlock_t afs_cb_hash_lock; extern spinlock_t afs_cb_hash_lock;
#define afs_cb_hash(SRV,FID) \ #define afs_cb_hash(SRV, FID) \
afs_cb_hash_tbl[((unsigned long)(SRV) + \ afs_cb_hash_tbl[((unsigned long)(SRV) + \
(FID)->vid + (FID)->vnode + (FID)->unique) % \ (FID)->vid + (FID)->vnode + (FID)->unique) & \
AFS_CB_HASH_COUNT] (AFS_CB_HASH_COUNT - 1)]
/* /*
* proc.c * proc.c
*/ */
extern int afs_proc_init(void); extern int afs_proc_init(void);
extern void afs_proc_cleanup(void); extern void afs_proc_cleanup(void);
extern int afs_proc_cell_setup(struct afs_cell *cell); extern int afs_proc_cell_setup(struct afs_cell *);
extern void afs_proc_cell_remove(struct afs_cell *cell); extern void afs_proc_cell_remove(struct afs_cell *);
#endif /* AFS_INTERNAL_H */ #endif /* AFS_INTERNAL_H */
/* kafsasyncd.c: AFS asynchronous operation daemon /* AFS asynchronous operation daemon
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -50,7 +50,6 @@ static void kafsasyncd_null_call_error_func(struct rxrpc_call *call) ...@@ -50,7 +50,6 @@ static void kafsasyncd_null_call_error_func(struct rxrpc_call *call)
{ {
} }
/*****************************************************************************/
/* /*
* start the async daemon * start the async daemon
*/ */
...@@ -65,9 +64,8 @@ int afs_kafsasyncd_start(void) ...@@ -65,9 +64,8 @@ int afs_kafsasyncd_start(void)
wait_for_completion(&kafsasyncd_alive); wait_for_completion(&kafsasyncd_alive);
return ret; return ret;
} /* end afs_kafsasyncd_start() */ }
/*****************************************************************************/
/* /*
* stop the async daemon * stop the async daemon
*/ */
...@@ -77,10 +75,8 @@ void afs_kafsasyncd_stop(void) ...@@ -77,10 +75,8 @@ void afs_kafsasyncd_stop(void)
kafsasyncd_die = 1; kafsasyncd_die = 1;
wake_up(&kafsasyncd_sleepq); wake_up(&kafsasyncd_sleepq);
wait_for_completion(&kafsasyncd_dead); wait_for_completion(&kafsasyncd_dead);
}
} /* end afs_kafsasyncd_stop() */
/*****************************************************************************/
/* /*
* probing daemon * probing daemon
*/ */
...@@ -187,10 +183,8 @@ static int kafsasyncd(void *arg) ...@@ -187,10 +183,8 @@ static int kafsasyncd(void *arg)
/* and that's all */ /* and that's all */
_leave(""); _leave("");
complete_and_exit(&kafsasyncd_dead, 0); complete_and_exit(&kafsasyncd_dead, 0);
}
} /* end kafsasyncd() */
/*****************************************************************************/
/* /*
* begin an operation * begin an operation
* - place operation on busy queue * - place operation on busy queue
...@@ -209,9 +203,8 @@ void afs_kafsasyncd_begin_op(struct afs_async_op *op) ...@@ -209,9 +203,8 @@ void afs_kafsasyncd_begin_op(struct afs_async_op *op)
spin_unlock(&kafsasyncd_async_lock); spin_unlock(&kafsasyncd_async_lock);
_leave(""); _leave("");
} /* end afs_kafsasyncd_begin_op() */ }
/*****************************************************************************/
/* /*
* request attention for an operation * request attention for an operation
* - move to attention queue * - move to attention queue
...@@ -229,9 +222,8 @@ void afs_kafsasyncd_attend_op(struct afs_async_op *op) ...@@ -229,9 +222,8 @@ void afs_kafsasyncd_attend_op(struct afs_async_op *op)
wake_up(&kafsasyncd_sleepq); wake_up(&kafsasyncd_sleepq);
_leave(""); _leave("");
} /* end afs_kafsasyncd_attend_op() */ }
/*****************************************************************************/
/* /*
* terminate an operation * terminate an operation
* - remove from either queue * - remove from either queue
...@@ -252,4 +244,4 @@ void afs_kafsasyncd_terminate_op(struct afs_async_op *op) ...@@ -252,4 +244,4 @@ void afs_kafsasyncd_terminate_op(struct afs_async_op *op)
wake_up(&kafsasyncd_sleepq); wake_up(&kafsasyncd_sleepq);
_leave(""); _leave("");
} /* end afs_kafsasyncd_terminate_op() */ }
/* kafsasyncd.h: AFS asynchronous operation daemon /* AFS asynchronous operation daemon
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -9,24 +9,22 @@ ...@@ -9,24 +9,22 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#ifndef _LINUX_AFS_KAFSASYNCD_H #ifndef AFS_KAFSASYNCD_H
#define _LINUX_AFS_KAFSASYNCD_H #define AFS_KAFSASYNCD_H
#include "types.h" #include "types.h"
struct afs_async_op; struct afs_async_op;
struct afs_async_op_ops { struct afs_async_op_ops {
void (*attend)(struct afs_async_op *op); void (*attend)(struct afs_async_op *);
void (*discard)(struct afs_async_op *op); void (*discard)(struct afs_async_op *);
}; };
/*****************************************************************************/
/* /*
* asynchronous operation record * asynchronous operation record
*/ */
struct afs_async_op struct afs_async_op {
{
struct list_head link; struct list_head link;
struct afs_server *server; /* server being contacted */ struct afs_server *server; /* server being contacted */
struct rxrpc_call *call; /* RxRPC call performing op */ struct rxrpc_call *call; /* RxRPC call performing op */
...@@ -45,8 +43,8 @@ static inline void afs_async_op_init(struct afs_async_op *op, ...@@ -45,8 +43,8 @@ static inline void afs_async_op_init(struct afs_async_op *op,
extern int afs_kafsasyncd_start(void); extern int afs_kafsasyncd_start(void);
extern void afs_kafsasyncd_stop(void); extern void afs_kafsasyncd_stop(void);
extern void afs_kafsasyncd_begin_op(struct afs_async_op *op); extern void afs_kafsasyncd_begin_op(struct afs_async_op *);
extern void afs_kafsasyncd_attend_op(struct afs_async_op *op); extern void afs_kafsasyncd_attend_op(struct afs_async_op *);
extern void afs_kafsasyncd_terminate_op(struct afs_async_op *op); extern void afs_kafsasyncd_terminate_op(struct afs_async_op *);
#endif /* _LINUX_AFS_KAFSASYNCD_H */ #endif /* AFS_KAFSASYNCD_H */
/* kafstimod.c: AFS timeout daemon /* AFS timeout daemon
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -30,7 +30,6 @@ static DEFINE_SPINLOCK(kafstimod_lock); ...@@ -30,7 +30,6 @@ static DEFINE_SPINLOCK(kafstimod_lock);
static int kafstimod(void *arg); static int kafstimod(void *arg);
/*****************************************************************************/
/* /*
* start the timeout daemon * start the timeout daemon
*/ */
...@@ -45,9 +44,8 @@ int afs_kafstimod_start(void) ...@@ -45,9 +44,8 @@ int afs_kafstimod_start(void)
wait_for_completion(&kafstimod_alive); wait_for_completion(&kafstimod_alive);
return ret; return ret;
} /* end afs_kafstimod_start() */ }
/*****************************************************************************/
/* /*
* stop the timeout daemon * stop the timeout daemon
*/ */
...@@ -57,10 +55,8 @@ void afs_kafstimod_stop(void) ...@@ -57,10 +55,8 @@ void afs_kafstimod_stop(void)
kafstimod_die = 1; kafstimod_die = 1;
wake_up(&kafstimod_sleepq); wake_up(&kafstimod_sleepq);
wait_for_completion(&kafstimod_dead); wait_for_completion(&kafstimod_dead);
}
} /* end afs_kafstimod_stop() */
/*****************************************************************************/
/* /*
* timeout processing daemon * timeout processing daemon
*/ */
...@@ -77,7 +73,7 @@ static int kafstimod(void *arg) ...@@ -77,7 +73,7 @@ static int kafstimod(void *arg)
complete(&kafstimod_alive); complete(&kafstimod_alive);
/* loop around looking for things to attend to */ /* loop around looking for things to attend to */
loop: loop:
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&kafstimod_sleepq, &myself); add_wait_queue(&kafstimod_sleepq, &myself);
...@@ -101,8 +97,7 @@ static int kafstimod(void *arg) ...@@ -101,8 +97,7 @@ static int kafstimod(void *arg)
spin_lock(&kafstimod_lock); spin_lock(&kafstimod_lock);
if (list_empty(&kafstimod_list)) { if (list_empty(&kafstimod_list)) {
timeout = MAX_SCHEDULE_TIMEOUT; timeout = MAX_SCHEDULE_TIMEOUT;
} } else {
else {
timer = list_entry(kafstimod_list.next, timer = list_entry(kafstimod_list.next,
struct afs_timer, link); struct afs_timer, link);
timeout = timer->timo_jif; timeout = timer->timo_jif;
...@@ -110,10 +105,7 @@ static int kafstimod(void *arg) ...@@ -110,10 +105,7 @@ static int kafstimod(void *arg)
if (time_before_eq((unsigned long) timeout, jif)) if (time_before_eq((unsigned long) timeout, jif))
goto immediate; goto immediate;
timeout = (long) timeout - (long) jiffies;
else {
timeout = (long) timeout - (long) jiffies;
}
} }
spin_unlock(&kafstimod_lock); spin_unlock(&kafstimod_lock);
...@@ -126,7 +118,7 @@ static int kafstimod(void *arg) ...@@ -126,7 +118,7 @@ static int kafstimod(void *arg)
* - we come here with the lock held and timer pointing to the expired * - we come here with the lock held and timer pointing to the expired
* entry * entry
*/ */
immediate: immediate:
remove_wait_queue(&kafstimod_sleepq, &myself); remove_wait_queue(&kafstimod_sleepq, &myself);
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
...@@ -141,10 +133,8 @@ static int kafstimod(void *arg) ...@@ -141,10 +133,8 @@ static int kafstimod(void *arg)
_debug("@@@ End Timeout"); _debug("@@@ End Timeout");
goto loop; goto loop;
}
} /* end kafstimod() */
/*****************************************************************************/
/* /*
* (re-)queue a timer * (re-)queue a timer
*/ */
...@@ -176,9 +166,8 @@ void afs_kafstimod_add_timer(struct afs_timer *timer, unsigned long timeout) ...@@ -176,9 +166,8 @@ void afs_kafstimod_add_timer(struct afs_timer *timer, unsigned long timeout)
wake_up(&kafstimod_sleepq); wake_up(&kafstimod_sleepq);
_leave(""); _leave("");
} /* end afs_kafstimod_add_timer() */ }
/*****************************************************************************/
/* /*
* dequeue a timer * dequeue a timer
* - returns 0 if the timer was deleted or -ENOENT if it wasn't queued * - returns 0 if the timer was deleted or -ENOENT if it wasn't queued
...@@ -202,4 +191,4 @@ int afs_kafstimod_del_timer(struct afs_timer *timer) ...@@ -202,4 +191,4 @@ int afs_kafstimod_del_timer(struct afs_timer *timer)
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
} /* end afs_kafstimod_del_timer() */ }
/* kafstimod.h: AFS timeout daemon /* AFS timeout daemon
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#ifndef _LINUX_AFS_KAFSTIMOD_H #ifndef AFS_KAFSTIMOD_H
#define _LINUX_AFS_KAFSTIMOD_H #define AFS_KAFSTIMOD_H
#include "types.h" #include "types.h"
...@@ -18,15 +18,13 @@ struct afs_timer; ...@@ -18,15 +18,13 @@ struct afs_timer;
struct afs_timer_ops { struct afs_timer_ops {
/* called when the front of the timer queue has timed out */ /* called when the front of the timer queue has timed out */
void (*timed_out)(struct afs_timer *timer); void (*timed_out)(struct afs_timer *);
}; };
/*****************************************************************************/
/* /*
* AFS timer/timeout record * AFS timer/timeout record
*/ */
struct afs_timer struct afs_timer {
{
struct list_head link; /* link in timer queue */ struct list_head link; /* link in timer queue */
unsigned long timo_jif; /* timeout time */ unsigned long timo_jif; /* timeout time */
const struct afs_timer_ops *ops; /* timeout expiry function */ const struct afs_timer_ops *ops; /* timeout expiry function */
...@@ -41,9 +39,7 @@ static inline void afs_timer_init(struct afs_timer *timer, ...@@ -41,9 +39,7 @@ static inline void afs_timer_init(struct afs_timer *timer,
extern int afs_kafstimod_start(void); extern int afs_kafstimod_start(void);
extern void afs_kafstimod_stop(void); extern void afs_kafstimod_stop(void);
extern void afs_kafstimod_add_timer(struct afs_timer *, unsigned long);
extern int afs_kafstimod_del_timer(struct afs_timer *);
extern void afs_kafstimod_add_timer(struct afs_timer *timer, #endif /* AFS_KAFSTIMOD_H */
unsigned long timeout);
extern int afs_kafstimod_del_timer(struct afs_timer *timer);
#endif /* _LINUX_AFS_KAFSTIMOD_H */
/* main.c: AFS client file system /* AFS client file system
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -62,7 +62,6 @@ struct cachefs_netfs afs_cache_netfs = { ...@@ -62,7 +62,6 @@ struct cachefs_netfs afs_cache_netfs = {
}; };
#endif #endif
/*****************************************************************************/
/* /*
* initialise the AFS client FS module * initialise the AFS client FS module
*/ */
...@@ -86,12 +85,6 @@ static int __init afs_init(void) ...@@ -86,12 +85,6 @@ static int __init afs_init(void)
/* we want to be able to cache */ /* we want to be able to cache */
ret = cachefs_register_netfs(&afs_cache_netfs, ret = cachefs_register_netfs(&afs_cache_netfs,
&afs_cache_cell_index_def); &afs_cache_cell_index_def);
if (ret < 0)
goto error;
#endif
#ifdef CONFIG_KEYS_TURNED_OFF
ret = afs_key_register();
if (ret < 0) if (ret < 0)
goto error_cache; goto error_cache;
#endif #endif
...@@ -99,58 +92,55 @@ static int __init afs_init(void) ...@@ -99,58 +92,55 @@ static int __init afs_init(void)
/* initialise the cell DB */ /* initialise the cell DB */
ret = afs_cell_init(rootcell); ret = afs_cell_init(rootcell);
if (ret < 0) if (ret < 0)
goto error_keys; goto error_cell_init;
/* start the timeout daemon */ /* start the timeout daemon */
ret = afs_kafstimod_start(); ret = afs_kafstimod_start();
if (ret < 0) if (ret < 0)
goto error_keys; goto error_kafstimod;
/* start the async operation daemon */ /* start the async operation daemon */
ret = afs_kafsasyncd_start(); ret = afs_kafsasyncd_start();
if (ret < 0) if (ret < 0)
goto error_kafstimod; goto error_kafsasyncd;
/* create the RxRPC transport */ /* create the RxRPC transport */
ret = rxrpc_create_transport(7001, &afs_transport); ret = rxrpc_create_transport(7001, &afs_transport);
if (ret < 0) if (ret < 0)
goto error_kafsasyncd; goto error_transport;
afs_transport->peer_ops = &afs_peer_ops; afs_transport->peer_ops = &afs_peer_ops;
/* register the filesystems */ /* register the filesystems */
ret = afs_fs_init(); ret = afs_fs_init();
if (ret < 0) if (ret < 0)
goto error_transport; goto error_fs;
return ret; return ret;
error_transport: error_fs:
rxrpc_put_transport(afs_transport); rxrpc_put_transport(afs_transport);
error_kafsasyncd: error_transport:
afs_kafsasyncd_stop(); afs_kafsasyncd_stop();
error_kafstimod: error_kafsasyncd:
afs_kafstimod_stop(); afs_kafstimod_stop();
error_keys: error_kafstimod:
#ifdef CONFIG_KEYS_TURNED_OFF error_cell_init:
afs_key_unregister();
error_cache:
#endif
#ifdef AFS_CACHING_SUPPORT #ifdef AFS_CACHING_SUPPORT
cachefs_unregister_netfs(&afs_cache_netfs); cachefs_unregister_netfs(&afs_cache_netfs);
error: error_cache:
#endif #endif
afs_cell_purge(); afs_cell_purge();
afs_proc_cleanup(); afs_proc_cleanup();
printk(KERN_ERR "kAFS: failed to register: %d\n", ret); printk(KERN_ERR "kAFS: failed to register: %d\n", ret);
return ret; return ret;
} /* end afs_init() */ }
/* XXX late_initcall is kludgy, but the only alternative seems to create /* XXX late_initcall is kludgy, but the only alternative seems to create
* a transport upon the first mount, which is worse. Or is it? * a transport upon the first mount, which is worse. Or is it?
*/ */
late_initcall(afs_init); /* must be called after net/ to create socket */ late_initcall(afs_init); /* must be called after net/ to create socket */
/*****************************************************************************/
/* /*
* clean up on module removal * clean up on module removal
*/ */
...@@ -163,19 +153,14 @@ static void __exit afs_exit(void) ...@@ -163,19 +153,14 @@ static void __exit afs_exit(void)
afs_kafstimod_stop(); afs_kafstimod_stop();
afs_kafsasyncd_stop(); afs_kafsasyncd_stop();
afs_cell_purge(); afs_cell_purge();
#ifdef CONFIG_KEYS_TURNED_OFF
afs_key_unregister();
#endif
#ifdef AFS_CACHING_SUPPORT #ifdef AFS_CACHING_SUPPORT
cachefs_unregister_netfs(&afs_cache_netfs); cachefs_unregister_netfs(&afs_cache_netfs);
#endif #endif
afs_proc_cleanup(); afs_proc_cleanup();
}
} /* end afs_exit() */
module_exit(afs_exit); module_exit(afs_exit);
/*****************************************************************************/
/* /*
* notification that new peer record is being added * notification that new peer record is being added
* - called from krxsecd * - called from krxsecd
...@@ -208,9 +193,8 @@ static int afs_adding_peer(struct rxrpc_peer *peer) ...@@ -208,9 +193,8 @@ static int afs_adding_peer(struct rxrpc_peer *peer)
afs_put_server(server); afs_put_server(server);
return 0; return 0;
} /* end afs_adding_peer() */ }
/*****************************************************************************/
/* /*
* notification that a peer record is being discarded * notification that a peer record is being discarded
* - called from krxiod or krxsecd * - called from krxiod or krxsecd
...@@ -236,50 +220,4 @@ static void afs_discarding_peer(struct rxrpc_peer *peer) ...@@ -236,50 +220,4 @@ static void afs_discarding_peer(struct rxrpc_peer *peer)
spin_unlock(&afs_server_peer_lock); spin_unlock(&afs_server_peer_lock);
_leave(""); _leave("");
} /* end afs_discarding_peer() */
/*****************************************************************************/
/*
* clear the dead space between task_struct and kernel stack
* - called by supplying -finstrument-functions to gcc
*/
#if 0
void __cyg_profile_func_enter (void *this_fn, void *call_site)
__attribute__((no_instrument_function));
void __cyg_profile_func_enter (void *this_fn, void *call_site)
{
asm volatile(" movl %%esp,%%edi \n"
" andl %0,%%edi \n"
" addl %1,%%edi \n"
" movl %%esp,%%ecx \n"
" subl %%edi,%%ecx \n"
" shrl $2,%%ecx \n"
" movl $0xedededed,%%eax \n"
" rep stosl \n"
:
: "i"(~(THREAD_SIZE - 1)), "i"(sizeof(struct thread_info))
: "eax", "ecx", "edi", "memory", "cc"
);
}
void __cyg_profile_func_exit(void *this_fn, void *call_site)
__attribute__((no_instrument_function));
void __cyg_profile_func_exit(void *this_fn, void *call_site)
{
asm volatile(" movl %%esp,%%edi \n"
" andl %0,%%edi \n"
" addl %1,%%edi \n"
" movl %%esp,%%ecx \n"
" subl %%edi,%%ecx \n"
" shrl $2,%%ecx \n"
" movl $0xdadadada,%%eax \n"
" rep stosl \n"
:
: "i"(~(THREAD_SIZE - 1)), "i"(sizeof(struct thread_info))
: "eax", "ecx", "edi", "memory", "cc"
);
} }
#endif
/* misc.c: miscellaneous bits /* miscellaneous bits
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "errors.h" #include "errors.h"
#include "internal.h" #include "internal.h"
/*****************************************************************************/
/* /*
* convert an AFS abort code to a Linux error number * convert an AFS abort code to a Linux error number
*/ */
...@@ -35,5 +34,4 @@ int afs_abort_to_error(int abortcode) ...@@ -35,5 +34,4 @@ int afs_abort_to_error(int abortcode)
case VMOVED: return -ENXIO; case VMOVED: return -ENXIO;
default: return -EIO; default: return -EIO;
} }
}
} /* end afs_abort_to_error() */
/* mntpt.c: mountpoint management /* mountpoint management
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -54,7 +54,6 @@ struct afs_timer afs_mntpt_expiry_timer; ...@@ -54,7 +54,6 @@ struct afs_timer afs_mntpt_expiry_timer;
unsigned long afs_mntpt_expiry_timeout = 20; unsigned long afs_mntpt_expiry_timeout = 20;
/*****************************************************************************/
/* /*
* check a symbolic link to see whether it actually encodes a mountpoint * check a symbolic link to see whether it actually encodes a mountpoint
* - sets the AFS_VNODE_MOUNTPOINT flag on the vnode appropriately * - sets the AFS_VNODE_MOUNTPOINT flag on the vnode appropriately
...@@ -99,16 +98,14 @@ int afs_mntpt_check_symlink(struct afs_vnode *vnode) ...@@ -99,16 +98,14 @@ int afs_mntpt_check_symlink(struct afs_vnode *vnode)
ret = 0; ret = 0;
out_free: out_free:
kunmap(page); kunmap(page);
page_cache_release(page); page_cache_release(page);
out: out:
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
}
} /* end afs_mntpt_check_symlink() */
/*****************************************************************************/
/* /*
* no valid lookup procedure on this sort of dir * no valid lookup procedure on this sort of dir
*/ */
...@@ -125,9 +122,8 @@ static struct dentry *afs_mntpt_lookup(struct inode *dir, ...@@ -125,9 +122,8 @@ static struct dentry *afs_mntpt_lookup(struct inode *dir,
dentry->d_name.name); dentry->d_name.name);
return ERR_PTR(-EREMOTE); return ERR_PTR(-EREMOTE);
} /* end afs_mntpt_lookup() */ }
/*****************************************************************************/
/* /*
* no valid open procedure on this sort of dir * no valid open procedure on this sort of dir
*/ */
...@@ -142,9 +138,8 @@ static int afs_mntpt_open(struct inode *inode, struct file *file) ...@@ -142,9 +138,8 @@ static int afs_mntpt_open(struct inode *inode, struct file *file)
file->f_path.dentry->d_name.name); file->f_path.dentry->d_name.name);
return -EREMOTE; return -EREMOTE;
} /* end afs_mntpt_open() */ }
/*****************************************************************************/
/* /*
* create a vfsmount to be automounted * create a vfsmount to be automounted
*/ */
...@@ -210,7 +205,7 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt) ...@@ -210,7 +205,7 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
kleave(" = %p", mnt); kleave(" = %p", mnt);
return mnt; return mnt;
error: error:
if (page) if (page)
page_cache_release(page); page_cache_release(page);
if (devname) if (devname)
...@@ -219,9 +214,8 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt) ...@@ -219,9 +214,8 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
free_page((unsigned long) options); free_page((unsigned long) options);
kleave(" = %d", ret); kleave(" = %d", ret);
return ERR_PTR(ret); return ERR_PTR(ret);
} /* end afs_mntpt_do_automount() */ }
/*****************************************************************************/
/* /*
* follow a link from a mountpoint directory, thus causing it to be mounted * follow a link from a mountpoint directory, thus causing it to be mounted
*/ */
...@@ -260,9 +254,8 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd) ...@@ -260,9 +254,8 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
kleave(" = %d", err); kleave(" = %d", err);
return ERR_PTR(err); return ERR_PTR(err);
} /* end afs_mntpt_follow_link() */ }
/*****************************************************************************/
/* /*
* handle mountpoint expiry timer going off * handle mountpoint expiry timer going off
*/ */
...@@ -276,4 +269,4 @@ static void afs_mntpt_expiry_timed_out(struct afs_timer *timer) ...@@ -276,4 +269,4 @@ static void afs_mntpt_expiry_timed_out(struct afs_timer *timer)
afs_mntpt_expiry_timeout * HZ); afs_mntpt_expiry_timeout * HZ);
kleave(""); kleave("");
} /* end afs_mntpt_expiry_timed_out() */ }
/* mount.h: mount parameters /* mount parameters
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#ifndef _LINUX_AFS_MOUNT_H #ifndef AFS_MOUNT_H
#define _LINUX_AFS_MOUNT_H #define AFS_MOUNT_H
struct afs_mountdata { struct afs_mountdata {
const char *volume; /* name of volume */ const char *volume; /* name of volume */
...@@ -20,4 +20,4 @@ struct afs_mountdata { ...@@ -20,4 +20,4 @@ struct afs_mountdata {
uint32_t servers[10]; /* IP addresses of servers in this cell */ uint32_t servers[10]; /* IP addresses of servers in this cell */
}; };
#endif /* _LINUX_AFS_MOUNT_H */ #endif /* AFS_MOUNT_H */
/* proc.c: /proc interface for AFS /* /proc interface for AFS
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -130,7 +130,6 @@ static const struct file_operations afs_proc_cell_servers_fops = { ...@@ -130,7 +130,6 @@ static const struct file_operations afs_proc_cell_servers_fops = {
.release = afs_proc_cell_servers_release, .release = afs_proc_cell_servers_release,
}; };
/*****************************************************************************/
/* /*
* initialise the /proc/fs/afs/ directory * initialise the /proc/fs/afs/ directory
*/ */
...@@ -142,47 +141,43 @@ int afs_proc_init(void) ...@@ -142,47 +141,43 @@ int afs_proc_init(void)
proc_afs = proc_mkdir("fs/afs", NULL); proc_afs = proc_mkdir("fs/afs", NULL);
if (!proc_afs) if (!proc_afs)
goto error; goto error_dir;
proc_afs->owner = THIS_MODULE; proc_afs->owner = THIS_MODULE;
p = create_proc_entry("cells", 0, proc_afs); p = create_proc_entry("cells", 0, proc_afs);
if (!p) if (!p)
goto error_proc; goto error_cells;
p->proc_fops = &afs_proc_cells_fops; p->proc_fops = &afs_proc_cells_fops;
p->owner = THIS_MODULE; p->owner = THIS_MODULE;
p = create_proc_entry("rootcell", 0, proc_afs); p = create_proc_entry("rootcell", 0, proc_afs);
if (!p) if (!p)
goto error_cells; goto error_rootcell;
p->proc_fops = &afs_proc_rootcell_fops; p->proc_fops = &afs_proc_rootcell_fops;
p->owner = THIS_MODULE; p->owner = THIS_MODULE;
_leave(" = 0"); _leave(" = 0");
return 0; return 0;
error_cells: error_rootcell:
remove_proc_entry("cells", proc_afs); remove_proc_entry("cells", proc_afs);
error_proc: error_cells:
remove_proc_entry("fs/afs", NULL); remove_proc_entry("fs/afs", NULL);
error: error_dir:
_leave(" = -ENOMEM"); _leave(" = -ENOMEM");
return -ENOMEM; return -ENOMEM;
}
} /* end afs_proc_init() */
/*****************************************************************************/
/* /*
* clean up the /proc/fs/afs/ directory * clean up the /proc/fs/afs/ directory
*/ */
void afs_proc_cleanup(void) void afs_proc_cleanup(void)
{ {
remove_proc_entry("rootcell", proc_afs);
remove_proc_entry("cells", proc_afs); remove_proc_entry("cells", proc_afs);
remove_proc_entry("fs/afs", NULL); remove_proc_entry("fs/afs", NULL);
}
} /* end afs_proc_cleanup() */
/*****************************************************************************/
/* /*
* open "/proc/fs/afs/cells" which provides a summary of extant cells * open "/proc/fs/afs/cells" which provides a summary of extant cells
*/ */
...@@ -199,9 +194,8 @@ static int afs_proc_cells_open(struct inode *inode, struct file *file) ...@@ -199,9 +194,8 @@ static int afs_proc_cells_open(struct inode *inode, struct file *file)
m->private = PDE(inode)->data; m->private = PDE(inode)->data;
return 0; return 0;
} /* end afs_proc_cells_open() */ }
/*****************************************************************************/
/* /*
* set up the iterator to start reading from the cells list and return the * set up the iterator to start reading from the cells list and return the
* first item * first item
...@@ -225,9 +219,8 @@ static void *afs_proc_cells_start(struct seq_file *m, loff_t *_pos) ...@@ -225,9 +219,8 @@ static void *afs_proc_cells_start(struct seq_file *m, loff_t *_pos)
break; break;
return _p != &afs_proc_cells ? _p : NULL; return _p != &afs_proc_cells ? _p : NULL;
} /* end afs_proc_cells_start() */ }
/*****************************************************************************/
/* /*
* move to next cell in cells list * move to next cell in cells list
*/ */
...@@ -241,19 +234,16 @@ static void *afs_proc_cells_next(struct seq_file *p, void *v, loff_t *pos) ...@@ -241,19 +234,16 @@ static void *afs_proc_cells_next(struct seq_file *p, void *v, loff_t *pos)
_p = v == (void *) 1 ? afs_proc_cells.next : _p->next; _p = v == (void *) 1 ? afs_proc_cells.next : _p->next;
return _p != &afs_proc_cells ? _p : NULL; return _p != &afs_proc_cells ? _p : NULL;
} /* end afs_proc_cells_next() */ }
/*****************************************************************************/
/* /*
* clean up after reading from the cells list * clean up after reading from the cells list
*/ */
static void afs_proc_cells_stop(struct seq_file *p, void *v) static void afs_proc_cells_stop(struct seq_file *p, void *v)
{ {
up_read(&afs_proc_cells_sem); up_read(&afs_proc_cells_sem);
}
} /* end afs_proc_cells_stop() */
/*****************************************************************************/
/* /*
* display a header line followed by a load of cell lines * display a header line followed by a load of cell lines
*/ */
...@@ -261,19 +251,18 @@ static int afs_proc_cells_show(struct seq_file *m, void *v) ...@@ -261,19 +251,18 @@ static int afs_proc_cells_show(struct seq_file *m, void *v)
{ {
struct afs_cell *cell = list_entry(v, struct afs_cell, proc_link); struct afs_cell *cell = list_entry(v, struct afs_cell, proc_link);
/* display header on line 1 */
if (v == (void *) 1) { if (v == (void *) 1) {
/* display header on line 1 */
seq_puts(m, "USE NAME\n"); seq_puts(m, "USE NAME\n");
return 0; return 0;
} }
/* display one cell per line on subsequent lines */ /* display one cell per line on subsequent lines */
seq_printf(m, "%3d %s\n", atomic_read(&cell->usage), cell->name); seq_printf(m, "%3d %s\n",
atomic_read(&cell->usage), cell->name);
return 0; return 0;
} /* end afs_proc_cells_show() */ }
/*****************************************************************************/
/* /*
* handle writes to /proc/fs/afs/cells * handle writes to /proc/fs/afs/cells
* - to add cells: echo "add <cellname> <IP>[:<IP>][:<IP>]" * - to add cells: echo "add <cellname> <IP>[:<IP>][:<IP>]"
...@@ -331,25 +320,23 @@ static ssize_t afs_proc_cells_write(struct file *file, const char __user *buf, ...@@ -331,25 +320,23 @@ static ssize_t afs_proc_cells_write(struct file *file, const char __user *buf,
goto done; goto done;
printk("kAFS: Added new cell '%s'\n", name); printk("kAFS: Added new cell '%s'\n", name);
} } else {
else {
goto inval; goto inval;
} }
ret = size; ret = size;
done: done:
kfree(kbuf); kfree(kbuf);
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
inval: inval:
ret = -EINVAL; ret = -EINVAL;
printk("kAFS: Invalid Command on /proc/fs/afs/cells file\n"); printk("kAFS: Invalid Command on /proc/fs/afs/cells file\n");
goto done; goto done;
} /* end afs_proc_cells_write() */ }
/*****************************************************************************/
/* /*
* Stubs for /proc/fs/afs/rootcell * Stubs for /proc/fs/afs/rootcell
*/ */
...@@ -369,7 +356,6 @@ static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf, ...@@ -369,7 +356,6 @@ static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf,
return 0; return 0;
} }
/*****************************************************************************/
/* /*
* handle writes to /proc/fs/afs/rootcell * handle writes to /proc/fs/afs/rootcell
* - to initialize rootcell: echo "cell.name:192.168.231.14" * - to initialize rootcell: echo "cell.name:192.168.231.14"
...@@ -407,14 +393,13 @@ static ssize_t afs_proc_rootcell_write(struct file *file, ...@@ -407,14 +393,13 @@ static ssize_t afs_proc_rootcell_write(struct file *file,
if (ret >= 0) if (ret >= 0)
ret = size; /* consume everything, always */ ret = size; /* consume everything, always */
infault: infault:
kfree(kbuf); kfree(kbuf);
nomem: nomem:
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
} /* end afs_proc_rootcell_write() */ }
/*****************************************************************************/
/* /*
* initialise /proc/fs/afs/<cell>/ * initialise /proc/fs/afs/<cell>/
*/ */
...@@ -426,25 +411,25 @@ int afs_proc_cell_setup(struct afs_cell *cell) ...@@ -426,25 +411,25 @@ int afs_proc_cell_setup(struct afs_cell *cell)
cell->proc_dir = proc_mkdir(cell->name, proc_afs); cell->proc_dir = proc_mkdir(cell->name, proc_afs);
if (!cell->proc_dir) if (!cell->proc_dir)
return -ENOMEM; goto error_dir;
p = create_proc_entry("servers", 0, cell->proc_dir); p = create_proc_entry("servers", 0, cell->proc_dir);
if (!p) if (!p)
goto error_proc; goto error_servers;
p->proc_fops = &afs_proc_cell_servers_fops; p->proc_fops = &afs_proc_cell_servers_fops;
p->owner = THIS_MODULE; p->owner = THIS_MODULE;
p->data = cell; p->data = cell;
p = create_proc_entry("vlservers", 0, cell->proc_dir); p = create_proc_entry("vlservers", 0, cell->proc_dir);
if (!p) if (!p)
goto error_servers; goto error_vlservers;
p->proc_fops = &afs_proc_cell_vlservers_fops; p->proc_fops = &afs_proc_cell_vlservers_fops;
p->owner = THIS_MODULE; p->owner = THIS_MODULE;
p->data = cell; p->data = cell;
p = create_proc_entry("volumes", 0, cell->proc_dir); p = create_proc_entry("volumes", 0, cell->proc_dir);
if (!p) if (!p)
goto error_vlservers; goto error_volumes;
p->proc_fops = &afs_proc_cell_volumes_fops; p->proc_fops = &afs_proc_cell_volumes_fops;
p->owner = THIS_MODULE; p->owner = THIS_MODULE;
p->data = cell; p->data = cell;
...@@ -452,17 +437,17 @@ int afs_proc_cell_setup(struct afs_cell *cell) ...@@ -452,17 +437,17 @@ int afs_proc_cell_setup(struct afs_cell *cell)
_leave(" = 0"); _leave(" = 0");
return 0; return 0;
error_vlservers: error_volumes:
remove_proc_entry("vlservers", cell->proc_dir); remove_proc_entry("vlservers", cell->proc_dir);
error_servers: error_vlservers:
remove_proc_entry("servers", cell->proc_dir); remove_proc_entry("servers", cell->proc_dir);
error_proc: error_servers:
remove_proc_entry(cell->name, proc_afs); remove_proc_entry(cell->name, proc_afs);
error_dir:
_leave(" = -ENOMEM"); _leave(" = -ENOMEM");
return -ENOMEM; return -ENOMEM;
} /* end afs_proc_cell_setup() */ }
/*****************************************************************************/
/* /*
* remove /proc/fs/afs/<cell>/ * remove /proc/fs/afs/<cell>/
*/ */
...@@ -476,9 +461,8 @@ void afs_proc_cell_remove(struct afs_cell *cell) ...@@ -476,9 +461,8 @@ void afs_proc_cell_remove(struct afs_cell *cell)
remove_proc_entry(cell->name, proc_afs); remove_proc_entry(cell->name, proc_afs);
_leave(""); _leave("");
} /* end afs_proc_cell_remove() */ }
/*****************************************************************************/
/* /*
* open "/proc/fs/afs/<cell>/volumes" which provides a summary of extant cells * open "/proc/fs/afs/<cell>/volumes" which provides a summary of extant cells
*/ */
...@@ -500,9 +484,8 @@ static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file) ...@@ -500,9 +484,8 @@ static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file)
m->private = cell; m->private = cell;
return 0; return 0;
} /* end afs_proc_cell_volumes_open() */ }
/*****************************************************************************/
/* /*
* close the file and release the ref to the cell * close the file and release the ref to the cell
*/ */
...@@ -511,14 +494,12 @@ static int afs_proc_cell_volumes_release(struct inode *inode, struct file *file) ...@@ -511,14 +494,12 @@ static int afs_proc_cell_volumes_release(struct inode *inode, struct file *file)
struct afs_cell *cell = PDE(inode)->data; struct afs_cell *cell = PDE(inode)->data;
int ret; int ret;
ret = seq_release(inode,file); ret = seq_release(inode, file);
afs_put_cell(cell); afs_put_cell(cell);
return ret; return ret;
} /* end afs_proc_cell_volumes_release() */ }
/*****************************************************************************/
/* /*
* set up the iterator to start reading from the cells list and return the * set up the iterator to start reading from the cells list and return the
* first item * first item
...@@ -545,9 +526,8 @@ static void *afs_proc_cell_volumes_start(struct seq_file *m, loff_t *_pos) ...@@ -545,9 +526,8 @@ static void *afs_proc_cell_volumes_start(struct seq_file *m, loff_t *_pos)
break; break;
return _p != &cell->vl_list ? _p : NULL; return _p != &cell->vl_list ? _p : NULL;
} /* end afs_proc_cell_volumes_start() */ }
/*****************************************************************************/
/* /*
* move to next cell in cells list * move to next cell in cells list
*/ */
...@@ -562,12 +542,11 @@ static void *afs_proc_cell_volumes_next(struct seq_file *p, void *v, ...@@ -562,12 +542,11 @@ static void *afs_proc_cell_volumes_next(struct seq_file *p, void *v,
(*_pos)++; (*_pos)++;
_p = v; _p = v;
_p = v == (void *) 1 ? cell->vl_list.next : _p->next; _p = (v == (void *) 1) ? cell->vl_list.next : _p->next;
return _p != &cell->vl_list ? _p : NULL; return (_p != &cell->vl_list) ? _p : NULL;
} /* end afs_proc_cell_volumes_next() */ }
/*****************************************************************************/
/* /*
* clean up after reading from the cells list * clean up after reading from the cells list
*/ */
...@@ -576,10 +555,8 @@ static void afs_proc_cell_volumes_stop(struct seq_file *p, void *v) ...@@ -576,10 +555,8 @@ static void afs_proc_cell_volumes_stop(struct seq_file *p, void *v)
struct afs_cell *cell = p->private; struct afs_cell *cell = p->private;
up_read(&cell->vl_sem); up_read(&cell->vl_sem);
}
} /* end afs_proc_cell_volumes_stop() */
/*****************************************************************************/
/* /*
* display a header line followed by a load of volume lines * display a header line followed by a load of volume lines
*/ */
...@@ -600,13 +577,11 @@ static int afs_proc_cell_volumes_show(struct seq_file *m, void *v) ...@@ -600,13 +577,11 @@ static int afs_proc_cell_volumes_show(struct seq_file *m, void *v)
vlocation->vldb.vid[0], vlocation->vldb.vid[0],
vlocation->vldb.vid[1], vlocation->vldb.vid[1],
vlocation->vldb.vid[2], vlocation->vldb.vid[2],
vlocation->vldb.name vlocation->vldb.name);
);
return 0; return 0;
} /* end afs_proc_cell_volumes_show() */ }
/*****************************************************************************/
/* /*
* open "/proc/fs/afs/<cell>/vlservers" which provides a list of volume * open "/proc/fs/afs/<cell>/vlservers" which provides a list of volume
* location server * location server
...@@ -629,9 +604,8 @@ static int afs_proc_cell_vlservers_open(struct inode *inode, struct file *file) ...@@ -629,9 +604,8 @@ static int afs_proc_cell_vlservers_open(struct inode *inode, struct file *file)
m->private = cell; m->private = cell;
return 0; return 0;
} /* end afs_proc_cell_vlservers_open() */ }
/*****************************************************************************/
/* /*
* close the file and release the ref to the cell * close the file and release the ref to the cell
*/ */
...@@ -644,11 +618,9 @@ static int afs_proc_cell_vlservers_release(struct inode *inode, ...@@ -644,11 +618,9 @@ static int afs_proc_cell_vlservers_release(struct inode *inode,
ret = seq_release(inode,file); ret = seq_release(inode,file);
afs_put_cell(cell); afs_put_cell(cell);
return ret; return ret;
} /* end afs_proc_cell_vlservers_release() */ }
/*****************************************************************************/
/* /*
* set up the iterator to start reading from the cells list and return the * set up the iterator to start reading from the cells list and return the
* first item * first item
...@@ -672,9 +644,8 @@ static void *afs_proc_cell_vlservers_start(struct seq_file *m, loff_t *_pos) ...@@ -672,9 +644,8 @@ static void *afs_proc_cell_vlservers_start(struct seq_file *m, loff_t *_pos)
return NULL; return NULL;
return &cell->vl_addrs[pos]; return &cell->vl_addrs[pos];
} /* end afs_proc_cell_vlservers_start() */ }
/*****************************************************************************/
/* /*
* move to next cell in cells list * move to next cell in cells list
*/ */
...@@ -692,9 +663,8 @@ static void *afs_proc_cell_vlservers_next(struct seq_file *p, void *v, ...@@ -692,9 +663,8 @@ static void *afs_proc_cell_vlservers_next(struct seq_file *p, void *v,
return NULL; return NULL;
return &cell->vl_addrs[pos]; return &cell->vl_addrs[pos];
} /* end afs_proc_cell_vlservers_next() */ }
/*****************************************************************************/
/* /*
* clean up after reading from the cells list * clean up after reading from the cells list
*/ */
...@@ -703,10 +673,8 @@ static void afs_proc_cell_vlservers_stop(struct seq_file *p, void *v) ...@@ -703,10 +673,8 @@ static void afs_proc_cell_vlservers_stop(struct seq_file *p, void *v)
struct afs_cell *cell = p->private; struct afs_cell *cell = p->private;
up_read(&cell->vl_sem); up_read(&cell->vl_sem);
}
} /* end afs_proc_cell_vlservers_stop() */
/*****************************************************************************/
/* /*
* display a header line followed by a load of volume lines * display a header line followed by a load of volume lines
*/ */
...@@ -722,11 +690,9 @@ static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v) ...@@ -722,11 +690,9 @@ static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v)
/* display one cell per line on subsequent lines */ /* display one cell per line on subsequent lines */
seq_printf(m, "%u.%u.%u.%u\n", NIPQUAD(addr->s_addr)); seq_printf(m, "%u.%u.%u.%u\n", NIPQUAD(addr->s_addr));
return 0; return 0;
} /* end afs_proc_cell_vlservers_show() */ }
/*****************************************************************************/
/* /*
* open "/proc/fs/afs/<cell>/servers" which provides a summary of active * open "/proc/fs/afs/<cell>/servers" which provides a summary of active
* servers * servers
...@@ -747,11 +713,9 @@ static int afs_proc_cell_servers_open(struct inode *inode, struct file *file) ...@@ -747,11 +713,9 @@ static int afs_proc_cell_servers_open(struct inode *inode, struct file *file)
m = file->private_data; m = file->private_data;
m->private = cell; m->private = cell;
return 0; return 0;
} /* end afs_proc_cell_servers_open() */ }
/*****************************************************************************/
/* /*
* close the file and release the ref to the cell * close the file and release the ref to the cell
*/ */
...@@ -764,11 +728,9 @@ static int afs_proc_cell_servers_release(struct inode *inode, ...@@ -764,11 +728,9 @@ static int afs_proc_cell_servers_release(struct inode *inode,
ret = seq_release(inode, file); ret = seq_release(inode, file);
afs_put_cell(cell); afs_put_cell(cell);
return ret; return ret;
} /* end afs_proc_cell_servers_release() */ }
/*****************************************************************************/
/* /*
* set up the iterator to start reading from the cells list and return the * set up the iterator to start reading from the cells list and return the
* first item * first item
...@@ -796,9 +758,8 @@ static void *afs_proc_cell_servers_start(struct seq_file *m, loff_t *_pos) ...@@ -796,9 +758,8 @@ static void *afs_proc_cell_servers_start(struct seq_file *m, loff_t *_pos)
break; break;
return _p != &cell->sv_list ? _p : NULL; return _p != &cell->sv_list ? _p : NULL;
} /* end afs_proc_cell_servers_start() */ }
/*****************************************************************************/
/* /*
* move to next cell in cells list * move to next cell in cells list
*/ */
...@@ -816,9 +777,8 @@ static void *afs_proc_cell_servers_next(struct seq_file *p, void *v, ...@@ -816,9 +777,8 @@ static void *afs_proc_cell_servers_next(struct seq_file *p, void *v,
_p = v == (void *) 1 ? cell->sv_list.next : _p->next; _p = v == (void *) 1 ? cell->sv_list.next : _p->next;
return _p != &cell->sv_list ? _p : NULL; return _p != &cell->sv_list ? _p : NULL;
} /* end afs_proc_cell_servers_next() */ }
/*****************************************************************************/
/* /*
* clean up after reading from the cells list * clean up after reading from the cells list
*/ */
...@@ -828,10 +788,8 @@ static void afs_proc_cell_servers_stop(struct seq_file *p, void *v) ...@@ -828,10 +788,8 @@ static void afs_proc_cell_servers_stop(struct seq_file *p, void *v)
struct afs_cell *cell = p->private; struct afs_cell *cell = p->private;
read_unlock(&cell->sv_lock); read_unlock(&cell->sv_lock);
}
} /* end afs_proc_cell_servers_stop() */
/*****************************************************************************/
/* /*
* display a header line followed by a load of volume lines * display a header line followed by a load of volume lines
*/ */
...@@ -849,10 +807,7 @@ static int afs_proc_cell_servers_show(struct seq_file *m, void *v) ...@@ -849,10 +807,7 @@ static int afs_proc_cell_servers_show(struct seq_file *m, void *v)
/* display one cell per line on subsequent lines */ /* display one cell per line on subsequent lines */
sprintf(ipaddr, "%u.%u.%u.%u", NIPQUAD(server->addr)); sprintf(ipaddr, "%u.%u.%u.%u", NIPQUAD(server->addr));
seq_printf(m, "%3d %-15.15s %5d\n", seq_printf(m, "%3d %-15.15s %5d\n",
atomic_read(&server->usage), atomic_read(&server->usage), ipaddr, server->fs_state);
ipaddr,
server->fs_state
);
return 0; return 0;
} /* end afs_proc_cell_servers_show() */ }
/* server.c: AFS server record management /* AFS server record management
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -41,7 +41,6 @@ static const struct afs_timer_ops afs_server_timer_ops = { ...@@ -41,7 +41,6 @@ static const struct afs_timer_ops afs_server_timer_ops = {
.timed_out = __afs_server_timeout, .timed_out = __afs_server_timeout,
}; };
/*****************************************************************************/
/* /*
* lookup a server record in a cell * lookup a server record in a cell
* - TODO: search the cell's server list * - TODO: search the cell's server list
...@@ -106,7 +105,7 @@ int afs_server_lookup(struct afs_cell *cell, const struct in_addr *addr, ...@@ -106,7 +105,7 @@ int afs_server_lookup(struct afs_cell *cell, const struct in_addr *addr,
return 0; return 0;
/* found a matching active server */ /* found a matching active server */
use_active_server: use_active_server:
_debug("active server"); _debug("active server");
afs_get_server(active); afs_get_server(active);
write_unlock(&cell->sv_lock); write_unlock(&cell->sv_lock);
...@@ -119,7 +118,7 @@ int afs_server_lookup(struct afs_cell *cell, const struct in_addr *addr, ...@@ -119,7 +118,7 @@ int afs_server_lookup(struct afs_cell *cell, const struct in_addr *addr,
/* found a matching server in the graveyard, so resurrect it and /* found a matching server in the graveyard, so resurrect it and
* dispose of the new record */ * dispose of the new record */
resurrect_server: resurrect_server:
_debug("resurrecting server"); _debug("resurrecting server");
list_move_tail(&zombie->link, &cell->sv_list); list_move_tail(&zombie->link, &cell->sv_list);
...@@ -133,10 +132,8 @@ int afs_server_lookup(struct afs_cell *cell, const struct in_addr *addr, ...@@ -133,10 +132,8 @@ int afs_server_lookup(struct afs_cell *cell, const struct in_addr *addr,
*_server = zombie; *_server = zombie;
_leave(" = 0 (%p)", zombie); _leave(" = 0 (%p)", zombie);
return 0; return 0;
}
} /* end afs_server_lookup() */
/*****************************************************************************/
/* /*
* destroy a server record * destroy a server record
* - removes from the cell list * - removes from the cell list
...@@ -175,9 +172,8 @@ void afs_put_server(struct afs_server *server) ...@@ -175,9 +172,8 @@ void afs_put_server(struct afs_server *server)
write_unlock(&cell->sv_lock); write_unlock(&cell->sv_lock);
_leave(" [killed]"); _leave(" [killed]");
} /* end afs_put_server() */ }
/*****************************************************************************/
/* /*
* timeout server record * timeout server record
* - removes from the cell's graveyard if the usage count is zero * - removes from the cell's graveyard if the usage count is zero
...@@ -230,9 +226,8 @@ void afs_server_do_timeout(struct afs_server *server) ...@@ -230,9 +226,8 @@ void afs_server_do_timeout(struct afs_server *server)
kfree(server); kfree(server);
_leave(" [destroyed]"); _leave(" [destroyed]");
} /* end afs_server_do_timeout() */ }
/*****************************************************************************/
/* /*
* get a callslot on a connection to the fileserver on the specified server * get a callslot on a connection to the fileserver on the specified server
*/ */
...@@ -323,7 +318,7 @@ int afs_server_request_callslot(struct afs_server *server, ...@@ -323,7 +318,7 @@ int afs_server_request_callslot(struct afs_server *server,
} }
/* got a callslot, but no connection */ /* got a callslot, but no connection */
obtained_slot: obtained_slot:
/* need to get hold of the RxRPC connection */ /* need to get hold of the RxRPC connection */
down_write(&server->sem); down_write(&server->sem);
...@@ -337,8 +332,7 @@ int afs_server_request_callslot(struct afs_server *server, ...@@ -337,8 +332,7 @@ int afs_server_request_callslot(struct afs_server *server,
/* reuse an existing connection */ /* reuse an existing connection */
rxrpc_get_connection(server->fs_conn[nconn]); rxrpc_get_connection(server->fs_conn[nconn]);
callslot->conn = server->fs_conn[nconn]; callslot->conn = server->fs_conn[nconn];
} } else {
else {
/* create a new connection */ /* create a new connection */
ret = rxrpc_create_connection(afs_transport, ret = rxrpc_create_connection(afs_transport,
htons(7000), htons(7000),
...@@ -360,23 +354,21 @@ int afs_server_request_callslot(struct afs_server *server, ...@@ -360,23 +354,21 @@ int afs_server_request_callslot(struct afs_server *server,
return 0; return 0;
/* handle an error occurring */ /* handle an error occurring */
error_release_upw: error_release_upw:
up_write(&server->sem); up_write(&server->sem);
error_release: error_release:
/* either release the callslot or pass it along to another deserving /* either release the callslot or pass it along to another deserving
* task */ * task */
spin_lock(&server->fs_lock); spin_lock(&server->fs_lock);
if (nconn < 0) { if (nconn < 0) {
/* no callslot allocated */ /* no callslot allocated */
} } else if (list_empty(&server->fs_callq)) {
else if (list_empty(&server->fs_callq)) {
/* no one waiting */ /* no one waiting */
server->fs_conn_cnt[nconn]++; server->fs_conn_cnt[nconn]++;
spin_unlock(&server->fs_lock); spin_unlock(&server->fs_lock);
} } else {
else {
/* someone's waiting - dequeue them and wake them up */ /* someone's waiting - dequeue them and wake them up */
pcallslot = list_entry(server->fs_callq.next, pcallslot = list_entry(server->fs_callq.next,
struct afs_server_callslot, link); struct afs_server_callslot, link);
...@@ -400,10 +392,8 @@ int afs_server_request_callslot(struct afs_server *server, ...@@ -400,10 +392,8 @@ int afs_server_request_callslot(struct afs_server *server,
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
}
} /* end afs_server_request_callslot() */
/*****************************************************************************/
/* /*
* release a callslot back to the server * release a callslot back to the server
* - transfers the RxRPC connection to the next pending callslot if possible * - transfers the RxRPC connection to the next pending callslot if possible
...@@ -426,8 +416,7 @@ void afs_server_release_callslot(struct afs_server *server, ...@@ -426,8 +416,7 @@ void afs_server_release_callslot(struct afs_server *server,
/* no one waiting */ /* no one waiting */
server->fs_conn_cnt[callslot->nconn]++; server->fs_conn_cnt[callslot->nconn]++;
spin_unlock(&server->fs_lock); spin_unlock(&server->fs_lock);
} } else {
else {
/* someone's waiting - dequeue them and wake them up */ /* someone's waiting - dequeue them and wake them up */
pcallslot = list_entry(server->fs_callq.next, pcallslot = list_entry(server->fs_callq.next,
struct afs_server_callslot, link); struct afs_server_callslot, link);
...@@ -449,9 +438,8 @@ void afs_server_release_callslot(struct afs_server *server, ...@@ -449,9 +438,8 @@ void afs_server_release_callslot(struct afs_server *server,
rxrpc_put_connection(callslot->conn); rxrpc_put_connection(callslot->conn);
_leave(""); _leave("");
} /* end afs_server_release_callslot() */ }
/*****************************************************************************/
/* /*
* get a handle to a connection to the vlserver (volume location) on the * get a handle to a connection to the vlserver (volume location) on the
* specified server * specified server
...@@ -473,8 +461,7 @@ int afs_server_get_vlconn(struct afs_server *server, ...@@ -473,8 +461,7 @@ int afs_server_get_vlconn(struct afs_server *server,
rxrpc_get_connection(server->vlserver); rxrpc_get_connection(server->vlserver);
conn = server->vlserver; conn = server->vlserver;
up_read(&server->sem); up_read(&server->sem);
} } else {
else {
/* create a new connection */ /* create a new connection */
up_read(&server->sem); up_read(&server->sem);
down_write(&server->sem); down_write(&server->sem);
...@@ -496,4 +483,4 @@ int afs_server_get_vlconn(struct afs_server *server, ...@@ -496,4 +483,4 @@ int afs_server_get_vlconn(struct afs_server *server,
*_conn = conn; *_conn = conn;
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
} /* end afs_server_get_vlconn() */ }
/* server.h: AFS server record /* AFS server record
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#ifndef _LINUX_AFS_SERVER_H #ifndef AFS_SERVER_H
#define _LINUX_AFS_SERVER_H #define AFS_SERVER_H
#include "types.h" #include "types.h"
#include "kafstimod.h" #include "kafstimod.h"
...@@ -19,12 +19,10 @@ ...@@ -19,12 +19,10 @@
extern spinlock_t afs_server_peer_lock; extern spinlock_t afs_server_peer_lock;
/*****************************************************************************/
/* /*
* AFS server record * AFS server record
*/ */
struct afs_server struct afs_server {
{
atomic_t usage; atomic_t usage;
struct afs_cell *cell; /* cell in which server resides */ struct afs_cell *cell; /* cell in which server resides */
struct list_head link; /* link in cell's server list */ struct list_head link; /* link in cell's server list */
...@@ -50,20 +48,19 @@ struct afs_server ...@@ -50,20 +48,19 @@ struct afs_server
spinlock_t cb_lock; /* access lock */ spinlock_t cb_lock; /* access lock */
}; };
extern int afs_server_lookup(struct afs_cell *cell, extern int afs_server_lookup(struct afs_cell *, const struct in_addr *,
const struct in_addr *addr, struct afs_server **);
struct afs_server **_server);
#define afs_get_server(S) do { atomic_inc(&(S)->usage); } while(0) #define afs_get_server(S) do { atomic_inc(&(S)->usage); } while(0)
extern void afs_put_server(struct afs_server *server); extern void afs_put_server(struct afs_server *);
extern void afs_server_do_timeout(struct afs_server *server); extern void afs_server_do_timeout(struct afs_server *);
extern int afs_server_find_by_peer(const struct rxrpc_peer *peer, extern int afs_server_find_by_peer(const struct rxrpc_peer *,
struct afs_server **_server); struct afs_server **);
extern int afs_server_get_vlconn(struct afs_server *server, extern int afs_server_get_vlconn(struct afs_server *,
struct rxrpc_connection **_conn); struct rxrpc_connection **);
static inline static inline
struct afs_server *afs_server_get_from_peer(struct rxrpc_peer *peer) struct afs_server *afs_server_get_from_peer(struct rxrpc_peer *peer)
...@@ -79,12 +76,10 @@ struct afs_server *afs_server_get_from_peer(struct rxrpc_peer *peer) ...@@ -79,12 +76,10 @@ struct afs_server *afs_server_get_from_peer(struct rxrpc_peer *peer)
return server; return server;
} }
/*****************************************************************************/
/* /*
* AFS server callslot grant record * AFS server callslot grant record
*/ */
struct afs_server_callslot struct afs_server_callslot {
{
struct list_head link; /* link in server's list */ struct list_head link; /* link in server's list */
struct task_struct *task; /* process waiting to make call */ struct task_struct *task; /* process waiting to make call */
struct rxrpc_connection *conn; /* connection to use (or NULL on error) */ struct rxrpc_connection *conn; /* connection to use (or NULL on error) */
...@@ -93,10 +88,10 @@ struct afs_server_callslot ...@@ -93,10 +88,10 @@ struct afs_server_callslot
int errno; /* error number if nconn==-1 */ int errno; /* error number if nconn==-1 */
}; };
extern int afs_server_request_callslot(struct afs_server *server, extern int afs_server_request_callslot(struct afs_server *,
struct afs_server_callslot *callslot); struct afs_server_callslot *);
extern void afs_server_release_callslot(struct afs_server *server, extern void afs_server_release_callslot(struct afs_server *,
struct afs_server_callslot *callslot); struct afs_server_callslot *);
#endif /* _LINUX_AFS_SERVER_H */ #endif /* AFS_SERVER_H */
/* /* AFS superblock handling
*
* Copyright (c) 2002 Red Hat, Inc. All rights reserved. * Copyright (c) 2002 Red Hat, Inc. All rights reserved.
* *
* This software may be freely redistributed under the terms of the * This software may be freely redistributed under the terms of the
...@@ -9,7 +10,7 @@ ...@@ -9,7 +10,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* Authors: David Howells <dhowells@redhat.com> * Authors: David Howells <dhowells@redhat.com>
* David Woodhouse <dwmw2@cambridge.redhat.com> * David Woodhouse <dwmw2@redhat.com>
* *
*/ */
...@@ -68,7 +69,6 @@ static const struct super_operations afs_super_ops = { ...@@ -68,7 +69,6 @@ static const struct super_operations afs_super_ops = {
static struct kmem_cache *afs_inode_cachep; static struct kmem_cache *afs_inode_cachep;
static atomic_t afs_count_active_inodes; static atomic_t afs_count_active_inodes;
/*****************************************************************************/
/* /*
* initialise the filesystem * initialise the filesystem
*/ */
...@@ -105,9 +105,8 @@ int __init afs_fs_init(void) ...@@ -105,9 +105,8 @@ int __init afs_fs_init(void)
kleave(" = 0"); kleave(" = 0");
return 0; return 0;
} /* end afs_fs_init() */ }
/*****************************************************************************/
/* /*
* clean up the filesystem * clean up the filesystem
*/ */
...@@ -122,10 +121,8 @@ void __exit afs_fs_exit(void) ...@@ -122,10 +121,8 @@ void __exit afs_fs_exit(void)
} }
kmem_cache_destroy(afs_inode_cachep); kmem_cache_destroy(afs_inode_cachep);
}
} /* end afs_fs_exit() */
/*****************************************************************************/
/* /*
* check that an argument has a value * check that an argument has a value
*/ */
...@@ -136,9 +133,8 @@ static int want_arg(char **_value, const char *option) ...@@ -136,9 +133,8 @@ static int want_arg(char **_value, const char *option)
return 0; return 0;
} }
return 1; return 1;
} /* end want_arg() */ }
/*****************************************************************************/
/* /*
* check that there's no subsequent value * check that there's no subsequent value
*/ */
...@@ -150,9 +146,8 @@ static int want_no_value(char *const *_value, const char *option) ...@@ -150,9 +146,8 @@ static int want_no_value(char *const *_value, const char *option)
return 0; return 0;
} }
return 1; return 1;
} /* end want_no_value() */ }
/*****************************************************************************/
/* /*
* parse the mount options * parse the mount options
* - this function has been shamelessly adapted from the ext3 fs which * - this function has been shamelessly adapted from the ext3 fs which
...@@ -183,14 +178,12 @@ static int afs_super_parse_options(struct afs_mount_params *params, ...@@ -183,14 +178,12 @@ static int afs_super_parse_options(struct afs_mount_params *params,
return -EINVAL; return -EINVAL;
params->rwpath = 1; params->rwpath = 1;
continue; continue;
} } else if (strcmp(key, "vol") == 0) {
else if (strcmp(key, "vol") == 0) {
if (!want_arg(&value, "vol")) if (!want_arg(&value, "vol"))
return -EINVAL; return -EINVAL;
*devname = value; *devname = value;
continue; continue;
} } else if (strcmp(key, "cell") == 0) {
else if (strcmp(key, "cell") == 0) {
if (!want_arg(&value, "cell")) if (!want_arg(&value, "cell"))
return -EINVAL; return -EINVAL;
afs_put_cell(params->default_cell); afs_put_cell(params->default_cell);
...@@ -209,12 +202,11 @@ static int afs_super_parse_options(struct afs_mount_params *params, ...@@ -209,12 +202,11 @@ static int afs_super_parse_options(struct afs_mount_params *params,
ret = 0; ret = 0;
error: error:
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
} /* end afs_super_parse_options() */ }
/*****************************************************************************/
/* /*
* check a superblock to see if it's the one we're looking for * check a superblock to see if it's the one we're looking for
*/ */
...@@ -224,9 +216,8 @@ static int afs_test_super(struct super_block *sb, void *data) ...@@ -224,9 +216,8 @@ static int afs_test_super(struct super_block *sb, void *data)
struct afs_super_info *as = sb->s_fs_info; struct afs_super_info *as = sb->s_fs_info;
return as->volume == params->volume; return as->volume == params->volume;
} /* end afs_test_super() */ }
/*****************************************************************************/
/* /*
* fill in the superblock * fill in the superblock
*/ */
...@@ -276,7 +267,7 @@ static int afs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -276,7 +267,7 @@ static int afs_fill_super(struct super_block *sb, void *data, int silent)
kleave(" = 0"); kleave(" = 0");
return 0; return 0;
error: error:
iput(inode); iput(inode);
afs_put_volume(as->volume); afs_put_volume(as->volume);
kfree(as); kfree(as);
...@@ -285,9 +276,8 @@ static int afs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -285,9 +276,8 @@ static int afs_fill_super(struct super_block *sb, void *data, int silent)
kleave(" = %d", ret); kleave(" = %d", ret);
return ret; return ret;
} /* end afs_fill_super() */ }
/*****************************************************************************/
/* /*
* get an AFS superblock * get an AFS superblock
* - TODO: don't use get_sb_nodev(), but rather call sget() directly * - TODO: don't use get_sb_nodev(), but rather call sget() directly
...@@ -354,15 +344,14 @@ static int afs_get_sb(struct file_system_type *fs_type, ...@@ -354,15 +344,14 @@ static int afs_get_sb(struct file_system_type *fs_type,
_leave(" = 0 [%p]", 0, sb); _leave(" = 0 [%p]", 0, sb);
return 0; return 0;
error: error:
afs_put_volume(params.volume); afs_put_volume(params.volume);
afs_put_cell(params.default_cell); afs_put_cell(params.default_cell);
afscm_stop(); afscm_stop();
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
} /* end afs_get_sb() */ }
/*****************************************************************************/
/* /*
* finish the unmounting process on the superblock * finish the unmounting process on the superblock
*/ */
...@@ -376,16 +365,15 @@ static void afs_put_super(struct super_block *sb) ...@@ -376,16 +365,15 @@ static void afs_put_super(struct super_block *sb)
afscm_stop(); afscm_stop();
_leave(""); _leave("");
} /* end afs_put_super() */ }
/*****************************************************************************/
/* /*
* initialise an inode cache slab element prior to any use * initialise an inode cache slab element prior to any use
*/ */
static void afs_i_init_once(void *_vnode, struct kmem_cache *cachep, static void afs_i_init_once(void *_vnode, struct kmem_cache *cachep,
unsigned long flags) unsigned long flags)
{ {
struct afs_vnode *vnode = (struct afs_vnode *) _vnode; struct afs_vnode *vnode = _vnode;
if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
SLAB_CTOR_CONSTRUCTOR) { SLAB_CTOR_CONSTRUCTOR) {
...@@ -398,10 +386,8 @@ static void afs_i_init_once(void *_vnode, struct kmem_cache *cachep, ...@@ -398,10 +386,8 @@ static void afs_i_init_once(void *_vnode, struct kmem_cache *cachep,
afs_timer_init(&vnode->cb_timeout, afs_timer_init(&vnode->cb_timeout,
&afs_vnode_cb_timed_out_ops); &afs_vnode_cb_timed_out_ops);
} }
}
} /* end afs_i_init_once() */
/*****************************************************************************/
/* /*
* allocate an AFS inode struct from our slab cache * allocate an AFS inode struct from our slab cache
*/ */
...@@ -409,8 +395,7 @@ static struct inode *afs_alloc_inode(struct super_block *sb) ...@@ -409,8 +395,7 @@ static struct inode *afs_alloc_inode(struct super_block *sb)
{ {
struct afs_vnode *vnode; struct afs_vnode *vnode;
vnode = (struct afs_vnode *) vnode = kmem_cache_alloc(afs_inode_cachep, GFP_KERNEL);
kmem_cache_alloc(afs_inode_cachep, GFP_KERNEL);
if (!vnode) if (!vnode)
return NULL; return NULL;
...@@ -424,9 +409,8 @@ static struct inode *afs_alloc_inode(struct super_block *sb) ...@@ -424,9 +409,8 @@ static struct inode *afs_alloc_inode(struct super_block *sb)
vnode->flags = 0; vnode->flags = 0;
return &vnode->vfs_inode; return &vnode->vfs_inode;
} /* end afs_alloc_inode() */ }
/*****************************************************************************/
/* /*
* destroy an AFS inode struct * destroy an AFS inode struct
*/ */
...@@ -435,7 +419,5 @@ static void afs_destroy_inode(struct inode *inode) ...@@ -435,7 +419,5 @@ static void afs_destroy_inode(struct inode *inode)
_enter("{%lu}", inode->i_ino); _enter("{%lu}", inode->i_ino);
kmem_cache_free(afs_inode_cachep, AFS_FS_I(inode)); kmem_cache_free(afs_inode_cachep, AFS_FS_I(inode));
atomic_dec(&afs_count_active_inodes); atomic_dec(&afs_count_active_inodes);
}
} /* end afs_destroy_inode() */
/* super.h: AFS filesystem internal private data /* AFS filesystem internal private data
* *
* Copyright (c) 2002 Red Hat, Inc. All rights reserved. * Copyright (c) 2002 Red Hat, Inc. All rights reserved.
* *
...@@ -14,21 +14,17 @@ ...@@ -14,21 +14,17 @@
* *
*/ */
#ifndef _LINUX_AFS_SUPER_H #ifndef AFS_SUPER_H
#define _LINUX_AFS_SUPER_H #define AFS_SUPER_H
#include <linux/fs.h> #include <linux/fs.h>
#include "server.h" #include "server.h"
#ifdef __KERNEL__
/*****************************************************************************/
/* /*
* AFS superblock private data * AFS superblock private data
* - there's one superblock per volume * - there's one superblock per volume
*/ */
struct afs_super_info struct afs_super_info {
{
struct afs_volume *volume; /* volume record */ struct afs_volume *volume; /* volume record */
char rwparent; /* T if parent is R/W AFS volume */ char rwparent; /* T if parent is R/W AFS volume */
}; };
...@@ -40,6 +36,4 @@ static inline struct afs_super_info *AFS_FS_S(struct super_block *sb) ...@@ -40,6 +36,4 @@ static inline struct afs_super_info *AFS_FS_S(struct super_block *sb)
extern struct file_system_type afs_fs_type; extern struct file_system_type afs_fs_type;
#endif /* __KERNEL__ */ #endif /* AFS_SUPER_H */
#endif /* _LINUX_AFS_SUPER_H */
/* transport.h: AFS transport management /* AFS transport management
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#ifndef _LINUX_AFS_TRANSPORT_H #ifndef AFS_TRANSPORT_H
#define _LINUX_AFS_TRANSPORT_H #define AFS_TRANSPORT_H
#include "types.h" #include "types.h"
#include <rxrpc/transport.h> #include <rxrpc/transport.h>
...@@ -18,4 +18,4 @@ ...@@ -18,4 +18,4 @@
/* the cache manager transport endpoint */ /* the cache manager transport endpoint */
extern struct rxrpc_transport *afs_transport; extern struct rxrpc_transport *afs_transport;
#endif /* _LINUX_AFS_TRANSPORT_H */ #endif /* AFS_TRANSPORT_H */
/* types.h: AFS types /* AFS types
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -9,12 +9,10 @@ ...@@ -9,12 +9,10 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#ifndef _LINUX_AFS_TYPES_H #ifndef AFS_TYPES_H
#define _LINUX_AFS_TYPES_H #define AFS_TYPES_H
#ifdef __KERNEL__
#include <rxrpc/types.h> #include <rxrpc/types.h>
#endif /* __KERNEL__ */
typedef unsigned afs_volid_t; typedef unsigned afs_volid_t;
typedef unsigned afs_vnodeid_t; typedef unsigned afs_vnodeid_t;
...@@ -33,23 +31,18 @@ typedef enum { ...@@ -33,23 +31,18 @@ typedef enum {
AFS_FTYPE_SYMLINK = 3, AFS_FTYPE_SYMLINK = 3,
} afs_file_type_t; } afs_file_type_t;
#ifdef __KERNEL__
struct afs_cell; struct afs_cell;
struct afs_vnode; struct afs_vnode;
/*****************************************************************************/
/* /*
* AFS file identifier * AFS file identifier
*/ */
struct afs_fid struct afs_fid {
{
afs_volid_t vid; /* volume ID */ afs_volid_t vid; /* volume ID */
afs_vnodeid_t vnode; /* file index within volume */ afs_vnodeid_t vnode; /* file index within volume */
unsigned unique; /* unique ID number (file index version) */ unsigned unique; /* unique ID number (file index version) */
}; };
/*****************************************************************************/
/* /*
* AFS callback notification * AFS callback notification
*/ */
...@@ -60,8 +53,7 @@ typedef enum { ...@@ -60,8 +53,7 @@ typedef enum {
AFSCM_CB_DROPPED = 3, /* CB promise cancelled by file server */ AFSCM_CB_DROPPED = 3, /* CB promise cancelled by file server */
} afs_callback_type_t; } afs_callback_type_t;
struct afs_callback struct afs_callback {
{
struct afs_server *server; /* server that made the promise */ struct afs_server *server; /* server that made the promise */
struct afs_fid fid; /* file identifier */ struct afs_fid fid; /* file identifier */
unsigned version; /* callback version */ unsigned version; /* callback version */
...@@ -71,12 +63,10 @@ struct afs_callback ...@@ -71,12 +63,10 @@ struct afs_callback
#define AFSCBMAX 50 #define AFSCBMAX 50
/*****************************************************************************/
/* /*
* AFS volume information * AFS volume information
*/ */
struct afs_volume_info struct afs_volume_info {
{
afs_volid_t vid; /* volume ID */ afs_volid_t vid; /* volume ID */
afs_voltype_t type; /* type of this volume */ afs_voltype_t type; /* type of this volume */
afs_volid_t type_vids[5]; /* volume ID's for possible types for this vol */ afs_volid_t type_vids[5]; /* volume ID's for possible types for this vol */
...@@ -88,12 +78,10 @@ struct afs_volume_info ...@@ -88,12 +78,10 @@ struct afs_volume_info
} servers[8]; } servers[8];
}; };
/*****************************************************************************/
/* /*
* AFS file status information * AFS file status information
*/ */
struct afs_file_status struct afs_file_status {
{
unsigned if_version; /* interface version */ unsigned if_version; /* interface version */
#define AFS_FSTATUS_VERSION 1 #define AFS_FSTATUS_VERSION 1
...@@ -111,15 +99,11 @@ struct afs_file_status ...@@ -111,15 +99,11 @@ struct afs_file_status
time_t mtime_server; /* last time server changed data */ time_t mtime_server; /* last time server changed data */
}; };
/*****************************************************************************/
/* /*
* AFS volume synchronisation information * AFS volume synchronisation information
*/ */
struct afs_volsync struct afs_volsync {
{
time_t creation; /* volume creation time */ time_t creation; /* volume creation time */
}; };
#endif /* __KERNEL__ */ #endif /* AFS_TYPES_H */
#endif /* _LINUX_AFS_TYPES_H */
/* vlclient.c: AFS Volume Location Service client /* AFS Volume Location Service client
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
static void afs_rxvl_get_entry_by_id_attn(struct rxrpc_call *call); static void afs_rxvl_get_entry_by_id_attn(struct rxrpc_call *call);
static void afs_rxvl_get_entry_by_id_error(struct rxrpc_call *call); static void afs_rxvl_get_entry_by_id_error(struct rxrpc_call *call);
/*****************************************************************************/
/* /*
* map afs VL abort codes to/from Linux error codes * map afs VL abort codes to/from Linux error codes
* - called with call->lock held * - called with call->lock held
...@@ -87,10 +86,9 @@ static void afs_rxvl_aemap(struct rxrpc_call *call) ...@@ -87,10 +86,9 @@ static void afs_rxvl_aemap(struct rxrpc_call *call)
default: default:
return; return;
} }
} /* end afs_rxvl_aemap() */ }
#if 0 #if 0
/*****************************************************************************/
/* /*
* probe a volume location server to see if it is still alive -- unused * probe a volume location server to see if it is still alive -- unused
*/ */
...@@ -159,24 +157,22 @@ static int afs_rxvl_probe(struct afs_server *server, int alloc_flags) ...@@ -159,24 +157,22 @@ static int afs_rxvl_probe(struct afs_server *server, int alloc_flags)
BUG(); BUG();
} }
abort: abort:
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
rxrpc_call_abort(call, ret); rxrpc_call_abort(call, ret);
schedule(); schedule();
out_unwait: out_unwait:
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
remove_wait_queue(&call->waitq, &myself); remove_wait_queue(&call->waitq, &myself);
rxrpc_put_call(call); rxrpc_put_call(call);
out_put_conn: out_put_conn:
rxrpc_put_connection(conn); rxrpc_put_connection(conn);
out: out:
return ret; return ret;
}
} /* end afs_rxvl_probe() */
#endif #endif
/*****************************************************************************/
/* /*
* look up a volume location database entry by name * look up a volume location database entry by name
*/ */
...@@ -294,24 +290,23 @@ int afs_rxvl_get_entry_by_name(struct afs_server *server, ...@@ -294,24 +290,23 @@ int afs_rxvl_get_entry_by_name(struct afs_server *server,
entry->rtime = get_seconds(); entry->rtime = get_seconds();
ret = 0; ret = 0;
out_unwait: out_unwait:
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
remove_wait_queue(&call->waitq, &myself); remove_wait_queue(&call->waitq, &myself);
rxrpc_put_call(call); rxrpc_put_call(call);
out_put_conn: out_put_conn:
rxrpc_put_connection(conn); rxrpc_put_connection(conn);
out: out:
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
abort: abort:
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
rxrpc_call_abort(call, ret); rxrpc_call_abort(call, ret);
schedule(); schedule();
goto out_unwait; goto out_unwait;
} /* end afs_rxvl_get_entry_by_name() */ }
/*****************************************************************************/
/* /*
* look up a volume location database entry by ID * look up a volume location database entry by ID
*/ */
...@@ -434,24 +429,23 @@ int afs_rxvl_get_entry_by_id(struct afs_server *server, ...@@ -434,24 +429,23 @@ int afs_rxvl_get_entry_by_id(struct afs_server *server,
entry->rtime = get_seconds(); entry->rtime = get_seconds();
ret = 0; ret = 0;
out_unwait: out_unwait:
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
remove_wait_queue(&call->waitq, &myself); remove_wait_queue(&call->waitq, &myself);
rxrpc_put_call(call); rxrpc_put_call(call);
out_put_conn: out_put_conn:
rxrpc_put_connection(conn); rxrpc_put_connection(conn);
out: out:
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
abort: abort:
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
rxrpc_call_abort(call, ret); rxrpc_call_abort(call, ret);
schedule(); schedule();
goto out_unwait; goto out_unwait;
} /* end afs_rxvl_get_entry_by_id() */ }
/*****************************************************************************/
/* /*
* look up a volume location database entry by ID asynchronously * look up a volume location database entry by ID asynchronously
*/ */
...@@ -533,14 +527,12 @@ int afs_rxvl_get_entry_by_id_async(struct afs_async_op *op, ...@@ -533,14 +527,12 @@ int afs_rxvl_get_entry_by_id_async(struct afs_async_op *op,
break; break;
} }
out: out:
rxrpc_put_call(call); rxrpc_put_call(call);
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
}
} /* end afs_rxvl_get_entry_by_id_async() */
/*****************************************************************************/
/* /*
* attend to the asynchronous get VLDB entry by ID * attend to the asynchronous get VLDB entry by ID
*/ */
...@@ -630,14 +622,13 @@ int afs_rxvl_get_entry_by_id_async2(struct afs_async_op *op, ...@@ -630,14 +622,13 @@ int afs_rxvl_get_entry_by_id_async2(struct afs_async_op *op,
_leave(" = -EAGAIN"); _leave(" = -EAGAIN");
return -EAGAIN; return -EAGAIN;
done: done:
rxrpc_put_call(op->call); rxrpc_put_call(op->call);
op->call = NULL; op->call = NULL;
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
} /* end afs_rxvl_get_entry_by_id_async2() */ }
/*****************************************************************************/
/* /*
* handle attention events on an async get-entry-by-ID op * handle attention events on an async get-entry-by-ID op
* - called from krxiod * - called from krxiod
...@@ -674,10 +665,8 @@ static void afs_rxvl_get_entry_by_id_attn(struct rxrpc_call *call) ...@@ -674,10 +665,8 @@ static void afs_rxvl_get_entry_by_id_attn(struct rxrpc_call *call)
} }
_leave(""); _leave("");
}
} /* end afs_rxvl_get_entry_by_id_attn() */
/*****************************************************************************/
/* /*
* handle error events on an async get-entry-by-ID op * handle error events on an async get-entry-by-ID op
* - called from krxiod * - called from krxiod
...@@ -691,5 +680,4 @@ static void afs_rxvl_get_entry_by_id_error(struct rxrpc_call *call) ...@@ -691,5 +680,4 @@ static void afs_rxvl_get_entry_by_id_error(struct rxrpc_call *call)
afs_kafsasyncd_attend_op(op); afs_kafsasyncd_attend_op(op);
_leave(""); _leave("");
}
} /* end afs_rxvl_get_entry_by_id_error() */
/* vlclient.h: Volume Location Service client interface /* Volume Location Service client interface
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#ifndef _LINUX_AFS_VLCLIENT_H #ifndef AFS_VLCLIENT_H
#define _LINUX_AFS_VLCLIENT_H #define AFS_VLCLIENT_H
#include "types.h" #include "types.h"
...@@ -68,26 +68,18 @@ struct afs_vldbentry { ...@@ -68,26 +68,18 @@ struct afs_vldbentry {
#define AFS_VLSF_RWVOL 0x0004 /* this server holds a R/W instance of the volume */ #define AFS_VLSF_RWVOL 0x0004 /* this server holds a R/W instance of the volume */
#define AFS_VLSF_BACKVOL 0x0008 /* this server holds a backup instance of the volume */ #define AFS_VLSF_BACKVOL 0x0008 /* this server holds a backup instance of the volume */
} servers[8]; } servers[8];
}; };
/* look up a volume location database entry by name */ extern int afs_rxvl_get_entry_by_name(struct afs_server *, const char *,
extern int afs_rxvl_get_entry_by_name(struct afs_server *server, unsigned, struct afs_cache_vlocation *);
const char *volname, extern int afs_rxvl_get_entry_by_id(struct afs_server *, afs_volid_t,
unsigned volnamesz, afs_voltype_t,
struct afs_cache_vlocation *entry); struct afs_cache_vlocation *);
/* look up a volume location database entry by ID */
extern int afs_rxvl_get_entry_by_id(struct afs_server *server,
afs_volid_t volid,
afs_voltype_t voltype,
struct afs_cache_vlocation *entry);
extern int afs_rxvl_get_entry_by_id_async(struct afs_async_op *op, extern int afs_rxvl_get_entry_by_id_async(struct afs_async_op *,
afs_volid_t volid, afs_volid_t, afs_voltype_t);
afs_voltype_t voltype);
extern int afs_rxvl_get_entry_by_id_async2(struct afs_async_op *op, extern int afs_rxvl_get_entry_by_id_async2(struct afs_async_op *,
struct afs_cache_vlocation *entry); struct afs_cache_vlocation *);
#endif /* _LINUX_AFS_VLCLIENT_H */ #endif /* AFS_VLCLIENT_H */
/* vlocation.c: volume location management /* volume location management
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -73,7 +73,6 @@ struct cachefs_index_def afs_vlocation_cache_index_def = { ...@@ -73,7 +73,6 @@ struct cachefs_index_def afs_vlocation_cache_index_def = {
}; };
#endif #endif
/*****************************************************************************/
/* /*
* iterate through the VL servers in a cell until one of them admits knowing * iterate through the VL servers in a cell until one of them admits knowing
* about the volume in question * about the volume in question
...@@ -146,13 +145,11 @@ static int afs_vlocation_access_vl_by_name(struct afs_vlocation *vlocation, ...@@ -146,13 +145,11 @@ static int afs_vlocation_access_vl_by_name(struct afs_vlocation *vlocation,
cell->vl_curr_svix %= cell->vl_naddrs; cell->vl_curr_svix %= cell->vl_naddrs;
} }
out: out:
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
}
} /* end afs_vlocation_access_vl_by_name() */
/*****************************************************************************/
/* /*
* iterate through the VL servers in a cell until one of them admits knowing * iterate through the VL servers in a cell until one of them admits knowing
* about the volume in question * about the volume in question
...@@ -225,13 +222,11 @@ static int afs_vlocation_access_vl_by_id(struct afs_vlocation *vlocation, ...@@ -225,13 +222,11 @@ static int afs_vlocation_access_vl_by_id(struct afs_vlocation *vlocation,
cell->vl_curr_svix %= cell->vl_naddrs; cell->vl_curr_svix %= cell->vl_naddrs;
} }
out: out:
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
}
} /* end afs_vlocation_access_vl_by_id() */
/*****************************************************************************/
/* /*
* lookup volume location * lookup volume location
* - caller must have cell->vol_sem write-locked * - caller must have cell->vol_sem write-locked
...@@ -321,7 +316,7 @@ int afs_vlocation_lookup(struct afs_cell *cell, ...@@ -321,7 +316,7 @@ int afs_vlocation_lookup(struct afs_cell *cell,
goto found_on_vlserver; goto found_on_vlserver;
found_in_graveyard: found_in_graveyard:
/* found in the graveyard - resurrect */ /* found in the graveyard - resurrect */
_debug("found in graveyard"); _debug("found in graveyard");
atomic_inc(&vlocation->usage); atomic_inc(&vlocation->usage);
...@@ -331,16 +326,16 @@ int afs_vlocation_lookup(struct afs_cell *cell, ...@@ -331,16 +326,16 @@ int afs_vlocation_lookup(struct afs_cell *cell,
afs_kafstimod_del_timer(&vlocation->timeout); afs_kafstimod_del_timer(&vlocation->timeout);
goto active; goto active;
found_in_memory: found_in_memory:
/* found in memory - check to see if it's active */ /* found in memory - check to see if it's active */
_debug("found in memory"); _debug("found in memory");
atomic_inc(&vlocation->usage); atomic_inc(&vlocation->usage);
active: active:
active = 1; active = 1;
#ifdef AFS_CACHING_SUPPORT #ifdef AFS_CACHING_SUPPORT
found_in_cache: found_in_cache:
#endif #endif
/* try to look up a cached volume in the cell VL databases by ID */ /* try to look up a cached volume in the cell VL databases by ID */
_debug("found in cache"); _debug("found in cache");
...@@ -364,16 +359,13 @@ int afs_vlocation_lookup(struct afs_cell *cell, ...@@ -364,16 +359,13 @@ int afs_vlocation_lookup(struct afs_cell *cell,
if (vlocation->vldb.vidmask & AFS_VOL_VTM_RW) { if (vlocation->vldb.vidmask & AFS_VOL_VTM_RW) {
vid = vlocation->vldb.vid[0]; vid = vlocation->vldb.vid[0];
voltype = AFSVL_RWVOL; voltype = AFSVL_RWVOL;
} } else if (vlocation->vldb.vidmask & AFS_VOL_VTM_RO) {
else if (vlocation->vldb.vidmask & AFS_VOL_VTM_RO) {
vid = vlocation->vldb.vid[1]; vid = vlocation->vldb.vid[1];
voltype = AFSVL_ROVOL; voltype = AFSVL_ROVOL;
} } else if (vlocation->vldb.vidmask & AFS_VOL_VTM_BAK) {
else if (vlocation->vldb.vidmask & AFS_VOL_VTM_BAK) {
vid = vlocation->vldb.vid[2]; vid = vlocation->vldb.vid[2];
voltype = AFSVL_BACKVOL; voltype = AFSVL_BACKVOL;
} } else {
else {
BUG(); BUG();
vid = 0; vid = 0;
voltype = 0; voltype = 0;
...@@ -400,7 +392,7 @@ int afs_vlocation_lookup(struct afs_cell *cell, ...@@ -400,7 +392,7 @@ int afs_vlocation_lookup(struct afs_cell *cell,
goto error; goto error;
} }
found_on_vlserver: found_on_vlserver:
_debug("Done VL Lookup: %*.*s %02x { %08x(%x) %08x(%x) %08x(%x) }", _debug("Done VL Lookup: %*.*s %02x { %08x(%x) %08x(%x) %08x(%x) }",
namesz, namesz, name, namesz, namesz, name,
vldb.vidmask, vldb.vidmask,
...@@ -430,12 +422,11 @@ int afs_vlocation_lookup(struct afs_cell *cell, ...@@ -430,12 +422,11 @@ int afs_vlocation_lookup(struct afs_cell *cell,
_leave(" = 0 (%p)",vlocation); _leave(" = 0 (%p)",vlocation);
return 0; return 0;
error: error:
if (vlocation) { if (vlocation) {
if (active) { if (active) {
__afs_put_vlocation(vlocation); __afs_put_vlocation(vlocation);
} } else {
else {
list_del(&vlocation->link); list_del(&vlocation->link);
#ifdef AFS_CACHING_SUPPORT #ifdef AFS_CACHING_SUPPORT
cachefs_relinquish_cookie(vlocation->cache, 0); cachefs_relinquish_cookie(vlocation->cache, 0);
...@@ -447,9 +438,8 @@ int afs_vlocation_lookup(struct afs_cell *cell, ...@@ -447,9 +438,8 @@ int afs_vlocation_lookup(struct afs_cell *cell,
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
} /* end afs_vlocation_lookup() */ }
/*****************************************************************************/
/* /*
* finish using a volume location record * finish using a volume location record
* - caller must have cell->vol_sem write-locked * - caller must have cell->vol_sem write-locked
...@@ -489,9 +479,8 @@ static void __afs_put_vlocation(struct afs_vlocation *vlocation) ...@@ -489,9 +479,8 @@ static void __afs_put_vlocation(struct afs_vlocation *vlocation)
spin_unlock(&cell->vl_gylock); spin_unlock(&cell->vl_gylock);
_leave(" [killed]"); _leave(" [killed]");
} /* end __afs_put_vlocation() */ }
/*****************************************************************************/
/* /*
* finish using a volume location record * finish using a volume location record
*/ */
...@@ -504,9 +493,8 @@ void afs_put_vlocation(struct afs_vlocation *vlocation) ...@@ -504,9 +493,8 @@ void afs_put_vlocation(struct afs_vlocation *vlocation)
__afs_put_vlocation(vlocation); __afs_put_vlocation(vlocation);
up_write(&cell->vl_sem); up_write(&cell->vl_sem);
} }
} /* end afs_put_vlocation() */ }
/*****************************************************************************/
/* /*
* timeout vlocation record * timeout vlocation record
* - removes from the cell's graveyard if the usage count is zero * - removes from the cell's graveyard if the usage count is zero
...@@ -543,9 +531,8 @@ void afs_vlocation_do_timeout(struct afs_vlocation *vlocation) ...@@ -543,9 +531,8 @@ void afs_vlocation_do_timeout(struct afs_vlocation *vlocation)
kfree(vlocation); kfree(vlocation);
_leave(" [destroyed]"); _leave(" [destroyed]");
} /* end afs_vlocation_do_timeout() */ }
/*****************************************************************************/
/* /*
* send an update operation to the currently selected server * send an update operation to the currently selected server
*/ */
...@@ -564,16 +551,13 @@ static int afs_vlocation_update_begin(struct afs_vlocation *vlocation) ...@@ -564,16 +551,13 @@ static int afs_vlocation_update_begin(struct afs_vlocation *vlocation)
if (vlocation->vldb.vidmask & AFS_VOL_VTM_RW) { if (vlocation->vldb.vidmask & AFS_VOL_VTM_RW) {
vid = vlocation->vldb.vid[0]; vid = vlocation->vldb.vid[0];
voltype = AFSVL_RWVOL; voltype = AFSVL_RWVOL;
} } else if (vlocation->vldb.vidmask & AFS_VOL_VTM_RO) {
else if (vlocation->vldb.vidmask & AFS_VOL_VTM_RO) {
vid = vlocation->vldb.vid[1]; vid = vlocation->vldb.vid[1];
voltype = AFSVL_ROVOL; voltype = AFSVL_ROVOL;
} } else if (vlocation->vldb.vidmask & AFS_VOL_VTM_BAK) {
else if (vlocation->vldb.vidmask & AFS_VOL_VTM_BAK) {
vid = vlocation->vldb.vid[2]; vid = vlocation->vldb.vid[2];
voltype = AFSVL_BACKVOL; voltype = AFSVL_BACKVOL;
} } else {
else {
BUG(); BUG();
vid = 0; vid = 0;
voltype = 0; voltype = 0;
...@@ -604,9 +588,8 @@ static int afs_vlocation_update_begin(struct afs_vlocation *vlocation) ...@@ -604,9 +588,8 @@ static int afs_vlocation_update_begin(struct afs_vlocation *vlocation)
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
} /* end afs_vlocation_update_begin() */ }
/*****************************************************************************/
/* /*
* abandon updating a VL record * abandon updating a VL record
* - does not restart the update timer * - does not restart the update timer
...@@ -634,9 +617,8 @@ static void afs_vlocation_update_abandon(struct afs_vlocation *vlocation, ...@@ -634,9 +617,8 @@ static void afs_vlocation_update_abandon(struct afs_vlocation *vlocation,
spin_unlock(&afs_vlocation_update_lock); spin_unlock(&afs_vlocation_update_lock);
_leave(""); _leave("");
} /* end afs_vlocation_update_abandon() */ }
/*****************************************************************************/
/* /*
* handle periodic update timeouts and busy retry timeouts * handle periodic update timeouts and busy retry timeouts
* - called from kafstimod * - called from kafstimod
...@@ -663,8 +645,7 @@ static void afs_vlocation_update_timer(struct afs_timer *timer) ...@@ -663,8 +645,7 @@ static void afs_vlocation_update_timer(struct afs_timer *timer)
if (afs_vlocation_update) { if (afs_vlocation_update) {
list_add(&vlocation->upd_op.link, list_add(&vlocation->upd_op.link,
&afs_vlocation_update_pendq); &afs_vlocation_update_pendq);
} } else {
else {
afs_get_vlocation(vlocation); afs_get_vlocation(vlocation);
afs_vlocation_update = vlocation; afs_vlocation_update = vlocation;
vlocation->upd_state = AFS_VLUPD_INPROGRESS; vlocation->upd_state = AFS_VLUPD_INPROGRESS;
...@@ -706,16 +687,13 @@ static void afs_vlocation_update_timer(struct afs_timer *timer) ...@@ -706,16 +687,13 @@ static void afs_vlocation_update_timer(struct afs_timer *timer)
_leave(""); _leave("");
return; return;
out_unlock2: out_unlock2:
spin_unlock(&afs_vlocation_update_lock); spin_unlock(&afs_vlocation_update_lock);
out_unlock1: out_unlock1:
spin_unlock(&vlocation->cell->vl_gylock); spin_unlock(&vlocation->cell->vl_gylock);
_leave(""); _leave("");
return; }
} /* end afs_vlocation_update_timer() */
/*****************************************************************************/
/* /*
* attend to an update operation upon which an event happened * attend to an update operation upon which an event happened
* - called in kafsasyncd context * - called in kafsasyncd context
...@@ -818,7 +796,7 @@ static void afs_vlocation_update_attend(struct afs_async_op *op) ...@@ -818,7 +796,7 @@ static void afs_vlocation_update_attend(struct afs_async_op *op)
} }
/* try contacting the next server */ /* try contacting the next server */
try_next: try_next:
vlocation->upd_busy_cnt = 0; vlocation->upd_busy_cnt = 0;
/* discard the server record */ /* discard the server record */
...@@ -856,15 +834,13 @@ static void afs_vlocation_update_attend(struct afs_async_op *op) ...@@ -856,15 +834,13 @@ static void afs_vlocation_update_attend(struct afs_async_op *op)
} }
/* abandon the update */ /* abandon the update */
abandon: abandon:
afs_vlocation_update_abandon(vlocation, AFS_VLUPD_SLEEP, ret); afs_vlocation_update_abandon(vlocation, AFS_VLUPD_SLEEP, ret);
afs_kafstimod_add_timer(&vlocation->upd_timer, HZ * 10); afs_kafstimod_add_timer(&vlocation->upd_timer, HZ * 10);
afs_put_vlocation(vlocation); afs_put_vlocation(vlocation);
_leave(" [abandoned]"); _leave(" [abandoned]");
}
} /* end afs_vlocation_update_attend() */
/*****************************************************************************/
/* /*
* deal with an update operation being discarded * deal with an update operation being discarded
* - called in kafsasyncd context when it's dying due to rmmod * - called in kafsasyncd context when it's dying due to rmmod
...@@ -883,9 +859,8 @@ static void afs_vlocation_update_discard(struct afs_async_op *op) ...@@ -883,9 +859,8 @@ static void afs_vlocation_update_discard(struct afs_async_op *op)
afs_put_vlocation(vlocation); afs_put_vlocation(vlocation);
_leave(""); _leave("");
} /* end afs_vlocation_update_discard() */ }
/*****************************************************************************/
/* /*
* match a VLDB record stored in the cache * match a VLDB record stored in the cache
* - may also load target from entry * - may also load target from entry
...@@ -908,9 +883,7 @@ static cachefs_match_val_t afs_vlocation_cache_match(void *target, ...@@ -908,9 +883,7 @@ static cachefs_match_val_t afs_vlocation_cache_match(void *target,
vlocation->valid = 1; vlocation->valid = 1;
_leave(" = SUCCESS [c->m]"); _leave(" = SUCCESS [c->m]");
return CACHEFS_MATCH_SUCCESS; return CACHEFS_MATCH_SUCCESS;
} } else if (memcmp(&vlocation->vldb, vldb, sizeof(*vldb)) != 0) {
/* need to update cache if cached info differs */
else if (memcmp(&vlocation->vldb, vldb, sizeof(*vldb)) != 0) {
/* delete if VIDs for this name differ */ /* delete if VIDs for this name differ */
if (memcmp(&vlocation->vldb.vid, if (memcmp(&vlocation->vldb.vid,
&vldb->vid, &vldb->vid,
...@@ -921,8 +894,7 @@ static cachefs_match_val_t afs_vlocation_cache_match(void *target, ...@@ -921,8 +894,7 @@ static cachefs_match_val_t afs_vlocation_cache_match(void *target,
_leave(" = UPDATE"); _leave(" = UPDATE");
return CACHEFS_MATCH_SUCCESS_UPDATE; return CACHEFS_MATCH_SUCCESS_UPDATE;
} } else {
else {
_leave(" = SUCCESS"); _leave(" = SUCCESS");
return CACHEFS_MATCH_SUCCESS; return CACHEFS_MATCH_SUCCESS;
} }
...@@ -930,10 +902,9 @@ static cachefs_match_val_t afs_vlocation_cache_match(void *target, ...@@ -930,10 +902,9 @@ static cachefs_match_val_t afs_vlocation_cache_match(void *target,
_leave(" = FAILED"); _leave(" = FAILED");
return CACHEFS_MATCH_FAILED; return CACHEFS_MATCH_FAILED;
} /* end afs_vlocation_cache_match() */ }
#endif #endif
/*****************************************************************************/
/* /*
* update a VLDB record stored in the cache * update a VLDB record stored in the cache
*/ */
...@@ -946,6 +917,5 @@ static void afs_vlocation_cache_update(void *source, void *entry) ...@@ -946,6 +917,5 @@ static void afs_vlocation_cache_update(void *source, void *entry)
_enter(""); _enter("");
*vldb = vlocation->vldb; *vldb = vlocation->vldb;
}
} /* end afs_vlocation_cache_update() */
#endif #endif
/* vnode.c: AFS vnode management /* AFS vnode management
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -43,7 +43,6 @@ struct cachefs_index_def afs_vnode_cache_index_def = { ...@@ -43,7 +43,6 @@ struct cachefs_index_def afs_vnode_cache_index_def = {
}; };
#endif #endif
/*****************************************************************************/
/* /*
* handle a callback timing out * handle a callback timing out
* TODO: retain a ref to vnode struct for an outstanding callback timeout * TODO: retain a ref to vnode struct for an outstanding callback timeout
...@@ -78,9 +77,8 @@ static void afs_vnode_cb_timed_out(struct afs_timer *timer) ...@@ -78,9 +77,8 @@ static void afs_vnode_cb_timed_out(struct afs_timer *timer)
afs_put_server(oldserver); afs_put_server(oldserver);
_leave(""); _leave("");
} /* end afs_vnode_cb_timed_out() */ }
/*****************************************************************************/
/* /*
* finish off updating the recorded status of a file * finish off updating the recorded status of a file
* - starts callback expiry timer * - starts callback expiry timer
...@@ -105,7 +103,7 @@ static void afs_vnode_finalise_status_update(struct afs_vnode *vnode, ...@@ -105,7 +103,7 @@ static void afs_vnode_finalise_status_update(struct afs_vnode *vnode,
spin_lock(&afs_cb_hash_lock); spin_lock(&afs_cb_hash_lock);
list_move_tail(&vnode->cb_hash_link, list_move_tail(&vnode->cb_hash_link,
&afs_cb_hash(server, &vnode->fid)); &afs_cb_hash(server, &vnode->fid));
spin_unlock(&afs_cb_hash_lock); spin_unlock(&afs_cb_hash_lock);
/* swap ref to old callback server with that for new callback /* swap ref to old callback server with that for new callback
...@@ -122,13 +120,11 @@ static void afs_vnode_finalise_status_update(struct afs_vnode *vnode, ...@@ -122,13 +120,11 @@ static void afs_vnode_finalise_status_update(struct afs_vnode *vnode,
spin_lock(&server->cb_lock); spin_lock(&server->cb_lock);
list_add_tail(&vnode->cb_link, &server->cb_promises); list_add_tail(&vnode->cb_link, &server->cb_promises);
spin_unlock(&server->cb_lock); spin_unlock(&server->cb_lock);
} } else {
else {
/* same server */ /* same server */
oldserver = NULL; oldserver = NULL;
} }
} } else if (ret == -ENOENT) {
else if (ret == -ENOENT) {
/* the file was deleted - clear the callback timeout */ /* the file was deleted - clear the callback timeout */
oldserver = xchg(&vnode->cb_server, NULL); oldserver = xchg(&vnode->cb_server, NULL);
afs_kafstimod_del_timer(&vnode->cb_timeout); afs_kafstimod_del_timer(&vnode->cb_timeout);
...@@ -146,10 +142,8 @@ static void afs_vnode_finalise_status_update(struct afs_vnode *vnode, ...@@ -146,10 +142,8 @@ static void afs_vnode_finalise_status_update(struct afs_vnode *vnode,
afs_put_server(oldserver); afs_put_server(oldserver);
_leave(""); _leave("");
}
} /* end afs_vnode_finalise_status_update() */
/*****************************************************************************/
/* /*
* fetch file status from the volume * fetch file status from the volume
* - don't issue a fetch if: * - don't issue a fetch if:
...@@ -222,7 +216,7 @@ int afs_vnode_fetch_status(struct afs_vnode *vnode) ...@@ -222,7 +216,7 @@ int afs_vnode_fetch_status(struct afs_vnode *vnode)
return vnode->flags & AFS_VNODE_DELETED ? -ENOENT : 0; return vnode->flags & AFS_VNODE_DELETED ? -ENOENT : 0;
} }
get_anyway: get_anyway:
/* okay... we're going to have to initiate the op */ /* okay... we're going to have to initiate the op */
vnode->update_cnt++; vnode->update_cnt++;
...@@ -247,9 +241,8 @@ int afs_vnode_fetch_status(struct afs_vnode *vnode) ...@@ -247,9 +241,8 @@ int afs_vnode_fetch_status(struct afs_vnode *vnode)
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
} /* end afs_vnode_fetch_status() */ }
/*****************************************************************************/
/* /*
* fetch file data from the volume * fetch file data from the volume
* - TODO implement caching and server failover * - TODO implement caching and server failover
...@@ -290,10 +283,8 @@ int afs_vnode_fetch_data(struct afs_vnode *vnode, ...@@ -290,10 +283,8 @@ int afs_vnode_fetch_data(struct afs_vnode *vnode,
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
}
} /* end afs_vnode_fetch_data() */
/*****************************************************************************/
/* /*
* break any outstanding callback on a vnode * break any outstanding callback on a vnode
* - only relevent to server that issued it * - only relevent to server that issued it
...@@ -337,9 +328,8 @@ int afs_vnode_give_up_callback(struct afs_vnode *vnode) ...@@ -337,9 +328,8 @@ int afs_vnode_give_up_callback(struct afs_vnode *vnode)
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
} /* end afs_vnode_give_up_callback() */ }
/*****************************************************************************/
/* /*
* match a vnode record stored in the cache * match a vnode record stored in the cache
*/ */
...@@ -371,10 +361,9 @@ static cachefs_match_val_t afs_vnode_cache_match(void *target, ...@@ -371,10 +361,9 @@ static cachefs_match_val_t afs_vnode_cache_match(void *target,
_leave(" = SUCCESS"); _leave(" = SUCCESS");
return CACHEFS_MATCH_SUCCESS; return CACHEFS_MATCH_SUCCESS;
} /* end afs_vnode_cache_match() */ }
#endif #endif
/*****************************************************************************/
/* /*
* update a vnode record stored in the cache * update a vnode record stored in the cache
*/ */
...@@ -389,6 +378,5 @@ static void afs_vnode_cache_update(void *source, void *entry) ...@@ -389,6 +378,5 @@ static void afs_vnode_cache_update(void *source, void *entry)
cvnode->vnode_id = vnode->fid.vnode; cvnode->vnode_id = vnode->fid.vnode;
cvnode->vnode_unique = vnode->fid.unique; cvnode->vnode_unique = vnode->fid.unique;
cvnode->data_version = vnode->status.version; cvnode->data_version = vnode->status.version;
}
} /* end afs_vnode_cache_update() */
#endif #endif
/* vnode.h: AFS vnode record /* AFS vnode record
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -9,24 +9,22 @@ ...@@ -9,24 +9,22 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#ifndef _LINUX_AFS_VNODE_H #ifndef AFS_VNODE_H
#define _LINUX_AFS_VNODE_H #define AFS_VNODE_H
#include <linux/fs.h> #include <linux/fs.h>
#include "server.h" #include "server.h"
#include "kafstimod.h" #include "kafstimod.h"
#include "cache.h" #include "cache.h"
#ifdef __KERNEL__
struct afs_rxfs_fetch_descriptor; struct afs_rxfs_fetch_descriptor;
/*****************************************************************************/ extern struct afs_timer_ops afs_vnode_cb_timed_out_ops;
/* /*
* vnode catalogue entry * vnode catalogue entry
*/ */
struct afs_cache_vnode struct afs_cache_vnode {
{
afs_vnodeid_t vnode_id; /* vnode ID */ afs_vnodeid_t vnode_id; /* vnode ID */
unsigned vnode_unique; /* vnode ID uniquifier */ unsigned vnode_unique; /* vnode ID uniquifier */
afs_dataversion_t data_version; /* data version */ afs_dataversion_t data_version; /* data version */
...@@ -36,12 +34,10 @@ struct afs_cache_vnode ...@@ -36,12 +34,10 @@ struct afs_cache_vnode
extern struct cachefs_index_def afs_vnode_cache_index_def; extern struct cachefs_index_def afs_vnode_cache_index_def;
#endif #endif
/*****************************************************************************/
/* /*
* AFS inode private data * AFS inode private data
*/ */
struct afs_vnode struct afs_vnode {
{
struct inode vfs_inode; /* the VFS's inode record */ struct inode vfs_inode; /* the VFS's inode record */
struct afs_volume *volume; /* volume on which vnode resides */ struct afs_volume *volume; /* volume on which vnode resides */
...@@ -72,7 +68,7 @@ struct afs_vnode ...@@ -72,7 +68,7 @@ struct afs_vnode
static inline struct afs_vnode *AFS_FS_I(struct inode *inode) static inline struct afs_vnode *AFS_FS_I(struct inode *inode)
{ {
return container_of(inode,struct afs_vnode,vfs_inode); return container_of(inode, struct afs_vnode, vfs_inode);
} }
static inline struct inode *AFS_VNODE_TO_I(struct afs_vnode *vnode) static inline struct inode *AFS_VNODE_TO_I(struct afs_vnode *vnode)
...@@ -80,15 +76,9 @@ static inline struct inode *AFS_VNODE_TO_I(struct afs_vnode *vnode) ...@@ -80,15 +76,9 @@ static inline struct inode *AFS_VNODE_TO_I(struct afs_vnode *vnode)
return &vnode->vfs_inode; return &vnode->vfs_inode;
} }
extern int afs_vnode_fetch_status(struct afs_vnode *vnode); extern int afs_vnode_fetch_status(struct afs_vnode *);
extern int afs_vnode_fetch_data(struct afs_vnode *,
extern int afs_vnode_fetch_data(struct afs_vnode *vnode, struct afs_rxfs_fetch_descriptor *);
struct afs_rxfs_fetch_descriptor *desc); extern int afs_vnode_give_up_callback(struct afs_vnode *);
extern int afs_vnode_give_up_callback(struct afs_vnode *vnode);
extern struct afs_timer_ops afs_vnode_cb_timed_out_ops;
#endif /* __KERNEL__ */
#endif /* _LINUX_AFS_VNODE_H */ #endif /* AFS_VNODE_H */
/* volume.c: AFS volume management /* AFS volume management
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -43,7 +43,6 @@ struct cachefs_index_def afs_volume_cache_index_def = { ...@@ -43,7 +43,6 @@ struct cachefs_index_def afs_volume_cache_index_def = {
}; };
#endif #endif
/*****************************************************************************/
/* /*
* lookup a volume by name * lookup a volume by name
* - this can be one of the following: * - this can be one of the following:
...@@ -97,14 +96,11 @@ int afs_volume_lookup(const char *name, struct afs_cell *cell, int rwpath, ...@@ -97,14 +96,11 @@ int afs_volume_lookup(const char *name, struct afs_cell *cell, int rwpath,
if (strcmp(suffix, ".readonly") == 0) { if (strcmp(suffix, ".readonly") == 0) {
type = AFSVL_ROVOL; type = AFSVL_ROVOL;
force = 1; force = 1;
} } else if (strcmp(suffix, ".backup") == 0) {
else if (strcmp(suffix, ".backup") == 0) {
type = AFSVL_BACKVOL; type = AFSVL_BACKVOL;
force = 1; force = 1;
} } else if (suffix[1] == 0) {
else if (suffix[1] == 0) { } else {
}
else {
suffix = NULL; suffix = NULL;
} }
} }
...@@ -116,8 +112,7 @@ int afs_volume_lookup(const char *name, struct afs_cell *cell, int rwpath, ...@@ -116,8 +112,7 @@ int afs_volume_lookup(const char *name, struct afs_cell *cell, int rwpath,
cellname = name; cellname = name;
cellnamesz = volname - name; cellnamesz = volname - name;
volname++; volname++;
} } else {
else {
volname = name; volname = name;
cellname = NULL; cellname = NULL;
cellnamesz = 0; cellnamesz = 0;
...@@ -139,8 +134,7 @@ int afs_volume_lookup(const char *name, struct afs_cell *cell, int rwpath, ...@@ -139,8 +134,7 @@ int afs_volume_lookup(const char *name, struct afs_cell *cell, int rwpath,
cellname ?: ""); cellname ?: "");
goto error; goto error;
} }
} } else {
else {
afs_get_cell(cell); afs_get_cell(cell);
} }
...@@ -161,14 +155,11 @@ int afs_volume_lookup(const char *name, struct afs_cell *cell, int rwpath, ...@@ -161,14 +155,11 @@ int afs_volume_lookup(const char *name, struct afs_cell *cell, int rwpath,
if (force) { if (force) {
if (!(srvtmask & (1 << type))) if (!(srvtmask & (1 << type)))
goto error; goto error;
} } else if (srvtmask & AFS_VOL_VTM_RO) {
else if (srvtmask & AFS_VOL_VTM_RO) {
type = AFSVL_ROVOL; type = AFSVL_ROVOL;
} } else if (srvtmask & AFS_VOL_VTM_RW) {
else if (srvtmask & AFS_VOL_VTM_RW) {
type = AFSVL_RWVOL; type = AFSVL_RWVOL;
} } else {
else {
goto error; goto error;
} }
...@@ -225,23 +216,23 @@ int afs_volume_lookup(const char *name, struct afs_cell *cell, int rwpath, ...@@ -225,23 +216,23 @@ int afs_volume_lookup(const char *name, struct afs_cell *cell, int rwpath,
vlocation->vols[type] = volume; vlocation->vols[type] = volume;
success: success:
_debug("kAFS selected %s volume %08x", _debug("kAFS selected %s volume %08x",
afs_voltypes[volume->type], volume->vid); afs_voltypes[volume->type], volume->vid);
*_volume = volume; *_volume = volume;
ret = 0; ret = 0;
/* clean up */ /* clean up */
error_up: error_up:
up_write(&cell->vl_sem); up_write(&cell->vl_sem);
error: error:
afs_put_vlocation(vlocation); afs_put_vlocation(vlocation);
afs_put_cell(cell); afs_put_cell(cell);
_leave(" = %d (%p)", ret, volume); _leave(" = %d (%p)", ret, volume);
return ret; return ret;
error_discard: error_discard:
up_write(&cell->vl_sem); up_write(&cell->vl_sem);
for (loop = volume->nservers - 1; loop >= 0; loop--) for (loop = volume->nservers - 1; loop >= 0; loop--)
...@@ -249,9 +240,8 @@ int afs_volume_lookup(const char *name, struct afs_cell *cell, int rwpath, ...@@ -249,9 +240,8 @@ int afs_volume_lookup(const char *name, struct afs_cell *cell, int rwpath,
kfree(volume); kfree(volume);
goto error; goto error;
} /* end afs_volume_lookup() */ }
/*****************************************************************************/
/* /*
* destroy a volume record * destroy a volume record
*/ */
...@@ -296,9 +286,8 @@ void afs_put_volume(struct afs_volume *volume) ...@@ -296,9 +286,8 @@ void afs_put_volume(struct afs_volume *volume)
kfree(volume); kfree(volume);
_leave(" [destroyed]"); _leave(" [destroyed]");
} /* end afs_put_volume() */ }
/*****************************************************************************/
/* /*
* pick a server to use to try accessing this volume * pick a server to use to try accessing this volume
* - returns with an elevated usage count on the server chosen * - returns with an elevated usage count on the server chosen
...@@ -373,9 +362,8 @@ int afs_volume_pick_fileserver(struct afs_volume *volume, ...@@ -373,9 +362,8 @@ int afs_volume_pick_fileserver(struct afs_volume *volume,
up_read(&volume->server_sem); up_read(&volume->server_sem);
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
} /* end afs_volume_pick_fileserver() */ }
/*****************************************************************************/
/* /*
* release a server after use * release a server after use
* - releases the ref on the server struct that was acquired by picking * - releases the ref on the server struct that was acquired by picking
...@@ -469,16 +457,14 @@ int afs_volume_release_fileserver(struct afs_volume *volume, ...@@ -469,16 +457,14 @@ int afs_volume_release_fileserver(struct afs_volume *volume,
return 1; return 1;
/* tell the caller to loop around and try the next server */ /* tell the caller to loop around and try the next server */
try_next_server_upw: try_next_server_upw:
up_write(&volume->server_sem); up_write(&volume->server_sem);
try_next_server: try_next_server:
afs_put_server(server); afs_put_server(server);
_leave(" [try next server]"); _leave(" [try next server]");
return 0; return 0;
}
} /* end afs_volume_release_fileserver() */
/*****************************************************************************/
/* /*
* match a volume hash record stored in the cache * match a volume hash record stored in the cache
*/ */
...@@ -498,10 +484,9 @@ static cachefs_match_val_t afs_volume_cache_match(void *target, ...@@ -498,10 +484,9 @@ static cachefs_match_val_t afs_volume_cache_match(void *target,
_leave(" = FAILED"); _leave(" = FAILED");
return CACHEFS_MATCH_FAILED; return CACHEFS_MATCH_FAILED;
} /* end afs_volume_cache_match() */ }
#endif #endif
/*****************************************************************************/
/* /*
* update a volume hash record stored in the cache * update a volume hash record stored in the cache
*/ */
...@@ -514,6 +499,5 @@ static void afs_volume_cache_update(void *source, void *entry) ...@@ -514,6 +499,5 @@ static void afs_volume_cache_update(void *source, void *entry)
_enter(""); _enter("");
vhash->vtype = volume->type; vhash->vtype = volume->type;
}
} /* end afs_volume_cache_update() */
#endif #endif
/* volume.h: AFS volume management /* AFS volume management
* *
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#ifndef _LINUX_AFS_VOLUME_H #ifndef AFS_VOLUME_H
#define _LINUX_AFS_VOLUME_H #define AFS_VOLUME_H
#include "types.h" #include "types.h"
#include "fsclient.h" #include "fsclient.h"
...@@ -23,15 +23,12 @@ typedef enum { ...@@ -23,15 +23,12 @@ typedef enum {
AFS_VLUPD_PENDING, /* on pending queue */ AFS_VLUPD_PENDING, /* on pending queue */
AFS_VLUPD_INPROGRESS, /* op in progress */ AFS_VLUPD_INPROGRESS, /* op in progress */
AFS_VLUPD_BUSYSLEEP, /* sleeping because server returned EBUSY */ AFS_VLUPD_BUSYSLEEP, /* sleeping because server returned EBUSY */
} __attribute__((packed)) afs_vlocation_upd_t; } __attribute__((packed)) afs_vlocation_upd_t;
/*****************************************************************************/
/* /*
* entry in the cached volume location catalogue * entry in the cached volume location catalogue
*/ */
struct afs_cache_vlocation struct afs_cache_vlocation {
{
uint8_t name[64]; /* volume name (lowercase, padded with NULs) */ uint8_t name[64]; /* volume name (lowercase, padded with NULs) */
uint8_t nservers; /* number of entries used in servers[] */ uint8_t nservers; /* number of entries used in servers[] */
uint8_t vidmask; /* voltype mask for vid[] */ uint8_t vidmask; /* voltype mask for vid[] */
...@@ -49,12 +46,10 @@ struct afs_cache_vlocation ...@@ -49,12 +46,10 @@ struct afs_cache_vlocation
extern struct cachefs_index_def afs_vlocation_cache_index_def; extern struct cachefs_index_def afs_vlocation_cache_index_def;
#endif #endif
/*****************************************************************************/
/* /*
* volume -> vnode hash table entry * volume -> vnode hash table entry
*/ */
struct afs_cache_vhash struct afs_cache_vhash {
{
afs_voltype_t vtype; /* which volume variation */ afs_voltype_t vtype; /* which volume variation */
uint8_t hash_bucket; /* which hash bucket this represents */ uint8_t hash_bucket; /* which hash bucket this represents */
} __attribute__((packed)); } __attribute__((packed));
...@@ -63,12 +58,10 @@ struct afs_cache_vhash ...@@ -63,12 +58,10 @@ struct afs_cache_vhash
extern struct cachefs_index_def afs_volume_cache_index_def; extern struct cachefs_index_def afs_volume_cache_index_def;
#endif #endif
/*****************************************************************************/
/* /*
* AFS volume location record * AFS volume location record
*/ */
struct afs_vlocation struct afs_vlocation {
{
atomic_t usage; atomic_t usage;
struct list_head link; /* link in cell volume location list */ struct list_head link; /* link in cell volume location list */
struct afs_timer timeout; /* decaching timer */ struct afs_timer timeout; /* decaching timer */
...@@ -90,22 +83,18 @@ struct afs_vlocation ...@@ -90,22 +83,18 @@ struct afs_vlocation
unsigned short valid; /* T if valid */ unsigned short valid; /* T if valid */
}; };
extern int afs_vlocation_lookup(struct afs_cell *cell, extern int afs_vlocation_lookup(struct afs_cell *, const char *, unsigned,
const char *name, struct afs_vlocation **);
unsigned namesz,
struct afs_vlocation **_vlocation);
#define afs_get_vlocation(V) do { atomic_inc(&(V)->usage); } while(0) #define afs_get_vlocation(V) do { atomic_inc(&(V)->usage); } while(0)
extern void afs_put_vlocation(struct afs_vlocation *vlocation); extern void afs_put_vlocation(struct afs_vlocation *);
extern void afs_vlocation_do_timeout(struct afs_vlocation *vlocation); extern void afs_vlocation_do_timeout(struct afs_vlocation *);
/*****************************************************************************/
/* /*
* AFS volume access record * AFS volume access record
*/ */
struct afs_volume struct afs_volume {
{
atomic_t usage; atomic_t usage;
struct afs_cell *cell; /* cell to which belongs (unrefd ptr) */ struct afs_cell *cell; /* cell to which belongs (unrefd ptr) */
struct afs_vlocation *vlocation; /* volume location */ struct afs_vlocation *vlocation; /* volume location */
...@@ -121,20 +110,17 @@ struct afs_volume ...@@ -121,20 +110,17 @@ struct afs_volume
struct rw_semaphore server_sem; /* lock for accessing current server */ struct rw_semaphore server_sem; /* lock for accessing current server */
}; };
extern int afs_volume_lookup(const char *name, extern int afs_volume_lookup(const char *, struct afs_cell *, int,
struct afs_cell *cell, struct afs_volume **);
int rwpath,
struct afs_volume **_volume);
#define afs_get_volume(V) do { atomic_inc(&(V)->usage); } while(0) #define afs_get_volume(V) do { atomic_inc(&(V)->usage); } while(0)
extern void afs_put_volume(struct afs_volume *volume); extern void afs_put_volume(struct afs_volume *);
extern int afs_volume_pick_fileserver(struct afs_volume *volume, extern int afs_volume_pick_fileserver(struct afs_volume *,
struct afs_server **_server); struct afs_server **);
extern int afs_volume_release_fileserver(struct afs_volume *volume, extern int afs_volume_release_fileserver(struct afs_volume *,
struct afs_server *server, struct afs_server *, int);
int result);
#endif /* _LINUX_AFS_VOLUME_H */ #endif /* AFS_VOLUME_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment