GFS2: dentry, export, super and vm operations
Subsystems (2)
PATCH 6/16 GFS2: dentry, export, super and vm operations
[PATCH 06/16] GFS2: dentry, export, super and vm operations
The GFS2 dentry interface, NFS operations, superblock operations, VM operaions, transaction code, unlinked inode code and GFS2 utility routines.
fs/gfs2/ops_dentry.c | 124 ++++++ fs/gfs2/ops_dentry.h | 15 fs/gfs2/ops_export.c | 298 +++++++++++++++ fs/gfs2/ops_export.h | 15 fs/gfs2/ops_super.c | 379 ++++++++++++++++++++ fs/gfs2/ops_super.h | 15 fs/gfs2/ops_vm.c | 198 ++++++++++ fs/gfs2/ops_vm.h | 16 fs/gfs2/page.c | 283 +++++++++++++++ fs/gfs2/page.h | 23 + fs/gfs2/super.c | 950 +++++++++++++++++++++++++++++++++++++++++++++++++++ fs/gfs2/super.h | 54 ++ fs/gfs2/trans.c | 186 +++++++++ fs/gfs2/trans.h | 35 + fs/gfs2/unlinked.c | 458 ++++++++++++++++++++++++ fs/gfs2/unlinked.h | 25 + fs/gfs2/util.c | 245 +++++++++++++ fs/gfs2/util.h | 169 +++++++++ 18 files changed, 3488 insertions(+)
fs/gfs2/ops_dentry.c new file +124 -0
@@ -0,0 +1,124 @@ +/* +* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. +* Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. +* +* This copyrighted material is made available to anyone wishing to use, +* modify, copy, or redistribute it subject to the terms and conditions +* of the GNU General Public License v.2. +*/ + +#include <linux/sched.h> +#include <linux/slab.h> +#include <linux/spinlock.h> +#include <linux/completion.h> +#include <linux/buffer_head.h> +#include <linux/smp_lock.h> +#include <linux/gfs2_ondisk.h> +#include <linux/crc32.h> +#include <asm/semaphore.h> + +#include "gfs2.h" +#include "lm_interface.h" +#include "incore.h" +#include "dir.h" +#include "glock.h" +#include "ops_dentry.h" +#include "util.h" + +/** +* gfs2_drevalidate - Check directory lookup consistency +* @dentry: the mapping to check +* @nd: +* +* Check to make sure the lookup necessary to arrive at this inode from its +* parent is still good. +* +* Returns: 1 if the dentry is ok, 0 if it isn't +*/ + +static int gfs2_drevalidate (struct dentry *dentry,struct nameidata *nd) +{ +struct dentry *parent =dget_parent (dentry); +struct gfs2_sbd *sdp = parent->d_inode->i_sb->s_fs_info; +struct gfs2_inode *dip = parent->d_inode->u.generic_ip; +struct inode *inode = dentry->d_inode; +struct gfs2_holder d_gh; +struct gfs2_inode *ip; +struct gfs2_inum inum; +unsigned int type; +int error; + +if (inode &&is_bad_inode (inode)) + goto invalid; + +if (sdp->sd_args.ar_localcaching) + goto valid; + + error =gfs2_glock_nq_init (dip->i_gl,LM_ST_SHARED ,0 , &d_gh); +if (error) + goto fail; + + error =gfs2_dir_search (parent->d_inode, &dentry->d_name, &inum, &type); +switch (error) { +case 0 : +if (!inode) + goto invalid_gunlock; +break ; +case -ENOENT : +if (!inode) + goto valid_gunlock; + goto invalid_gunlock; +default : + goto fail_gunlock; + } + + ip = inode->u.generic_ip; + +if (!gfs2_inum_equal (&ip->i_num, &inum)) + goto invalid_gunlock; + +if (IF2DT (ip->i_di.di_mode) != type) { +gfs2_consist_inode (dip); + goto fail_gunlock; + } + + valid_gunlock: +gfs2_glock_dq_uninit (&d_gh); + + valid: +dput (parent); +return 1 ; + + invalid_gunlock: +gfs2_glock_dq_uninit (&d_gh); + + invalid: +if (inode &&S_ISDIR (inode->i_mode)) { +if (have_submounts (dentry)) + goto valid; +shrink_dcache_parent (dentry); + } +d_drop (dentry); + +dput (parent); +return 0 ; + + fail_gunlock: +gfs2_glock_dq_uninit (&d_gh); + + fail: +dput (parent); +return 0 ; +} + +static int gfs2_dhash (struct dentry *dentry,struct qstr *str) +{ + str->hash =gfs2_disk_hash (str->name, str->len); +return 0 ; +} + +struct dentry_operations gfs2_dops = { + .d_revalidate = gfs2_drevalidate, + .d_hash = gfs2_dhash, +}; +
fs/gfs2/ops_dentry.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. +* Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. +* +* This copyrighted material is made available to anyone wishing to use, +* modify, copy, or redistribute it subject to the terms and conditions +* of the GNU General Public License v.2. +*/ + +#ifndef __OPS_DENTRY_DOT_H__ +#define __OPS_DENTRY_DOT_H__ + +extern struct dentry_operations gfs2_dops; + +#endif /* __OPS_DENTRY_DOT_H__ */
fs/gfs2/ops_export.c new file +298 -0
298 lines not on this page · raw message
fs/gfs2/ops_export.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. +* Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. +* +* This copyrighted material is made available to anyone wishing to use, +* modify, copy, or redistribute it subject to the terms and conditions +* of the GNU General Public License v.2. +*/ + +#ifndef __OPS_EXPORT_DOT_H__ +#define __OPS_EXPORT_DOT_H__ + +extern struct export_operations gfs2_export_ops; + +#endif /* __OPS_EXPORT_DOT_H__ */
fs/gfs2/ops_super.c new file +379 -0
379 lines not on this page · raw message
fs/gfs2/ops_super.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. +* Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. +* +* This copyrighted material is made available to anyone wishing to use, +* modify, copy, or redistribute it subject to the terms and conditions +* of the GNU General Public License v.2. +*/ + +#ifndef __OPS_SUPER_DOT_H__ +#define __OPS_SUPER_DOT_H__ + +extern struct super_operations gfs2_super_ops; + +#endif /* __OPS_SUPER_DOT_H__ */
fs/gfs2/ops_vm.c new file +198 -0
198 lines not on this page · raw message
fs/gfs2/ops_vm.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. +* Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. +* +* This copyrighted material is made available to anyone wishing to use, +* modify, copy, or redistribute it subject to the terms and conditions +* of the GNU General Public License v.2. +*/ + +#ifndef __OPS_VM_DOT_H__ +#define __OPS_VM_DOT_H__ + +extern struct vm_operations_struct gfs2_vm_ops_private; +extern struct vm_operations_struct gfs2_vm_ops_sharewrite; + +#endif /* __OPS_VM_DOT_H__ */
fs/gfs2/page.c new file +283 -0
283 lines not on this page · raw message
fs/gfs2/page.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. +* Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. +* +* This copyrighted material is made available to anyone wishing to use, +* modify, copy, or redistribute it subject to the terms and conditions +* of the GNU General Public License v.2. +*/ + +#ifndef __PAGE_DOT_H__ +#define __PAGE_DOT_H__ + +void gfs2_pte_inval (struct gfs2_glock *gl); +void gfs2_page_inval (struct gfs2_glock *gl); +void gfs2_page_sync (struct gfs2_glock *gl,int flags); + +int gfs2_unstuffer_page (struct gfs2_inode *ip,struct buffer_head *dibh, +uint64_t block,void *private); +int gfs2_block_truncate_page (struct address_space *mapping); +void gfs2_page_add_databufs (struct gfs2_inode *ip,struct page *page, +unsigned int from,unsigned int to); + +#endif /* __PAGE_DOT_H__ */
fs/gfs2/super.c new file +950 -0
950 lines not on this page · raw message
fs/gfs2/super.h new file +54 -0
54 lines not on this page · raw message
fs/gfs2/trans.c new file +186 -0
186 lines not on this page · raw message
fs/gfs2/trans.h new file +35 -0
@@ -0,0 +1,35 @@ +/* +* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. +* Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. +* +* This copyrighted material is made available to anyone wishing to use, +* modify, copy, or redistribute it subject to the terms and conditions +* of the GNU General Public License v.2. +*/ + +#ifndef __TRANS_DOT_H__ +#define __TRANS_DOT_H__ + +#define RES_DINODE 1 +#define RES_INDIRECT 1 +#define RES_JDATA 1 +#define RES_DATA 1 +#define RES_LEAF 1 +#define RES_RG_BIT 2 +#define RES_EATTR 1 +#define RES_UNLINKED 1 +#define RES_STATFS 1 +#define RES_QUOTA 2 + +int gfs2_trans_begin (struct gfs2_sbd *sdp, +unsigned int blocks,unsigned int revokes); + +void gfs2_trans_end (struct gfs2_sbd *sdp); + +void gfs2_trans_add_gl (struct gfs2_glock *gl); +void gfs2_trans_add_bh (struct gfs2_glock *gl,struct buffer_head *bh,int meta); +void gfs2_trans_add_revoke (struct gfs2_sbd *sdp,uint64_t blkno); +void gfs2_trans_add_unrevoke (struct gfs2_sbd *sdp,uint64_t blkno); +void gfs2_trans_add_rg (struct gfs2_rgrpd *rgd); + +#endif /* __TRANS_DOT_H__ */
fs/gfs2/unlinked.c new file +458 -0
409 lines not on this page · raw message
fs/gfs2/unlinked.h new file +25 -0
Lines of this file are not shown. View the raw message.
fs/gfs2/util.c new file +245 -0
245 lines not on this page · raw message
fs/gfs2/util.h new file +169 -0
169 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.