Commit 839e0e16 authored by Jan Harkes's avatar Jan Harkes Committed by Linus Torvalds

[PATCH] 2.5.6-pre2 - Coda fixes and cleanups

Here is a batch of accumulated bugfixes and cleanups for the Coda kernel
module. Patch is against 2.5.6-pre2, I could also send these as separate
patches.

bugfix: Fix coda_dentry_revalidate bug

    Due to a bad test, coda_dentry_revalidate was forcing revalidation
    of cacheable inodes, and allowed caching of non-cacheable inodes.

bugfix: Corrected i_mtime/i_ctime setting

    i_mtime and i_ctime were not always updated when writing to a file,
    or when modifying inode attributes.

cleanup/optimization: Avoid getattr upcalls

    We can use coda_iget directly instead of coda_cnode_make when an
    upcall returns attributes and avoid the getattr upcall altogether.

cleanup: Removed debugging messages

    CDEBUG macros haven't been useful ever since the initial development
    when they were introduced. They are too verbose for debugging
    purposes. Removing these saves about a third of the compiled size of
    the module.

    Removed print_entry variable that was used by ENTRY/EXIT macros
    which are already gone.

cleanup/optimization: Readdir simplification

    Relying on the fact that the pagecache is already buffering far more
    efficiently, simplified coda_readdir implementation. We can now fill
    the complete userbuffer instead of returning after reading only 2KB.

    Passing dir entry types that are present in the venus_dirent
    structure to the user as well.

cleanup: Removed redundant permissions statistics counters.

    The permission check count is about identical to the 'permission'
    field in the VFS stats, and the permission hit counter can trivially
    be derived from upcall_stats.access - vfs_stats.permission. Removed
    these redundant counters.

cleanup: Removed useless test for c_flags in coda_revalidate_inode.

    We already know c_flags is set due to earlier tests.
