GFS2 Filesystem [6/16]
[PATCH 06/16] GFS2:
The GFS2 dentry interface, NFS operations, superblock operations, VM operaions, transaction code, unlinked inode code and GFS2 utility routines.
Signed-off-by Steven Whitehouse <[email protected]>
Signed-off-by David Teigland <[email protected]>
fs/gfs2/ops_dentry.c | 114 ++++++ fs/gfs2/ops_dentry.h | 15 fs/gfs2/ops_export.c | 290 +++++++++++++++ fs/gfs2/ops_export.h | 15 fs/gfs2/ops_super.c | 384 ++++++++++++++++++++ fs/gfs2/ops_super.h | 15 fs/gfs2/ops_vm.c | 192 ++++++++++ fs/gfs2/ops_vm.h | 16 fs/gfs2/page.c | 279 +++++++++++++++ fs/gfs2/page.h | 23 + fs/gfs2/super.c | 945 +++++++++++++++++++++++++++++++++++++++++++++++++++ fs/gfs2/super.h | 55 ++ fs/gfs2/trans.c | 198 ++++++++++ fs/gfs2/trans.h | 39 ++ fs/gfs2/unlinked.c | 453 ++++++++++++++++++++++++ fs/gfs2/unlinked.h | 25 + fs/gfs2/util.c | 246 +++++++++++++ fs/gfs2/util.h | 172 +++++++++ 18 files changed, 3476 insertions(+)
fs/gfs2/ops_dentry.c new file +114 -0
@@ -0,0 +1,114 @@ +/* +* 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 <asm/semaphore.h> + +#include "gfs2.h" +#include "dir.h" +#include "glock.h" +#include "ops_dentry.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_inode *dip =get_v2ip (parent->d_inode); +struct inode *inode; +struct gfs2_holder d_gh; +struct gfs2_inode *ip; +struct gfs2_inum inum; +unsigned int type; +int error; + +lock_kernel (); + + inode = dentry->d_inode; +if (inode &&is_bad_inode (inode)) + goto invalid; + + error =gfs2_glock_nq_init (dip->i_gl,LM_ST_SHARED ,0 , &d_gh); +if (error) + goto fail; + + error =gfs2_dir_search (dip, &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 =get_v2ip (inode); + +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: +unlock_kernel (); +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); + +unlock_kernel (); +dput (parent); +return 0 ; + + fail_gunlock: +gfs2_glock_dq_uninit (&d_gh); + + fail: +unlock_kernel (); +dput (parent); +return 0 ; +} + +struct dentry_operations gfs2_dops = { + .d_revalidate = gfs2_drevalidate, +}; +
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 +290 -0
290 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 +384 -0
384 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 +192 -0
192 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 +279 -0
279 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 +945 -0
945 lines not on this page · raw message
fs/gfs2/super.h new file +55 -0
55 lines not on this page · raw message
fs/gfs2/trans.c new file +198 -0
198 lines not on this page · raw message
fs/gfs2/trans.h new file +39 -0
@@ -0,0 +1,39 @@ +/* +* 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 + +#define gfs2_trans_begin (sdp, blocks, revokes) \ +gfs2_trans_begin_i((sdp), (blocks), (revokes), __FILE__, __LINE__) + +int gfs2_trans_begin_i (struct gfs2_sbd *sdp, +unsigned int blocks,unsigned int revokes, +char *file,unsigned int line); + +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 +453 -0
420 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 +246 -0
246 lines not on this page · raw message
fs/gfs2/util.h new file +172 -0
172 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.