GFS2: Clean up of extended attribute support
From 40b78a322365aa1d87770200f7fc7de3b361c11a Mon Sep 17 00:00:00 2001
From: Steven Whitehouse <[email protected]>
Date: Wed, 26 Aug 2009 18:41:32 +0100
Subject: GFS2: Clean up of extended attribute support
This has been on my list for some time. We need to change the way in which we handle extended attributes to allow faster file creation times (by reducing the number of transactions required) and the extended attribute code is the main obstacle to this.
In addition to that, the VFS provides a way to demultiplex the xattr calls which we ought to be using, rather than rolling our own. This patch changes the GFS2 code to use that VFS feature and as a result the code shrinks by a couple of hundred lines or so, and becomes easier to read.
I'm planning on doing further clean up work in this area, but this patch is a good start. The cleaned up code also uses the more usual "xattr" shorthand, I plan to eliminate the use of "eattr" eventually and in the mean time it serves as a flag as to which bits of the code have been updated.
--- fs/gfs2/Makefile | 2 +- fs/gfs2/acl.c | 104 ++++++------- fs/gfs2/eaops.c | 157 ------------------- fs/gfs2/eaops.h | 30 ---- fs/gfs2/eattr.c | 421 ++++++++++++++++++++++++++++---------------------- fs/gfs2/eattr.h | 52 ++----- fs/gfs2/file.c | 1 - fs/gfs2/inode.c | 12 +-- fs/gfs2/ops_fstype.c | 1 + fs/gfs2/ops_inode.c | 78 ++++----- fs/gfs2/super.h | 1 + 11 files changed, 333 insertions(+), 526 deletions(-) delete mode 100644 fs/gfs2/eaops.c delete mode 100644 fs/gfs2/eaops.h
fs/gfs2/Makefile +1 -1
@@ -1,6 +1,6 @@ EXTRA_CFLAGS := -I$(src) obj-$(CONFIG_GFS2_FS) += gfs2.o -gfs2-y := acl.o bmap.o dir.o eaops.o eattr.o glock.o \ +gfs2-y := acl.o bmap.o dir.o eattr.o glock.o \ glops.o inode.o log.o lops.o main.o meta_io.o \ aops.o dentry.o export.o file.o \ ops_fstype.o ops_inode.o quota.o \
fs/gfs2/acl.c +45 -59
200 lines not on this page · raw message
fs/gfs2/eaops.c deleted +0 -157
157 lines not on this page · raw message
fs/gfs2/eaops.h deleted +0 -30
@@ -1,30 +0,0 @@ -/* -* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -* Copyright (C) 2004-2006 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 version 2. -*/ - -#ifndef __EAOPS_DOT_H__ -#define __EAOPS_DOT_H__ - -struct gfs2_ea_request ; -struct gfs2_inode ; - -struct gfs2_eattr_operations { -int (*eo_get) (struct gfs2_inode *ip,struct gfs2_ea_request *er); -int (*eo_set) (struct gfs2_inode *ip,struct gfs2_ea_request *er); -int (*eo_remove) (struct gfs2_inode *ip,struct gfs2_ea_request *er); -char *eo_name; -}; - -unsigned int gfs2_ea_name2type (const char *name,const char **truncated_name); - -extern const struct gfs2_eattr_operations gfs2_system_eaops; - -extern const struct gfs2_eattr_operations *gfs2_ea_ops[]; - -#endif /* __EAOPS_DOT_H__ */ -
fs/gfs2/eattr.c +237 -184
632 lines not on this page · raw message
fs/gfs2/eattr.h +12 -40
78 lines not on this page · raw message
fs/gfs2/file.c +0 -1
@@ -38,7 +38,6 @@#include "rgrp.h" #include "trans.h" #include "util.h" -#include "eaops.h" /** * gfs2_llseek - seek to a location in a file
fs/gfs2/inode.c +1 -11
@@ -924,7 +924,6 @@ static int gfs2_security_init(struct gfs2_inode *dip, struct gfs2_inode *ip)size_t len;void *value;char *name; -struct gfs2_ea_request er; err =security_inode_init_security (&ip->i_inode, &dip->i_inode, &name, &value, &len);
@@ -935,16 +934,7 @@ static int gfs2_security_init(struct gfs2_inode *dip, struct gfs2_inode *ip)return err; } -memset (&er,0 ,sizeof (struct gfs2_ea_request )); - - er.er_type =GFS2_EATYPE_SECURITY ; - er.er_name = name; - er.er_data = value; - er.er_name_len =strlen (name); - er.er_data_len = len; - - err =gfs2_ea_set_i (ip, &er); - + err =gfs2_xattr_set (&ip->i_inode,GFS2_EATYPE_SECURITY , name, value, len,0 );kfree (value);kfree (name);
fs/gfs2/ops_fstype.c +1 -0
@@ -1186,6 +1186,7 @@ static int fill_super(struct super_block *sb, void *data, int silent) sb->s_magic =GFS2_MAGIC ; sb->s_op = &gfs2_super_ops; sb->s_export_op = &gfs2_export_ops; + sb->s_xattr = gfs2_xattr_handlers; sb->s_time_gran =1 ; sb->s_maxbytes =MAX_LFS_FILESIZE ;
fs/gfs2/ops_inode.c +35 -43
102 lines not on this page · raw message
fs/gfs2/super.h +1 -0
@@ -54,6 +54,7 @@ extern struct file_system_type gfs2meta_fs_type;extern const struct export_operations gfs2_export_ops;extern const struct super_operations gfs2_super_ops;extern const struct dentry_operations gfs2_dops; +extern struct xattr_handler *gfs2_xattr_handlers[];#endif /* __SUPER_DOT_H__ */
Signature · 1 line
1.6.2.5