parent fecb0199
......@@ -71,7 +71,6 @@ int coda_cache_check(struct inode *inode, int mask)
hit = ((mask & cii->c_cached_perm) == mask) &&
coda_cred_ok(&cii->c_cached_cred);
CDEBUG(D_CACHE, "%s for ino %ld\n", hit ? "HIT" : "MISS", inode->i_ino);
return hit;
}
......@@ -102,9 +101,6 @@ static void coda_flag_children(struct dentry *parent, int flag)
/* don't know what to do with negative dentries */
if ( ! de->d_inode )
continue;
CDEBUG(D_DOWNCALL, "%d for %*s/%*s\n", flag,
de->d_name.len, de->d_name.name,
de->d_parent->d_name.len, de->d_parent->d_name.name);
coda_flag_inode(de->d_inode, flag);
}
spin_unlock(&dcache_lock);
......
......@@ -11,9 +11,6 @@
#include <linux/coda_fs_i.h>
#include <linux/coda_psdev.h>
extern int coda_debug;
extern int coda_print_entry;
inline int coda_fideq(ViceFid *fid1, ViceFid *fid2)
{
if (fid1->Vnode != fid2->Vnode) return 0;
......@@ -42,11 +39,6 @@ static struct inode_operations coda_symlink_inode_operations = {
/* cnode.c */
static void coda_fill_inode(struct inode *inode, struct coda_vattr *attr)
{
CDEBUG(D_SUPER, "ino: %ld\n", inode->i_ino);
if (coda_debug & D_SUPER )
print_vattr(attr);
coda_vattr_to_iattr(inode, attr);
if (S_ISREG(inode->i_mode)) {
......@@ -72,10 +64,8 @@ struct inode * coda_iget(struct super_block * sb, ViceFid * fid,
inode = iget4(sb, ino, coda_inocmp, fid);
if ( !inode ) {
CDEBUG(D_CNODE, "coda_iget: no inode\n");
if (!inode)
return ERR_PTR(-ENOMEM);
}
/* check if the inode is already initialized */
cii = ITOC(inode);
......@@ -105,9 +95,6 @@ int coda_cnode_make(struct inode **inode, ViceFid *fid, struct super_block *sb)
/* We get inode numbers from Venus -- see venus source */
error = venus_getattr(sb, fid, &attr);
if ( error ) {
CDEBUG(D_CNODE,
"coda_cnode_make: coda_getvattr returned %d for %s.\n",
error, coda_f2s(fid));
*inode = NULL;
return error;
}
......@@ -117,10 +104,6 @@ int coda_cnode_make(struct inode **inode, ViceFid *fid, struct super_block *sb)
printk("coda_cnode_make: coda_iget failed\n");
return PTR_ERR(*inode);
}
CDEBUG(D_DOWNCALL, "Done making inode: ino %ld, count %d with %s\n",
(*inode)->i_ino, atomic_read(&(*inode)->i_count),
coda_f2s(&ITOC(*inode)->c_fid));
return 0;
}
......@@ -155,8 +138,6 @@ struct inode *coda_fid_to_inode(ViceFid *fid, struct super_block *sb)
return NULL;
}
CDEBUG(D_INODE, "%s\n", coda_f2s(fid));
nr = coda_f2i(fid);
inode = iget4(sb, nr, coda_inocmp, fid);
if ( !inode ) {
......@@ -177,7 +158,6 @@ struct inode *coda_fid_to_inode(ViceFid *fid, struct super_block *sb)
/* we shouldn't see inode collisions anymore */
if ( !coda_fideq(fid, &cii->c_fid) ) BUG();
CDEBUG(D_INODE, "found %ld\n", inode->i_ino);
return inode;
}
......
......@@ -24,9 +24,6 @@
#include <linux/coda_fs_i.h>
/* initialize the debugging variables */
int coda_debug;
int coda_print_entry;
int coda_access_cache = 1;
int coda_fake_statfs;
/* print a fid */
......@@ -92,35 +89,23 @@ unsigned short coda_flags_to_cflags(unsigned short flags)
{
unsigned short coda_flags = 0;
if ( (flags & O_ACCMODE) == O_RDONLY ){
CDEBUG(D_FILE, "--> C_O_READ added\n");
if ((flags & O_ACCMODE) == O_RDONLY)
coda_flags |= C_O_READ;
}
if ( (flags & O_ACCMODE) == O_RDWR ) {
CDEBUG(D_FILE, "--> C_O_READ | C_O_WRITE added\n");
if ((flags & O_ACCMODE) == O_RDWR)
coda_flags |= C_O_READ | C_O_WRITE;
}
if ( (flags & O_ACCMODE) == O_WRONLY ){
CDEBUG(D_FILE, "--> C_O_WRITE added\n");
if ((flags & O_ACCMODE) == O_WRONLY)
coda_flags |= C_O_WRITE;
}
if ( flags & O_TRUNC ) {
CDEBUG(D_FILE, "--> C_O_TRUNC added\n");
if (flags & O_TRUNC)
coda_flags |= C_O_TRUNC;
}
if ( flags & O_CREAT ) {
CDEBUG(D_FILE, "--> C_O_CREAT added\n");
if (flags & O_CREAT)
coda_flags |= C_O_CREAT;
}
if ( flags & O_EXCL ) {
if (flags & O_EXCL)
coda_flags |= C_O_EXCL;
CDEBUG(D_FILE, "--> C_O_EXCL added\n");
}
return coda_flags;
}
......
This diff is collapsed.
......@@ -69,6 +69,7 @@ coda_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos)
cfile->f_flags = flags;
inode->i_size = cinode->i_size;
inode->i_mtime = inode->i_ctime = CURRENT_TIME;
up(&inode->i_sem);
return ret;
......@@ -103,12 +104,8 @@ int coda_open(struct inode *i, struct file *f)
lock_kernel();
coda_vfs_stat.open++;
CDEBUG(D_SPECIAL, "OPEN inode number: %ld, count %d, flags %o.\n",
f->f_dentry->d_inode->i_ino, atomic_read(&f->f_dentry->d_count), flags);
error = venus_open(i->i_sb, coda_i2f(i), coda_flags, &fh);
if (error || !fh) {
CDEBUG(D_FILE, "coda_open: venus_open result %d\n", error);
unlock_kernel();
return error;
}
......@@ -132,12 +129,6 @@ int coda_open(struct inode *i, struct file *f)
f->private_data = cred;
}
CDEBUG(D_FILE, "result %d, coda i->i_count is %d, cii->contcount is %d for ino %ld\n",
error, atomic_read(&i->i_count), cii->c_contcount, i->i_ino);
CDEBUG(D_FILE, "cache ino: %ld, count %d, ops %p\n",
fh->f_dentry->d_inode->i_ino,
atomic_read(&fh->f_dentry->d_inode->i_count),
fh->f_dentry->d_inode->i_op);
unlock_kernel();
return 0;
}
......@@ -174,8 +165,6 @@ int coda_flush(struct file *file)
cinode = cfile->f_dentry->d_inode;
CDEBUG(D_FILE, "FLUSH coda (file %p ct %d)\n", file, fcnt);
err = venus_store(inode->i_sb, coda_i2f(inode), cflags,
(struct coda_cred *)file->private_data);
if (err == -EOPNOTSUPP) {
......@@ -183,7 +172,6 @@ int coda_flush(struct file *file)
err = 0;
}
CDEBUG(D_FILE, "coda_flush: result: %d\n", err);
return err;
}
......
......@@ -245,10 +245,6 @@ static void coda_clear_inode(struct inode *inode)
{
struct coda_inode_info *cii = ITOC(inode);
CDEBUG(D_SUPER, " inode->ino: %ld, count: %d\n",
inode->i_ino, atomic_read(&inode->i_count));
CDEBUG(D_DOWNCALL, "clearing inode: %ld, %x\n", inode->i_ino, cii->c_flags);
if (cii->c_container) BUG();
list_del_init(&cii->c_cilist);
......@@ -264,9 +260,9 @@ int coda_notify_change(struct dentry *de, struct iattr *iattr)
memset(&vattr, 0, sizeof(vattr));
inode->i_ctime = CURRENT_TIME;
coda_iattr_to_vattr(iattr, &vattr);
vattr.va_type = C_VNON; /* cannot set type */
CDEBUG(D_SUPER, "vattr.va_mode %o\n", vattr.va_mode);
/* Venus is responsible for truncating the container-file!!! */
error = venus_setattr(inode->i_sb, coda_i2f(inode), &vattr);
......@@ -275,7 +271,6 @@ int coda_notify_change(struct dentry *de, struct iattr *iattr)
coda_vattr_to_iattr(inode, &vattr);
coda_cache_clear_inode(inode);
}
CDEBUG(D_SUPER, "inode.i_mode %o, error %d\n", inode->i_mode, error);
return error;
}
......
......@@ -65,8 +65,6 @@ static int coda_pioctl(struct inode * inode, struct file * filp,
* Look up the pathname. Note that the pathname is in
* user memory, and namei takes care of this
*/
CDEBUG(D_PIOCTL, "namei, data.follow = %d\n",
data.follow);
if ( data.follow ) {
error = user_path_walk(data.path, &nd);
} else {
......@@ -74,15 +72,11 @@ static int coda_pioctl(struct inode * inode, struct file * filp,
}
if ( error ) {
CDEBUG(D_PIOCTL, "error: lookup fails.\n");
return error;
} else {
target_inode = nd.dentry->d_inode;
}
CDEBUG(D_PIOCTL, "target ino: 0x%ld, dev: 0x%x\n",
target_inode->i_ino, kdev_val(target_inode->i_dev));
/* return if it is not a Coda inode */
if ( target_inode->i_sb != inode->i_sb ) {
path_release(&nd);
......@@ -94,9 +88,6 @@ static int coda_pioctl(struct inode * inode, struct file * filp,
error = venus_pioctl(inode->i_sb, &(cnp->c_fid), cmd, &data);
CDEBUG(D_PIOCTL, "ioctl on inode %ld\n", target_inode->i_ino);
CDEBUG(D_DOWNCALL, "dput on ino: %ld, icount %d, dcount %d\n", target_inode->i_ino,
atomic_read(&target_inode->i_count), atomic_read(&nd.dentry->d_count));
path_release(&nd);
return error;
}
......
......@@ -114,9 +114,6 @@ static ssize_t coda_psdev_write(struct file *file, const char *buf,
if (copy_from_user(&hdr, buf, 2 * sizeof(u_long)))
return -EFAULT;
CDEBUG(D_PSDEV, "(process,opc,uniq)=(%d,%ld,%ld), nbytes %ld\n",
current->pid, hdr.opcode, hdr.unique, (long)nbytes);
if (DOWNCALL(hdr.opcode)) {
struct super_block *sb = NULL;
union outputArgs *dcbuf;
......@@ -124,11 +121,9 @@ static ssize_t coda_psdev_write(struct file *file, const char *buf,
sb = vcp->vc_sb;
if ( !sb ) {
CDEBUG(D_PSDEV, "coda_psdev_write: downcall, no SB!\n");
count = nbytes;
goto out;
}
CDEBUG(D_PSDEV, "handling downcall\n");
if ( nbytes < sizeof(struct coda_out_hdr) ) {
printk("coda_downcall opc %ld uniq %ld, not enough!\n",
......@@ -182,8 +177,6 @@ static ssize_t coda_psdev_write(struct file *file, const char *buf,
goto out;
}
CDEBUG(D_PSDEV,"Eureka: uniq %ld on queue!\n", hdr.unique);
/* move data into response buffer. */
if (req->uc_outSize < nbytes) {
printk("psdev_write: too much cnt: %d, cnt: %ld, opc: %ld, uniq: %ld.\n",
......@@ -209,10 +202,6 @@ static ssize_t coda_psdev_write(struct file *file, const char *buf,
outp->fh = fget(outp->fd);
}
CDEBUG(D_PSDEV,
"Found! Count %ld for (opc,uniq)=(%ld,%ld), upc_req at %p\n",
(long)count, hdr.opcode, hdr.unique, &req);
wake_up(&req->uc_sleep);
out:
return(count ? count : retval);
......@@ -277,9 +266,6 @@ static ssize_t coda_psdev_read(struct file * file, char * buf,
goto out;
}
CDEBUG(D_PSDEV, "vcread: signal msg (%d, %d)\n",
req->uc_opcode, req->uc_unique);
CODA_FREE(req->uc_data, sizeof(struct coda_in_hdr));
upc_free(req);
out:
......@@ -315,8 +301,6 @@ static int coda_psdev_open(struct inode * inode, struct file * file)
file->private_data = vcp;
CDEBUG(D_PSDEV, "device %i - inuse: %d\n", idx, vcp->vc_inuse);
unlock_kernel();
return 0;
}
......@@ -335,14 +319,12 @@ static int coda_psdev_release(struct inode * inode, struct file * file)
return -1;
}
CDEBUG(D_PSDEV, "psdev_release: inuse %d\n", vcp->vc_inuse);
if (--vcp->vc_inuse) {
unlock_kernel();
return 0;
}
/* Wakeup clients so they can return. */
CDEBUG(D_PSDEV, "wake up pending clients\n");
lh = vcp->vc_pending.next;
next = lh;
while ( (lh = next) != &vcp->vc_pending) {
......@@ -359,13 +341,11 @@ static int coda_psdev_release(struct inode * inode, struct file * file)
}
lh = &vcp->vc_processing;
CDEBUG(D_PSDEV, "wake up processing clients\n");
while ( (lh = lh->next) != &vcp->vc_processing) {
req = list_entry(lh, struct upc_req, uc_chain);
req->uc_flags |= REQ_ABORT;
wake_up(&req->uc_sleep);
}
CDEBUG(D_PSDEV, "Done.\n");
unlock_kernel();
return 0;
......
......@@ -37,26 +37,18 @@ static struct ctl_table_header *fs_table_header;
#define FS_CODA 1 /* Coda file system */
#define CODA_DEBUG 1 /* control debugging */
#define CODA_ENTRY 2 /* control enter/leave pattern */
#define CODA_TIMEOUT 3 /* timeout on upcalls to become intrble */
#define CODA_MC 4 /* use/do not use the access cache */
#define CODA_HARD 5 /* mount type "hard" or "soft" */
#define CODA_VFS 6 /* vfs statistics */
#define CODA_UPCALL 7 /* upcall statistics */
#define CODA_PERMISSION 8 /* permission statistics */
#define CODA_CACHE_INV 9 /* cache invalidation statistics */
#define CODA_FAKE_STATFS 10 /* don't query venus for actual cache usage */
static ctl_table coda_table[] = {
{CODA_DEBUG, "debug", &coda_debug, sizeof(int), 0644, NULL, &proc_dointvec},
{CODA_ENTRY, "printentry", &coda_print_entry, sizeof(int), 0644, NULL, &proc_dointvec},
{CODA_MC, "accesscache", &coda_access_cache, sizeof(int), 0644, NULL, &proc_dointvec},
{CODA_TIMEOUT, "timeout", &coda_timeout, sizeof(int), 0644, NULL, &proc_dointvec},
{CODA_HARD, "hard", &coda_hard, sizeof(int), 0644, NULL, &proc_dointvec},
{CODA_VFS, "vfs_stats", NULL, 0, 0644, NULL, &do_reset_coda_vfs_stats},
{CODA_UPCALL, "upcall_stats", NULL, 0, 0644, NULL, &do_reset_coda_upcall_stats},
{CODA_PERMISSION, "permission_stats", NULL, 0, 0644, NULL, &do_reset_coda_permission_stats},
{CODA_CACHE_INV, "cache_inv_stats", NULL, 0, 0644, NULL, &do_reset_coda_cache_inv_stats},
{CODA_FAKE_STATFS, "fake_statfs", &coda_fake_statfs, sizeof(int), 0600, NULL, &proc_dointvec},
{ 0 }
......@@ -68,7 +60,6 @@ static ctl_table fs_table[] = {
};
struct coda_vfs_stats coda_vfs_stat;
struct coda_permission_stats coda_permission_stat;
struct coda_cache_inv_stats coda_cache_inv_stat;
struct coda_upcall_stats_entry coda_upcall_stat[CODA_NCALLS];
struct coda_upcallstats coda_callstats;
......@@ -126,11 +117,6 @@ void reset_coda_upcall_stats( void )
memset( &coda_upcall_stat, 0, sizeof( coda_upcall_stat ) );
}
void reset_coda_permission_stats( void )
{
memset( &coda_permission_stat, 0, sizeof( coda_permission_stat ) );
}
void reset_coda_cache_inv_stats( void )
{
memset( &coda_cache_inv_stat, 0, sizeof( coda_cache_inv_stat ) );
......@@ -141,7 +127,6 @@ void do_time_stats( struct coda_upcall_stats_entry * pentry,
unsigned long runtime )
{
unsigned long time = runtime; /* time in us */
CDEBUG(D_SPECIAL, "time: %ld\n", time);
if ( pentry->count == 0 ) {
pentry->time_sum = pentry->time_squared_sum = 0;
......@@ -257,21 +242,6 @@ int do_reset_coda_upcall_stats( ctl_table * table, int write,
return 0;
}
int do_reset_coda_permission_stats( ctl_table * table, int write,
struct file * filp, void * buffer,
size_t * lenp )
{
if ( write ) {
reset_coda_permission_stats();
filp->f_pos += *lenp;
} else {
*lenp = 0;
}
return 0;
}
int do_reset_coda_cache_inv_stats( ctl_table * table, int write,
struct file * filp, void * buffer,
size_t * lenp )
......@@ -394,35 +364,6 @@ int coda_upcall_stats_get_info( char * buffer, char ** start, off_t offset,
return len;
}
int coda_permission_stats_get_info( char * buffer, char ** start, off_t offset,
int length)
{
int len=0;
off_t begin;
struct coda_permission_stats * ps = & coda_permission_stat;
/* this works as long as we are below 1024 characters! */
len += sprintf( buffer,
"Coda permission statistics\n"
"==========================\n\n"
"count\t\t%9d\n"
"hit count\t%9d\n",
ps->count,
ps->hit_count );
begin = offset;
*start = buffer + begin;
len -= begin;
if ( len > length )
len = length;
if ( len < 0 )
len = 0;
return len;
}
int coda_cache_inv_stats_get_info( char * buffer, char ** start, off_t offset,
int length)
{
......@@ -484,7 +425,6 @@ void coda_sysctl_init()
memset(&coda_callstats, 0, sizeof(coda_callstats));
reset_coda_vfs_stats();
reset_coda_upcall_stats();
reset_coda_permission_stats();
reset_coda_cache_inv_stats();
#ifdef CONFIG_PROC_FS
......@@ -493,7 +433,6 @@ void coda_sysctl_init()
proc_fs_coda->owner = THIS_MODULE;
coda_proc_create("vfs_stats", coda_vfs_stats_get_info);
coda_proc_create("upcall_stats", coda_upcall_stats_get_info);
coda_proc_create("permission_stats", coda_permission_stats_get_info);
coda_proc_create("cache_inv_stats", coda_cache_inv_stats_get_info);
}
#endif
......@@ -516,7 +455,6 @@ void coda_sysctl_clean()
#if CONFIG_PROC_FS
remove_proc_entry("cache_inv_stats", proc_fs_coda);
remove_proc_entry("permission_stats", proc_fs_coda);
remove_proc_entry("upcall_stats", proc_fs_coda);
remove_proc_entry("vfs_stats", proc_fs_coda);
remove_proc_entry("coda", proc_root_fs);
......
......@@ -89,8 +89,6 @@ int venus_rootfid(struct super_block *sb, ViceFid *fidp)
printk("coda_get_rootfid: error %d\n", error);
} else {
*fidp = (ViceFid) outp->coda_root.VFid;
CDEBUG(D_SUPER, "VolumeId: %lx, VnodeId: %lx.\n",
fidp->Volume, fidp->Vnode);
}
CODA_FREE(inp, insize);
......@@ -131,7 +129,6 @@ int venus_setattr(struct super_block *sb, struct ViceFid *fid,
error = coda_upcall(coda_sbp(sb), insize, &outsize, inp);
CDEBUG(D_SUPER, " result %d\n", error);
CODA_FREE(inp, insize);
return error;
}
......@@ -313,8 +310,6 @@ int venus_rename(struct super_block *sb, struct ViceFid *old_fid,
memcpy((char *)(inp) + offset, new_name, new_length);
*((char *)inp + offset + new_length) = '\0';
CDEBUG(D_INODE, "destname in packet: %s\n",
(char *)inp + (int) inp->coda_rename.destname);
error = coda_upcall(coda_sbp(sb), insize, &outsize, inp);
CODA_FREE(inp, insize);
......@@ -426,7 +421,6 @@ int venus_readlink(struct super_block *sb, struct ViceFid *fid,
*(buffer + retlen) = '\0';
}
CDEBUG(D_INODE, " result %d\n",error);
CODA_FREE(inp, insize);
return error;
}
......@@ -455,7 +449,6 @@ int venus_link(struct super_block *sb, struct ViceFid *fid,
error = coda_upcall(coda_sbp(sb), insize, &outsize, inp);
CDEBUG(D_INODE, " result %d\n",error);
CODA_FREE(inp, insize);
return error;
}
......@@ -491,7 +484,6 @@ int venus_symlink(struct super_block *sb, struct ViceFid *fid,
error = coda_upcall(coda_sbp(sb), insize, &outsize, inp);
CDEBUG(D_INODE, " result %d\n",error);
CODA_FREE(inp, insize);
return error;
}
......@@ -580,9 +572,6 @@ int venus_pioctl(struct super_block *sb, struct ViceFid *fid,
/* Copy out the OUT buffer. */
if (outp->coda_ioctl.len > data->vi.out_size) {
CDEBUG(D_FILE, "return len %d <= request len %d\n",
outp->coda_ioctl.len,
data->vi.out_size);
error = -EINVAL;
} else {
error = verify_area(VERIFY_WRITE, data->vi.out,
......@@ -623,7 +612,6 @@ int venus_statfs(struct super_block *sb, struct statfs *sfs)
printk("coda_statfs: Venus returns: %d\n", error);
}
CDEBUG(D_INODE, " result %d\n",error);
CODA_FREE(inp, insize);
return error;
}
......@@ -684,10 +672,6 @@ static inline unsigned long coda_waitfor_upcall(struct upc_req *vmp,
end.tv_usec -= begin.tv_usec;
}
CDEBUG(D_SPECIAL, "begin: %ld.%06ld, elapsed: %ld.%06ld\n",
begin.tv_sec, (unsigned long)begin.tv_usec,
end.tv_sec, (unsigned long)end.tv_usec);
return ((end.tv_sec * 1000000) + end.tv_usec);
}
......@@ -738,10 +722,6 @@ static int coda_upcall(struct coda_sb_info *sbi,
/* Append msg to pending queue and poke Venus. */
list_add(&(req->uc_chain), vcommp->vc_pending.prev);
CDEBUG(D_UPCALL,
"Proc %d wake Venus for(opc,uniq) =(%d,%d) msg at %p.zzz.\n",
current->pid, req->uc_opcode, req->uc_unique, req);
wake_up_interruptible(&vcommp->vc_waitq);
/* We can be interrupted while we wait for Venus to process
* our request. If the interrupt occurs before Venus has read
......@@ -756,29 +736,17 @@ static int coda_upcall(struct coda_sb_info *sbi,
runtime = coda_waitfor_upcall(req, vcommp);
coda_upcall_stats(((union inputArgs *)buffer)->ih.opcode, runtime);
CDEBUG(D_TIMING, "opc: %d time: %ld uniq: %d size: %d\n",
req->uc_opcode, jiffies - req->uc_posttime,
req->uc_unique, req->uc_outSize);
CDEBUG(D_UPCALL,
"..process %d woken up by Venus for req at %p, data at %p\n",
current->pid, req, req->uc_data);
if (vcommp->vc_inuse) { /* i.e. Venus is still alive */
/* Op went through, interrupt or not... */
if (req->uc_flags & REQ_WRITE) {
out = (union outputArgs *)req->uc_data;
/* here we map positive Venus errors to kernel errors */
error = -out->oh.result;
CDEBUG(D_UPCALL,
"upcall: (u,o,r) (%ld, %ld, %ld) out at %p\n",
out->oh.unique, out->oh.opcode, out->oh.result, out);
*outSize = req->uc_outSize;
goto exit;
}
if ( !(req->uc_flags & REQ_READ) && signal_pending(current)) {
/* Interrupted before venus read it. */
CDEBUG(D_UPCALL,
"Interrupted before read:(op,un) (%d.%d), flags = %x\n",
req->uc_opcode, req->uc_unique, req->uc_flags);
list_del(&(req->uc_chain));
/* perhaps the best way to convince the app to
give up? */
......@@ -790,10 +758,6 @@ static int coda_upcall(struct coda_sb_info *sbi,
union inputArgs *sig_inputArgs;
struct upc_req *sig_req;
CDEBUG(D_UPCALL,
"Sending Venus a signal: op = %d.%d, flags = %x\n",
req->uc_opcode, req->uc_unique, req->uc_flags);
list_del(&(req->uc_chain));
error = -ENOMEM;
sig_req = upc_alloc();
......@@ -815,9 +779,6 @@ static int coda_upcall(struct coda_sb_info *sbi,
sig_req->uc_unique = sig_inputArgs->ih.unique;
sig_req->uc_inSize = sizeof(struct coda_in_hdr);
sig_req->uc_outSize = sizeof(struct coda_in_hdr);
CDEBUG(D_UPCALL,
"coda_upcall: enqueing signal msg (%d, %d)\n",
sig_req->uc_opcode, sig_req->uc_unique);
/* insert at head of queue! */
list_add(&(sig_req->uc_chain), &vcommp->vc_pending);
......@@ -876,16 +837,13 @@ static int coda_upcall(struct coda_sb_info *sbi,
int coda_downcall(int opcode, union outputArgs * out, struct super_block *sb)
{
/* Handle invalidation requests. */
if ( !sb || !sb->s_root || !sb->s_root->d_inode) {
CDEBUG(D_DOWNCALL, "coda_downcall: opcode %d, no sb!\n", opcode);
if ( !sb || !sb->s_root || !sb->s_root->d_inode)
return 0;
}
switch (opcode) {
case CODA_FLUSH : {
clstats(CODA_FLUSH);
CDEBUG(D_DOWNCALL, "CODA_FLUSH\n");
coda_cache_clear_all(sb, NULL);
shrink_dcache_sb(sb);
coda_flag_inode(sb->s_root->d_inode, C_FLUSH);
......@@ -894,7 +852,6 @@ int coda_downcall(int opcode, union outputArgs * out, struct super_block *sb)
case CODA_PURGEUSER : {
struct coda_cred *cred = &out->coda_purgeuser.cred;
CDEBUG(D_DOWNCALL, "CODA_PURGEUSER\n");
if ( !cred ) {
printk("PURGEUSER: null cred!\n");
return 0;
......@@ -907,19 +864,14 @@ int coda_downcall(int opcode, union outputArgs * out, struct super_block *sb)
case CODA_ZAPDIR : {
struct inode *inode;
ViceFid *fid = &out->coda_zapdir.CodaFid;
CDEBUG(D_DOWNCALL, "zapdir: fid = %s...\n", coda_f2s(fid));
clstats(CODA_ZAPDIR);
inode = coda_fid_to_inode(fid, sb);
if (inode) {
CDEBUG(D_DOWNCALL, "zapdir: inode = %ld children flagged\n",
inode->i_ino);
coda_flag_inode_children(inode, C_PURGE);
CDEBUG(D_DOWNCALL, "zapdir: inode = %ld cache cleared\n", inode->i_ino);
coda_flag_inode(inode, C_VATTR);
iput(inode);
} else
CDEBUG(D_DOWNCALL, "zapdir: no inode\n");
}
return(0);
}
......@@ -928,27 +880,20 @@ int coda_downcall(int opcode, union outputArgs * out, struct super_block *sb)
struct inode *inode;
struct ViceFid *fid = &out->coda_zapfile.CodaFid;
clstats(CODA_ZAPFILE);
CDEBUG(D_DOWNCALL, "zapfile: fid = %s\n", coda_f2s(fid));
inode = coda_fid_to_inode(fid, sb);
if ( inode ) {
CDEBUG(D_DOWNCALL, "zapfile: inode = %ld\n",
inode->i_ino);
coda_flag_inode(inode, C_VATTR);
iput(inode);
} else
CDEBUG(D_DOWNCALL, "zapfile: no inode\n");
}
return 0;
}
case CODA_PURGEFID : {
struct inode *inode;
ViceFid *fid = &out->coda_purgefid.CodaFid;
CDEBUG(D_DOWNCALL, "purgefid: fid = %s\n", coda_f2s(fid));
clstats(CODA_PURGEFID);
inode = coda_fid_to_inode(fid, sb);
if ( inode ) {
CDEBUG(D_DOWNCALL, "purgefid: inode = %ld\n",
inode->i_ino);
coda_flag_inode_children(inode, C_PURGE);
/* catch the dentries later if some are still busy */
......@@ -956,8 +901,7 @@ int coda_downcall(int opcode, union outputArgs * out, struct super_block *sb)
d_prune_aliases(inode);
iput(inode);
} else
CDEBUG(D_DOWNCALL, "purgefid: no inode\n");
}
return 0;
}
......@@ -966,16 +910,11 @@ int coda_downcall(int opcode, union outputArgs * out, struct super_block *sb)
ViceFid *oldfid = &out->coda_replace.OldFid;
ViceFid *newfid = &out->coda_replace.NewFid;
clstats(CODA_REPLACE);
CDEBUG(D_DOWNCALL, "CODA_REPLACE\n");
inode = coda_fid_to_inode(oldfid, sb);
if ( inode ) {
CDEBUG(D_DOWNCALL, "replacefid: inode = %ld\n",
inode->i_ino);
coda_replace_fid(inode, oldfid, newfid);
iput(inode);
}else
CDEBUG(D_DOWNCALL, "purgefid: no inode\n");
}
return 0;
}
}
......
......@@ -34,6 +34,7 @@ struct coda_inode_info {
#define C_PURGE 0x8
int coda_cnode_make(struct inode **, struct ViceFid *, struct super_block *);
struct inode *coda_iget(struct super_block *sb, struct ViceFid *fid, struct coda_vattr *attr);
int coda_cnode_makectl(struct inode **inode, struct super_block *sb);
struct inode *coda_fid_to_inode(ViceFid *fid, struct super_block *sb);
void coda_replace_fid(struct inode *, ViceFid *, ViceFid *);
......
......@@ -44,8 +44,6 @@ int coda_notify_change(struct dentry *, struct iattr *);
int coda_isnullfid(ViceFid *fid);
/* global variables */
extern int coda_debug;
extern int coda_print_entry;
extern int coda_access_cache;
extern int coda_fake_statfs;
......@@ -70,44 +68,19 @@ int coda_cred_eq(struct coda_cred *cred1, struct coda_cred *cred2);
void coda_sysctl_init(void);
void coda_sysctl_clean(void);
/* debugging masks */
#define D_SUPER 1 /* print results returned by Venus */
#define D_INODE 2 /* print entry and exit into procedure */
#define D_FILE 4
#define D_CACHE 8 /* cache debugging */
#define D_MALLOC 16 /* print malloc, de-alloc information */
#define D_CNODE 32
#define D_UPCALL 64 /* up and downcall debugging */
#define D_PSDEV 128
#define D_PIOCTL 256
#define D_SPECIAL 512
#define D_TIMING 1024
#define D_DOWNCALL 2048
#define CDEBUG(mask, format, a...) \
do { \
if (coda_debug & mask) { \
printk("(%s,l. %d): ", __FUNCTION__, __LINE__); \
printk(format, ## a); } \
} while (0)
#define CODA_ALLOC(ptr, cast, size) \
do { \
if (size < PAGE_SIZE) { \
ptr = (cast)kmalloc((unsigned long) size, GFP_KERNEL); \
CDEBUG(D_MALLOC, "kmalloced: %lx at %p.\n", (long)size, ptr); \
} else { \
ptr = (cast)vmalloc((unsigned long) size); \
CDEBUG(D_MALLOC, "vmalloced: %lx at %p .\n", (long)size, ptr);} \
if (ptr == 0) { \
#define CODA_ALLOC(ptr, cast, size) do { \
if (size < PAGE_SIZE) \
ptr = (cast)kmalloc((unsigned long) size, GFP_KERNEL); \
else \
ptr = (cast)vmalloc((unsigned long) size); \
if (!ptr) \
printk("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \
} \
else memset( ptr, 0, size ); \
else memset( ptr, 0, size ); \
} while (0)
#define CODA_FREE(ptr,size) do {if (size < PAGE_SIZE) { kfree((ptr)); CDEBUG(D_MALLOC, "kfreed: %lx at %p.\n", (long) size, ptr); } else { vfree((ptr)); CDEBUG(D_MALLOC, "vfreed: %lx at %p.\n", (long) size, ptr);} } while (0)
#define CODA_FREE(ptr,size) \
do { if (size < PAGE_SIZE) kfree((ptr)); else vfree((ptr)); } while (0)
/* inode to cnode access functions */
......
......@@ -24,14 +24,12 @@ void coda_upcall_stats(int opcode, unsigned long jiffies);
*
* /proc/fs/coda/vfs_stats
* upcall_stats
* permission_stats
* cache_inv_stats
*
* these four files are presented to reset the statistics to 0:
*
* /proc/sys/coda/vfs_stats
* upcall_stats
* permission_stats
* cache_inv_stats
*/
......@@ -70,15 +68,6 @@ struct coda_upcall_stats_entry
unsigned long time_squared_sum;
};
/* cache hits for permissions statistics */
struct coda_permission_stats
{
int count;
int hit_count;
};
/* cache invalidation statistics */
struct coda_cache_inv_stats
{
......@@ -93,14 +82,12 @@ struct coda_cache_inv_stats
/* these global variables hold the actual statistics data */
extern struct coda_vfs_stats coda_vfs_stat;
extern struct coda_permission_stats coda_permission_stat;
extern struct coda_cache_inv_stats coda_cache_inv_stat;
extern int coda_upcall_timestamping;
/* reset statistics to 0 */
void reset_coda_vfs_stats( void );
void reset_coda_upcall_stats( void );
void reset_coda_permission_stats( void );
void reset_coda_cache_inv_stats( void );
/* some utitlities to make it easier for you to do statistics for time */
......@@ -121,9 +108,6 @@ int do_reset_coda_vfs_stats( ctl_table * table, int write, struct file * filp,
int do_reset_coda_upcall_stats( ctl_table * table, int write,
struct file * filp, void * buffer,
size_t * lenp );
int do_reset_coda_permission_stats( ctl_table * table, int write,
struct file * filp, void * buffer,
size_t * lenp );
int do_reset_coda_cache_inv_stats( ctl_table * table, int write,
struct file * filp, void * buffer,
size_t * lenp );
......@@ -133,8 +117,6 @@ int coda_vfs_stats_get_info( char * buffer, char ** start, off_t offset,
int length);
int coda_upcall_stats_get_info( char * buffer, char ** start, off_t offset,
int length);
int coda_permission_stats_get_info( char * buffer, char ** start, off_t offset,
int length);
int coda_cache_inv_stats_get_info( char * buffer, char ** start, off_t offset,
int length);
......
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