Release 4.10 fs/coda/inode.c
/*
* Super block/filesystem wide operations
*
* Copyright (C) 1996 Peter J. Braam <braam@maths.ox.ac.uk> and
* Michael Callahan <callahan@maths.ox.ac.uk>
*
* Rewritten for Linux 2.1. Peter Braam <braam@cs.cmu.edu>
* Copyright (C) Carnegie Mellon University
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/stat.h>
#include <linux/errno.h>
#include <linux/unistd.h>
#include <linux/mutex.h>
#include <linux/spinlock.h>
#include <linux/file.h>
#include <linux/vfs.h>
#include <linux/slab.h>
#include <linux/pid_namespace.h>
#include <linux/uaccess.h>
#include <linux/fs.h>
#include <linux/vmalloc.h>
#include <linux/coda.h>
#include <linux/coda_psdev.h>
#include "coda_linux.h"
#include "coda_cache.h"
#include "coda_int.h"
/* VFS super_block ops */
static void coda_evict_inode(struct inode *);
static void coda_put_super(struct super_block *);
static int coda_statfs(struct dentry *dentry, struct kstatfs *buf);
static struct kmem_cache * coda_inode_cachep;
static struct inode *coda_alloc_inode(struct super_block *sb)
{
struct coda_inode_info *ei;
ei = kmem_cache_alloc(coda_inode_cachep, GFP_KERNEL);
if (!ei)
return NULL;
memset(&ei->c_fid, 0, sizeof(struct CodaFid));
ei->c_flags = 0;
ei->c_uid = GLOBAL_ROOT_UID;
ei->c_cached_perm = 0;
spin_lock_init(&ei->c_lock);
return &ei->vfs_inode;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 70 | 84.34% | 2 | 28.57% |
yoshihisa abe | yoshihisa abe | 8 | 9.64% | 1 | 14.29% |
jan harkes | jan harkes | 3 | 3.61% | 2 | 28.57% |
eric w. biederman | eric w. biederman | 1 | 1.20% | 1 | 14.29% |
christoph lameter | christoph lameter | 1 | 1.20% | 1 | 14.29% |
| Total | 83 | 100.00% | 7 | 100.00% |
static void coda_i_callback(struct rcu_head *head)
{
struct inode *inode = container_of(head, struct inode, i_rcu);
kmem_cache_free(coda_inode_cachep, ITOC(inode));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 18 | 50.00% | 1 | 50.00% |
nick piggin | nick piggin | 18 | 50.00% | 1 | 50.00% |
| Total | 36 | 100.00% | 2 | 100.00% |
static void coda_destroy_inode(struct inode *inode)
{
call_rcu(&inode->i_rcu, coda_i_callback);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
nick piggin | nick piggin | 21 | 100.00% | 1 | 100.00% |
| Total | 21 | 100.00% | 1 | 100.00% |
static void init_once(void *foo)
{
struct coda_inode_info *ei = (struct coda_inode_info *) foo;
inode_init_once(&ei->vfs_inode);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 27 | 90.00% | 1 | 50.00% |
christoph lameter | christoph lameter | 3 | 10.00% | 1 | 50.00% |
| Total | 30 | 100.00% | 2 | 100.00% |
int __init coda_init_inodecache(void)
{
coda_inode_cachep = kmem_cache_create("coda_inode_cache",
sizeof(struct coda_inode_info), 0,
SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD|
SLAB_ACCOUNT, init_once);
if (coda_inode_cachep == NULL)
return -ENOMEM;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 38 | 86.36% | 1 | 20.00% |
vladimir davydov | vladimir davydov | 2 | 4.55% | 1 | 20.00% |
paul jackson | paul jackson | 2 | 4.55% | 1 | 20.00% |
fabian frederick | fabian frederick | 1 | 2.27% | 1 | 20.00% |
andrew morton | andrew morton | 1 | 2.27% | 1 | 20.00% |
| Total | 44 | 100.00% | 5 | 100.00% |
void coda_destroy_inodecache(void)
{
/*
* Make sure all delayed rcu free inodes are flushed before we
* destroy cache.
*/
rcu_barrier();
kmem_cache_destroy(coda_inode_cachep);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 12 | 75.00% | 1 | 50.00% |
kirill a. shutemov | kirill a. shutemov | 4 | 25.00% | 1 | 50.00% |
| Total | 16 | 100.00% | 2 | 100.00% |
static int coda_remount(struct super_block *sb, int *flags, char *data)
{
sync_filesystem(sb);
*flags |= MS_NOATIME;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
al viro | al viro | 26 | 81.25% | 1 | 33.33% |
theodore tso | theodore tso | 5 | 15.62% | 1 | 33.33% |
jan harkes | jan harkes | 1 | 3.12% | 1 | 33.33% |
| Total | 32 | 100.00% | 3 | 100.00% |
/* exported operations */
static const struct super_operations coda_super_operations =
{
.alloc_inode = coda_alloc_inode,
.destroy_inode = coda_destroy_inode,
.evict_inode = coda_evict_inode,
.put_super = coda_put_super,
.statfs = coda_statfs,
.remount_fs = coda_remount,
};
static int get_device_index(struct coda_mount_data *data)
{
struct fd f;
struct inode *inode;
int idx;
if (data == NULL) {
pr_warn("%s: Bad mount data\n", __func__);
return -1;
}
if (data->version != CODA_MOUNT_VERSION) {
pr_warn("%s: Bad mount version\n", __func__);
return -1;
}
f = fdget(data->fd);
if (!f.file)
goto Ebadf;
inode = file_inode(f.file);
if (!S_ISCHR(inode->i_mode) || imajor(inode) != CODA_PSDEV_MAJOR) {
fdput(f);
goto Ebadf;
}
idx = iminor(inode);
fdput(f);
if (idx < 0 || idx >= MAX_CODADEVS) {
pr_warn("%s: Bad minor number\n", __func__);
return -1;
}
return idx;
Ebadf:
pr_warn("%s: Bad file\n", __func__);
return -1;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 120 | 71.01% | 1 | 12.50% |
al viro | al viro | 33 | 19.53% | 5 | 62.50% |
fabian frederick | fabian frederick | 16 | 9.47% | 2 | 25.00% |
| Total | 169 | 100.00% | 8 | 100.00% |
static int coda_fill_super(struct super_block *sb, void *data, int silent)
{
struct inode *root = NULL;
struct venus_comm *vc;
struct CodaFid fid;
int error;
int idx;
if (task_active_pid_ns(current) != &init_pid_ns)
return -EINVAL;
idx = get_device_index((struct coda_mount_data *) data);
/* Ignore errors in data, for backward compatibility */
if(idx == -1)
idx = 0;
pr_info("%s: device index: %i\n", __func__, idx);
vc = &coda_comms[idx];
mutex_lock(&vc->vc_mutex);
if (!vc->vc_inuse) {
pr_warn("%s: No pseudo device\n", __func__);
error = -EINVAL;
goto unlock_out;
}
if (vc->vc_sb) {
pr_warn("%s: Device already mounted\n", __func__);
error = -EBUSY;
goto unlock_out;
}
error = bdi_setup_and_register(&vc->bdi, "coda");
if (error)
goto unlock_out;
vc->vc_sb = sb;
mutex_unlock(&vc->vc_mutex);
sb->s_fs_info = vc;
sb->s_flags |= MS_NOATIME;
sb->s_blocksize = 4096; /* XXXXX what do we put here?? */
sb->s_blocksize_bits = 12;
sb->s_magic = CODA_SUPER_MAGIC;
sb->s_op = &coda_super_operations;
sb->s_d_op = &coda_dentry_operations;
sb->s_bdi = &vc->bdi;
/* get root fid from Venus: this needs the root inode */
error = venus_rootfid(sb, &fid);
if ( error ) {
pr_warn("%s: coda_get_rootfid failed with %d\n",
__func__, error);
goto error;
}
pr_info("%s: rootfid is %s\n", __func__, coda_f2s(&fid));
/* make root inode */
root = coda_cnode_make(&fid, sb);
if (IS_ERR(root)) {
error = PTR_ERR(root);
pr_warn("Failure of coda_cnode_make for root: error %d\n",
error);
goto error;
}
pr_info("%s: rootinode is %ld dev %s\n",
__func__, root->i_ino, root->i_sb->s_id);
sb->s_root = d_make_root(root);
if (!sb->s_root) {
error = -EINVAL;
goto error;
}
return 0;
error:
mutex_lock(&vc->vc_mutex);
bdi_destroy(&vc->bdi);
vc->vc_sb = NULL;
sb->s_fs_info = NULL;
unlock_out:
mutex_unlock(&vc->vc_mutex);
return error;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 218 | 53.83% | 4 | 16.67% |
yoshihisa abe | yoshihisa abe | 67 | 16.54% | 2 | 8.33% |
al viro | al viro | 40 | 9.88% | 7 | 29.17% |
jens axboe | jens axboe | 27 | 6.67% | 1 | 4.17% |
fabian frederick | fabian frederick | 25 | 6.17% | 2 | 8.33% |
eric w. biederman | eric w. biederman | 14 | 3.46% | 1 | 4.17% |
jan harkes | jan harkes | 6 | 1.48% | 3 | 12.50% |
andrew morton | andrew morton | 5 | 1.23% | 1 | 4.17% |
jan blunck | jan blunck | 1 | 0.25% | 1 | 4.17% |
linus torvalds | linus torvalds | 1 | 0.25% | 1 | 4.17% |
brian gerst | brian gerst | 1 | 0.25% | 1 | 4.17% |
| Total | 405 | 100.00% | 24 | 100.00% |
static void coda_put_super(struct super_block *sb)
{
struct venus_comm *vcp = coda_vcp(sb);
mutex_lock(&vcp->vc_mutex);
bdi_destroy(&vcp->bdi);
vcp->vc_sb = NULL;
sb->s_fs_info = NULL;
mutex_unlock(&vcp->vc_mutex);
pr_info("Bye bye.\n");
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
yoshihisa abe | yoshihisa abe | 26 | 41.94% | 1 | 12.50% |
pre-git | pre-git | 21 | 33.87% | 3 | 37.50% |
jens axboe | jens axboe | 7 | 11.29% | 1 | 12.50% |
jan harkes | jan harkes | 6 | 9.68% | 1 | 12.50% |
fabian frederick | fabian frederick | 2 | 3.23% | 2 | 25.00% |
| Total | 62 | 100.00% | 8 | 100.00% |
static void coda_evict_inode(struct inode *inode)
{
truncate_inode_pages_final(&inode->i_data);
clear_inode(inode);
coda_cache_clear_inode(inode);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 15 | 51.72% | 2 | 40.00% |
al viro | al viro | 12 | 41.38% | 1 | 20.00% |
johannes weiner | johannes weiner | 1 | 3.45% | 1 | 20.00% |
jan kara | jan kara | 1 | 3.45% | 1 | 20.00% |
| Total | 29 | 100.00% | 5 | 100.00% |
int coda_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
{
int err = coda_revalidate_inode(d_inode(dentry));
if (!err)
generic_fillattr(d_inode(dentry), stat);
return err;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
al viro | al viro | 42 | 85.71% | 2 | 50.00% |
david howells | david howells | 6 | 12.24% | 1 | 25.00% |
pre-git | pre-git | 1 | 2.04% | 1 | 25.00% |
| Total | 49 | 100.00% | 4 | 100.00% |
int coda_setattr(struct dentry *de, struct iattr *iattr)
{
struct inode *inode = d_inode(de);
struct coda_vattr vattr;
int error;
memset(&vattr, 0, sizeof(vattr));
inode->i_ctime = current_time(inode);
coda_iattr_to_vattr(iattr, &vattr);
vattr.va_type = C_VNON; /* cannot set type */
/* Venus is responsible for truncating the container-file!!! */
error = venus_setattr(inode->i_sb, coda_i2f(inode), &vattr);
if (!error) {
coda_vattr_to_iattr(inode, &vattr);
coda_cache_clear_inode(inode);
}
return error;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 96 | 87.27% | 6 | 60.00% |
jan harkes | jan harkes | 5 | 4.55% | 1 | 10.00% |
deepa dinamani | deepa dinamani | 4 | 3.64% | 1 | 10.00% |
david howells | david howells | 3 | 2.73% | 1 | 10.00% |
al viro | al viro | 2 | 1.82% | 1 | 10.00% |
| Total | 110 | 100.00% | 10 | 100.00% |
const struct inode_operations coda_file_inode_operations = {
.permission = coda_permission,
.getattr = coda_getattr,
.setattr = coda_setattr,
};
static int coda_statfs(struct dentry *dentry, struct kstatfs *buf)
{
int error;
error = venus_statfs(dentry, buf);
if (error) {
/* fake something like AFS does */
buf->f_blocks = 9000000;
buf->f_bfree = 9000000;
buf->f_bavail = 9000000;
buf->f_files = 9000000;
buf->f_ffree = 9000000;
}
/* and fill in the rest */
buf->f_type = CODA_SUPER_MAGIC;
buf->f_bsize = 4096;
buf->f_namelen = CODA_MAXNAMLEN;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 82 | 94.25% | 3 | 50.00% |
david howells | david howells | 3 | 3.45% | 1 | 16.67% |
andrew morton | andrew morton | 1 | 1.15% | 1 | 16.67% |
jan harkes | jan harkes | 1 | 1.15% | 1 | 16.67% |
| Total | 87 | 100.00% | 6 | 100.00% |
/* init_coda: used by filesystems.c to register coda */
static struct dentry *coda_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data)
{
return mount_nodev(fs_type, flags, data, coda_fill_super);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
al viro | al viro | 31 | 83.78% | 2 | 50.00% |
pre-git | pre-git | 5 | 13.51% | 1 | 25.00% |
andries brouwer | andries brouwer | 1 | 2.70% | 1 | 25.00% |
| Total | 37 | 100.00% | 4 | 100.00% |
struct file_system_type coda_fs_type = {
.owner = THIS_MODULE,
.name = "coda",
.mount = coda_mount,
.kill_sb = kill_anon_super,
.fs_flags = FS_BINARY_MOUNTDATA,
};
MODULE_ALIAS_FS("coda");
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 660 | 46.74% | 12 | 15.38% |
al viro | al viro | 217 | 15.37% | 19 | 24.36% |
linus torvalds | linus torvalds | 176 | 12.46% | 3 | 3.85% |
yoshihisa abe | yoshihisa abe | 105 | 7.44% | 3 | 3.85% |
jan harkes | jan harkes | 47 | 3.33% | 7 | 8.97% |
fabian frederick | fabian frederick | 45 | 3.19% | 5 | 6.41% |
nick piggin | nick piggin | 39 | 2.76% | 1 | 1.28% |
jens axboe | jens axboe | 34 | 2.41% | 1 | 1.28% |
eric w. biederman | eric w. biederman | 23 | 1.63% | 3 | 3.85% |
david howells | david howells | 14 | 0.99% | 2 | 2.56% |
andrew morton | andrew morton | 13 | 0.92% | 4 | 5.13% |
christoph lameter | christoph lameter | 6 | 0.42% | 3 | 3.85% |
theodore tso | theodore tso | 5 | 0.35% | 1 | 1.28% |
kirill a. shutemov | kirill a. shutemov | 4 | 0.28% | 1 | 1.28% |
deepa dinamani | deepa dinamani | 4 | 0.28% | 1 | 1.28% |
christoph hellwig | christoph hellwig | 3 | 0.21% | 1 | 1.28% |
adrian bunk | adrian bunk | 3 | 0.21% | 1 | 1.28% |
tejun heo | tejun heo | 3 | 0.21% | 1 | 1.28% |
paul jackson | paul jackson | 2 | 0.14% | 1 | 1.28% |
vladimir davydov | vladimir davydov | 2 | 0.14% | 1 | 1.28% |
brian gerst | brian gerst | 1 | 0.07% | 1 | 1.28% |
andries brouwer | andries brouwer | 1 | 0.07% | 1 | 1.28% |
jan blunck | jan blunck | 1 | 0.07% | 1 | 1.28% |
josef 'jeff' sipek | josef 'jeff' sipek | 1 | 0.07% | 1 | 1.28% |
jan kara | jan kara | 1 | 0.07% | 1 | 1.28% |
arjan van de ven | arjan van de ven | 1 | 0.07% | 1 | 1.28% |
johannes weiner | johannes weiner | 1 | 0.07% | 1 | 1.28% |
| Total | 1412 | 100.00% | 78 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.