Release 4.11 fs/coda/cache.c
/*
* Cache operations for Coda.
* For Linux 2.1: (C) 1997 Carnegie Mellon University
* For Linux 2.3: (C) 2000 Carnegie Mellon University
*
* Carnegie Mellon encourages users of this code to contribute improvements
* to the Coda project http://www.coda.cs.cmu.edu/ <coda@cs.cmu.edu>.
*/
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/time.h>
#include <linux/fs.h>
#include <linux/stat.h>
#include <linux/errno.h>
#include <linux/uaccess.h>
#include <linux/string.h>
#include <linux/list.h>
#include <linux/sched.h>
#include <linux/spinlock.h>
#include <linux/coda.h>
#include <linux/coda_psdev.h>
#include "coda_linux.h"
#include "coda_cache.h"
static atomic_t permission_epoch = ATOMIC_INIT(0);
/* replace or extend an acl cache hit */
void coda_cache_enter(struct inode *inode, int mask)
{
struct coda_inode_info *cii = ITOC(inode);
spin_lock(&cii->c_lock);
cii->c_cached_epoch = atomic_read(&permission_epoch);
if (!uid_eq(cii->c_uid, current_fsuid())) {
cii->c_uid = current_fsuid();
cii->c_cached_perm = mask;
} else
cii->c_cached_perm |= mask;
spin_unlock(&cii->c_lock);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 46 | 54.76% | 5 | 50.00% |
Yoshihisa Abe | 16 | 19.05% | 1 | 10.00% |
Jan Harkes | 13 | 15.48% | 2 | 20.00% |
Eric W. Biedermann | 5 | 5.95% | 1 | 10.00% |
David Howells | 4 | 4.76% | 1 | 10.00% |
Total | 84 | 100.00% | 10 | 100.00% |
/* remove cached acl from an inode */
void coda_cache_clear_inode(struct inode *inode)
{
struct coda_inode_info *cii = ITOC(inode);
spin_lock(&cii->c_lock);
cii->c_cached_epoch = atomic_read(&permission_epoch) - 1;
spin_unlock(&cii->c_lock);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 24 | 50.00% | 4 | 66.67% |
Yoshihisa Abe | 16 | 33.33% | 1 | 16.67% |
Jan Harkes | 8 | 16.67% | 1 | 16.67% |
Total | 48 | 100.00% | 6 | 100.00% |
/* remove all acl caches */
void coda_cache_clear_all(struct super_block *sb)
{
atomic_inc(&permission_epoch);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 14 | 87.50% | 1 | 50.00% |
Jan Harkes | 2 | 12.50% | 1 | 50.00% |
Total | 16 | 100.00% | 2 | 100.00% |
/* check if the mask has been matched against the acl already */
int coda_cache_check(struct inode *inode, int mask)
{
struct coda_inode_info *cii = ITOC(inode);
int hit;
spin_lock(&cii->c_lock);
hit = (mask & cii->c_cached_perm) == mask &&
uid_eq(cii->c_uid, current_fsuid()) &&
cii->c_cached_epoch == atomic_read(&permission_epoch);
spin_unlock(&cii->c_lock);
return hit;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 44 | 57.14% | 4 | 44.44% |
Yoshihisa Abe | 16 | 20.78% | 1 | 11.11% |
Jan Harkes | 11 | 14.29% | 2 | 22.22% |
Eric W. Biedermann | 4 | 5.19% | 1 | 11.11% |
David Howells | 2 | 2.60% | 1 | 11.11% |
Total | 77 | 100.00% | 9 | 100.00% |
/* Purging dentries and children */
/* The following routines drop dentries which are not
in use and flag dentries which are in use to be
zapped later.
The flags are detected by:
- coda_dentry_revalidate (for lookups) if the flag is C_PURGE
- coda_dentry_delete: to remove dentry from the cache when d_count
falls to zero
- an inode method coda_revalidate (for attributes) if the
flag is C_VATTR
*/
/* this won't do any harm: just flag all children */
static void coda_flag_children(struct dentry *parent, int flag)
{
struct dentry *de;
spin_lock(&parent->d_lock);
list_for_each_entry(de, &parent->d_subdirs, d_child) {
/* don't know what to do with negative dentries */
if (d_inode(de) )
coda_flag_inode(d_inode(de), flag);
}
spin_unlock(&parent->d_lock);
return;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 42 | 65.62% | 5 | 55.56% |
Nicholas Piggin | 12 | 18.75% | 1 | 11.11% |
David Howells | 6 | 9.38% | 1 | 11.11% |
Al Viro | 4 | 6.25% | 2 | 22.22% |
Total | 64 | 100.00% | 9 | 100.00% |
void coda_flag_inode_children(struct inode *inode, int flag)
{
struct dentry *alias_de;
if ( !inode || !S_ISDIR(inode->i_mode))
return;
alias_de = d_find_alias(inode);
if (!alias_de)
return;
coda_flag_children(alias_de, flag);
shrink_dcache_parent(alias_de);
dput(alias_de);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 62 | 100.00% | 6 | 100.00% |
Total | 62 | 100.00% | 6 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 273 | 66.10% | 11 | 42.31% |
Yoshihisa Abe | 51 | 12.35% | 1 | 3.85% |
Jan Harkes | 44 | 10.65% | 3 | 11.54% |
David Howells | 12 | 2.91% | 2 | 7.69% |
Nicholas Piggin | 12 | 2.91% | 1 | 3.85% |
Eric W. Biedermann | 9 | 2.18% | 1 | 3.85% |
Al Viro | 6 | 1.45% | 3 | 11.54% |
Alexey Dobriyan | 3 | 0.73% | 1 | 3.85% |
Linus Torvalds | 1 | 0.24% | 1 | 3.85% |
Fabian Frederick | 1 | 0.24% | 1 | 3.85% |
Dave Jones | 1 | 0.24% | 1 | 3.85% |
Total | 413 | 100.00% | 26 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.