From mboxrd@z Thu Jan 1 00:00:00 1970 From: rpeterso@sourceware.org Date: 10 Jul 2006 23:22:45 -0000 Subject: [Cluster-devel] cluster/gfs-kernel/src/gfs Makefile acl.c acl. ... Message-ID: <20060710232245.20618.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: cluster Changes by: rpeterso at sourceware.org 2006-07-10 23:22:34 Modified files: gfs-kernel/src/gfs: Makefile acl.c acl.h bits.c bits.h bmap.c bmap.h daemon.c daemon.h dio.c dio.h dir.c dir.h eaops.c eaops.h eattr.c eattr.h file.c file.h fixed_div64.h format.h gfs.h gfs_ioctl.h gfs_ondisk.h glock.c glock.h glops.c glops.h incore.h inode.c inode.h ioctl.c ioctl.h lm.c lm.h log.c log.h lops.c lops.h lvb.c lvb.h main.c mount.c mount.h ondisk.c ops_address.c ops_address.h ops_dentry.c ops_dentry.h ops_export.c ops_export.h ops_file.c ops_file.h ops_fstype.c ops_fstype.h ops_inode.c ops_inode.h ops_super.c ops_super.h ops_vm.c ops_vm.h page.c page.h quota.c quota.h recovery.c recovery.h rgrp.c rgrp.h super.c super.h trans.c trans.h unlinked.c unlinked.h util.c util.h Added files: gfs-kernel/src/gfs: sys.c sys.h Removed files: gfs-kernel/src/gfs: debug.c debug.h diaper.c diaper.h locking.c proc.c proc.h Log message: Change gfs to work with new locking infrastructure. Also, changes crosswritten from STABLE, and removed undesired debug code. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/sys.c.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/sys.h.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/Makefile.diff?cvsroot=cluster&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/acl.c.diff?cvsroot=cluster&r1=1.8&r2=1.9 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/acl.h.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/bits.c.diff?cvsroot=cluster&r1=1.5&r2=1.6 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/bits.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/bmap.c.diff?cvsroot=cluster&r1=1.8&r2=1.9 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/bmap.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/daemon.c.diff?cvsroot=cluster&r1=1.6&r2=1.7 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/daemon.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/dio.c.diff?cvsroot=cluster&r1=1.17&r2=1.18 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/dio.h.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/dir.c.diff?cvsroot=cluster&r1=1.12&r2=1.13 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/dir.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/eaops.c.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/eaops.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/eattr.c.diff?cvsroot=cluster&r1=1.8&r2=1.9 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/eattr.h.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/file.c.diff?cvsroot=cluster&r1=1.7&r2=1.8 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/file.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/fixed_div64.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/format.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/gfs.h.diff?cvsroot=cluster&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/gfs_ioctl.h.diff?cvsroot=cluster&r1=1.10&r2=1.11 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/gfs_ondisk.h.diff?cvsroot=cluster&r1=1.8&r2=1.9 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/glock.c.diff?cvsroot=cluster&r1=1.26&r2=1.27 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/glock.h.diff?cvsroot=cluster&r1=1.8&r2=1.9 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/glops.c.diff?cvsroot=cluster&r1=1.12&r2=1.13 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/glops.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/incore.h.diff?cvsroot=cluster&r1=1.24&r2=1.25 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/inode.c.diff?cvsroot=cluster&r1=1.23&r2=1.24 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/inode.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ioctl.c.diff?cvsroot=cluster&r1=1.10&r2=1.11 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ioctl.h.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/lm.c.diff?cvsroot=cluster&r1=1.10&r2=1.11 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/lm.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/log.c.diff?cvsroot=cluster&r1=1.18&r2=1.19 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/log.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/lops.c.diff?cvsroot=cluster&r1=1.8&r2=1.9 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/lops.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/lvb.c.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/lvb.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/main.c.diff?cvsroot=cluster&r1=1.7&r2=1.8 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/mount.c.diff?cvsroot=cluster&r1=1.11&r2=1.12 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/mount.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ondisk.c.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_address.c.diff?cvsroot=cluster&r1=1.10&r2=1.11 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_address.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_dentry.c.diff?cvsroot=cluster&r1=1.5&r2=1.6 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_dentry.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_export.c.diff?cvsroot=cluster&r1=1.6&r2=1.7 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_export.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_file.c.diff?cvsroot=cluster&r1=1.23&r2=1.24 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_file.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_fstype.c.diff?cvsroot=cluster&r1=1.24&r2=1.25 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_fstype.h.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_inode.c.diff?cvsroot=cluster&r1=1.10&r2=1.11 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_inode.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_super.c.diff?cvsroot=cluster&r1=1.20&r2=1.21 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_super.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_vm.c.diff?cvsroot=cluster&r1=1.6&r2=1.7 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_vm.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/page.c.diff?cvsroot=cluster&r1=1.8&r2=1.9 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/page.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/quota.c.diff?cvsroot=cluster&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/quota.h.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/recovery.c.diff?cvsroot=cluster&r1=1.8&r2=1.9 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/recovery.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/rgrp.c.diff?cvsroot=cluster&r1=1.18&r2=1.19 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/rgrp.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/super.c.diff?cvsroot=cluster&r1=1.17&r2=1.18 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/super.h.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/trans.c.diff?cvsroot=cluster&r1=1.10&r2=1.11 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/trans.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/unlinked.c.diff?cvsroot=cluster&r1=1.7&r2=1.8 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/unlinked.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/util.c.diff?cvsroot=cluster&r1=1.12&r2=1.13 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/util.h.diff?cvsroot=cluster&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/debug.c.diff?cvsroot=cluster&r1=1.1&r2=NONE http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/debug.h.diff?cvsroot=cluster&r1=1.1&r2=NONE http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/diaper.c.diff?cvsroot=cluster&r1=1.4&r2=NONE http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/diaper.h.diff?cvsroot=cluster&r1=1.1&r2=NONE http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/locking.c.diff?cvsroot=cluster&r1=1.5&r2=NONE http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/proc.c.diff?cvsroot=cluster&r1=1.7&r2=NONE http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/proc.h.diff?cvsroot=cluster&r1=1.2&r2=NONE /cvs/cluster/cluster/gfs-kernel/src/gfs/sys.c,v --> standard output revision 1.1 --- cluster/gfs-kernel/src/gfs/sys.c +++ - 2006-07-10 23:22:34.870067000 +0000 @@ -0,0 +1,398 @@ +/****************************************************************************** +******************************************************************************* +** +** 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 v.2. +** +******************************************************************************* +******************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "gfs.h" +#include "glock.h" +#include "lm.h" +#include "sys.h" +#include "super.h" + +struct list_head gfs_fs_list; +struct semaphore gfs_fs_lock; +char *gfs_sys_margs; +spinlock_t gfs_sys_margs_lock; +spinlock_t req_lock; + +char *gfs_sys_margs; +spinlock_t gfs_sys_margs_lock; + +static ssize_t id_show(struct gfs_sbd *sdp, char *buf) +{ + return sprintf(buf, "%s\n", sdp->sd_vfs->s_id); +} + +static ssize_t fsname_show(struct gfs_sbd *sdp, char *buf) +{ + return sprintf(buf, "%s\n", sdp->sd_fsname); +} + +struct gfs_attr { + struct attribute attr; + ssize_t (*show)(struct gfs_sbd *, char *); + ssize_t (*store)(struct gfs_sbd *, const char *, size_t); +}; + +#define GFS_ATTR(name, mode, show, store) \ +static struct gfs_attr gfs_attr_##name = __ATTR(name, mode, show, store) + +GFS_ATTR(id, 0444, id_show, NULL); +GFS_ATTR(fsname, 0444, fsname_show, NULL); + +static struct attribute *gfs_attrs[] = { + &gfs_attr_id.attr, + &gfs_attr_fsname.attr, + NULL, +}; + +struct lockstruct_attr { + struct attribute attr; + ssize_t (*show)(struct gfs_sbd *, char *); +}; + +#define LOCKSTRUCT_ATTR(name, fmt) \ +static ssize_t name##_show(struct gfs_sbd *sdp, char *buf) \ +{ \ + return sprintf(buf, fmt, sdp->sd_lockstruct.ls_##name); \ +} \ +static struct lockstruct_attr lockstruct_attr_##name = __ATTR_RO(name) + +LOCKSTRUCT_ATTR(jid, "%u\n"); +LOCKSTRUCT_ATTR(first, "%u\n"); +LOCKSTRUCT_ATTR(lvb_size, "%u\n"); +LOCKSTRUCT_ATTR(flags, "%d\n"); + +static struct attribute *lockstruct_attrs[] = { + &lockstruct_attr_jid.attr, + &lockstruct_attr_first.attr, + &lockstruct_attr_lvb_size.attr, + &lockstruct_attr_flags.attr, + NULL +}; + +/* + * display struct gfs_args fields + */ + +struct args_attr { + struct attribute attr; + ssize_t (*show)(struct gfs_sbd *, char *); +}; + +#define ARGS_ATTR(name, fmt) \ +static ssize_t name##_show(struct gfs_sbd *sdp, char *buf) \ +{ \ + return sprintf(buf, fmt, sdp->sd_args.ar_##name); \ +} \ +static struct args_attr args_attr_##name = __ATTR_RO(name) + +ARGS_ATTR(lockproto, "%s\n"); +ARGS_ATTR(locktable, "%s\n"); +ARGS_ATTR(hostdata, "%s\n"); +ARGS_ATTR(spectator, "%d\n"); +ARGS_ATTR(ignore_local_fs, "%d\n"); +ARGS_ATTR(localcaching, "%d\n"); +ARGS_ATTR(localflocks, "%d\n"); +ARGS_ATTR(debug, "%d\n"); +ARGS_ATTR(upgrade, "%d\n"); +ARGS_ATTR(num_glockd, "%u\n"); +ARGS_ATTR(suiddir, "%d\n"); + +static struct attribute *args_attrs[] = { + &args_attr_lockproto.attr, + &args_attr_locktable.attr, + &args_attr_hostdata.attr, + &args_attr_spectator.attr, + &args_attr_ignore_local_fs.attr, + &args_attr_localcaching.attr, + &args_attr_localflocks.attr, + &args_attr_debug.attr, + &args_attr_upgrade.attr, + &args_attr_num_glockd.attr, + &args_attr_suiddir.attr, + NULL +}; + +/* + * display counters from superblock + */ + +struct counters_attr { + struct attribute attr; + ssize_t (*show)(struct gfs_sbd *, char *); +}; + +#define COUNTERS_ATTR(name, fmt) \ +static ssize_t name##_show(struct gfs_sbd *sdp, char *buf) \ +{ \ + return sprintf(buf, fmt, (unsigned int)atomic_read(&sdp->sd_##name)); \ +} \ +static struct counters_attr counters_attr_##name = __ATTR_RO(name) + +COUNTERS_ATTR(glock_count, "%u\n"); +COUNTERS_ATTR(glock_held_count, "%u\n"); +COUNTERS_ATTR(inode_count, "%u\n"); +COUNTERS_ATTR(reclaimed, "%u\n"); + +static struct attribute *counters_attrs[] = { + &counters_attr_glock_count.attr, + &counters_attr_glock_held_count.attr, + &counters_attr_inode_count.attr, + &counters_attr_reclaimed.attr, + NULL +}; + +static ssize_t gfs_attr_show(struct kobject *kobj, struct attribute *attr, + char *buf) +{ + struct gfs_sbd *sdp = container_of(kobj, struct gfs_sbd, sd_kobj); + struct gfs_attr *a = container_of(attr, struct gfs_attr, attr); + return a->show ? a->show(sdp, buf) : 0; +} + +static ssize_t gfs_attr_store(struct kobject *kobj, struct attribute *attr, + const char *buf, size_t len) +{ + struct gfs_sbd *sdp = container_of(kobj, struct gfs_sbd, sd_kobj); + struct gfs_attr *a = container_of(attr, struct gfs_attr, attr); + return a->store ? a->store(sdp, buf, len) : len; +} + +static struct sysfs_ops gfs_attr_ops = { + .show = gfs_attr_show, + .store = gfs_attr_store, +}; + +static struct kobj_type gfs_ktype = { + .default_attrs = gfs_attrs, + .sysfs_ops = &gfs_attr_ops, +}; + +static struct kset gfs_kset = { + .subsys = &fs_subsys, + .kobj = {.name = "gfs",}, + .ktype = &gfs_ktype, +}; + +static ssize_t tune_set(struct gfs_sbd *sdp, unsigned int *field, + int check_zero, const char *buf, size_t len) +{ + struct gfs_tune *gt = &sdp->sd_tune; + unsigned int x; + + if (!capable(CAP_SYS_ADMIN)) + return -EACCES; + + x = simple_strtoul(buf, NULL, 0); + + if (check_zero && !x) + return -EINVAL; + + spin_lock(>->gt_spin); + *field = x; + spin_unlock(>->gt_spin); + return len; +} + +struct tune_attr { + struct attribute attr; + ssize_t (*show)(struct gfs_sbd *, char *); + ssize_t (*store)(struct gfs_sbd *, const char *, size_t); +}; + +#define TUNE_ATTR_3(name, show, store) \ +static struct tune_attr tune_attr_##name = __ATTR(name, 0644, show, store) + +#define TUNE_ATTR_2(name, store) \ +static ssize_t name##_show(struct gfs_sbd *sdp, char *buf) \ +{ \ + return sprintf(buf, "%u\n", sdp->sd_tune.gt_##name); \ +} \ +TUNE_ATTR_3(name, name##_show, store) + +#define TUNE_ATTR(name, check_zero) \ +static ssize_t name##_store(struct gfs_sbd *sdp, const char *buf, size_t len)\ +{ \ + return tune_set(sdp, &sdp->sd_tune.gt_##name, check_zero, buf, len); \ +} \ +TUNE_ATTR_2(name, name##_store) + +#define TUNE_ATTR_DAEMON(name, process) \ +static ssize_t name##_store(struct gfs_sbd *sdp, const char *buf, size_t len)\ +{ \ + ssize_t r = tune_set(sdp, &sdp->sd_tune.gt_##name, 1, buf, len); \ + wake_up_process(sdp->sd_##process); \ + return r; \ +} \ +TUNE_ATTR_2(name, name##_store) + +TUNE_ATTR(ilimit1, 0); +TUNE_ATTR(ilimit1_tries, 0); +TUNE_ATTR(ilimit1_min, 0); +TUNE_ATTR(ilimit2, 0); +TUNE_ATTR(ilimit2_tries, 0); +TUNE_ATTR(ilimit2_min, 0); +TUNE_ATTR(demote_secs, 0); +TUNE_ATTR(incore_log_blocks, 0); +TUNE_ATTR(jindex_refresh_secs, 0); +TUNE_ATTR(quota_warn_period, 0); +TUNE_ATTR(quota_quantum, 0); +TUNE_ATTR(atime_quantum, 0); +TUNE_ATTR(max_readahead, 0); +TUNE_ATTR(complain_secs, 0); +TUNE_ATTR(reclaim_limit, 0); +TUNE_ATTR(prefetch_secs, 0); +TUNE_ATTR(statfs_slots, 0); +TUNE_ATTR(new_files_jdata, 0); +TUNE_ATTR(new_files_directio, 0); +TUNE_ATTR(quota_simul_sync, 1); +TUNE_ATTR(max_atomic_write, 1); +TUNE_ATTR(stall_secs, 1); +TUNE_ATTR(entries_per_readdir, 1); +TUNE_ATTR(greedy_default, 1); +TUNE_ATTR(greedy_quantum, 1); +TUNE_ATTR(greedy_max, 1); +TUNE_ATTR_DAEMON(scand_secs, scand_process); +TUNE_ATTR_DAEMON(recoverd_secs, recoverd_process); +TUNE_ATTR_DAEMON(logd_secs, logd_process); +TUNE_ATTR_DAEMON(quotad_secs, quotad_process); + +static struct attribute *tune_attrs[] = { + &tune_attr_ilimit1.attr, + &tune_attr_ilimit1_tries.attr, + &tune_attr_ilimit1_min.attr, + &tune_attr_ilimit2.attr, + &tune_attr_ilimit2_tries.attr, + &tune_attr_ilimit2_min.attr, + &tune_attr_demote_secs.attr, + &tune_attr_incore_log_blocks.attr, + &tune_attr_jindex_refresh_secs.attr, + &tune_attr_quota_warn_period.attr, + &tune_attr_quota_quantum.attr, + &tune_attr_atime_quantum.attr, + &tune_attr_max_readahead.attr, + &tune_attr_complain_secs.attr, + &tune_attr_reclaim_limit.attr, + &tune_attr_prefetch_secs.attr, + &tune_attr_statfs_slots.attr, + &tune_attr_quota_simul_sync.attr, + &tune_attr_max_atomic_write.attr, + &tune_attr_stall_secs.attr, + &tune_attr_entries_per_readdir.attr, + &tune_attr_greedy_default.attr, + &tune_attr_greedy_quantum.attr, + &tune_attr_greedy_max.attr, + &tune_attr_scand_secs.attr, + &tune_attr_recoverd_secs.attr, + &tune_attr_logd_secs.attr, + &tune_attr_quotad_secs.attr, + &tune_attr_new_files_jdata.attr, + &tune_attr_new_files_directio.attr, + NULL +}; + +static struct attribute_group lockstruct_group = { + .name = "lockstruct", + .attrs = lockstruct_attrs +}; + +static struct attribute_group counters_group = { + .name = "counters", + .attrs = counters_attrs +}; + +static struct attribute_group args_group = { + .name = "args", + .attrs = args_attrs +}; + +static struct attribute_group tune_group = { + .name = "tune", + .attrs = tune_attrs +}; + +int gfs_sys_fs_add(struct gfs_sbd *sdp) +{ + int error; + + sdp->sd_kobj.kset = &gfs_kset; + sdp->sd_kobj.ktype = &gfs_ktype; + + error = kobject_set_name(&sdp->sd_kobj, "%s", sdp->sd_table_name); + if (error) + goto fail; + + error = kobject_register(&sdp->sd_kobj); + if (error) + goto fail; + + error = sysfs_create_group(&sdp->sd_kobj, &lockstruct_group); + if (error) + goto fail_reg; + + error = sysfs_create_group(&sdp->sd_kobj, &counters_group); + if (error) + goto fail_lockstruct; + + error = sysfs_create_group(&sdp->sd_kobj, &args_group); + if (error) + goto fail_counters; + + error = sysfs_create_group(&sdp->sd_kobj, &tune_group); + if (error) + goto fail_args; + return 0; + + fail_args: + sysfs_remove_group(&sdp->sd_kobj, &args_group); + fail_counters: + sysfs_remove_group(&sdp->sd_kobj, &counters_group); + fail_lockstruct: + sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group); + fail_reg: + kobject_unregister(&sdp->sd_kobj); + fail: + return error; +} + +void gfs_sys_fs_del(struct gfs_sbd *sdp) +{ + sysfs_remove_group(&sdp->sd_kobj, &tune_group); + sysfs_remove_group(&sdp->sd_kobj, &args_group); + sysfs_remove_group(&sdp->sd_kobj, &counters_group); + sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group); + kobject_unregister(&sdp->sd_kobj); +} + +int gfs_sys_init(void) +{ + gfs_sys_margs = NULL; + spin_lock_init(&gfs_sys_margs_lock); + return kset_register(&gfs_kset); +} + +void gfs_sys_uninit(void) +{ + kfree(gfs_sys_margs); + kset_unregister(&gfs_kset); +} /cvs/cluster/cluster/gfs-kernel/src/gfs/sys.h,v --> standard output revision 1.1 --- cluster/gfs-kernel/src/gfs/sys.h +++ - 2006-07-10 23:22:34.953216000 +0000 @@ -0,0 +1,27 @@ +/****************************************************************************** +******************************************************************************* +** +** 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 v.2. +** +******************************************************************************* +******************************************************************************/ + +#ifndef __SYS_DOT_H__ +#define __SYS_DOT_H__ + +/* Allow args to be passed to GFS when using an initial ram disk */ +extern char *gfs_sys_margs; +extern spinlock_t gfs_sys_margs_lock; + +int gfs_sys_fs_add(struct gfs_sbd *sdp); +void gfs_sys_fs_del(struct gfs_sbd *sdp); + +int gfs_sys_init(void); +void gfs_sys_uninit(void); + +#endif /* __SYS_DOT_H__ */ --- cluster/gfs-kernel/src/gfs/Makefile 2006/01/09 21:12:24 1.9 +++ cluster/gfs-kernel/src/gfs/Makefile 2006/07/10 23:22:34 1.10 @@ -2,7 +2,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. 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 @@ -11,7 +11,7 @@ ############################################################################### ############################################################################### -top_srcdir = ../.. +top_srcdir = $(shell pwd)/../.. ifndef USING_KBUILD include ${top_srcdir}/make/defines.mk UNINSTALL=${top_srcdir}/scripts/uninstall.pl @@ -20,18 +20,16 @@ linux_orig = ${top_srcdir}/src/linux-orig linux_patched = ${top_srcdir}/src/linux-patched -TARGET = gfs.patch - PWD := $(shell pwd) +TARGET = gfs.patch +SYMVERFILE := ${KERNEL_SRC}/Module.symvers + obj-m := gfs.o -gfs-objs := \ - acl.o \ +gfs-objs := acl.o \ bits.o \ bmap.o \ daemon.o \ - debug.o \ - diaper.o \ dio.o \ dir.o \ eaops.o \ @@ -57,24 +55,22 @@ ops_super.o \ ops_vm.o \ page.o \ - proc.o \ quota.o \ recovery.o \ rgrp.o \ super.o \ + sys.o \ trans.o \ unlinked.o \ - util.o \ - locking.o - -EXTRA_CFLAGS += -I$(obj) + util.o -#EXTRA_CFLAGS += -DGFS_TRACE -#EXTRA_CFLAGS += -DGFS_PROFILE +EXTRA_CFLAGS += -I$(obj) -I${incdir} -I/usr/include all: - ${top_srcdir}/../kdbl/scripts/build_debug gfs *.[ch] > gfs_debug_const.h - ${MAKE} -C ${KERNEL_SRC} M=${PWD} modules USING_KBUILD=yes + rm -f linux lm_interface.h + ln -s . linux + ln -s ${KERNEL_SRC}/fs/gfs2/lm_interface.h . + ${MAKE} -C ${KERNEL_SRC} M=${PWD} symverfile=${SYMVERFILE} modules USING_KBUILD=yes install: all install -d ${module_dir}/fs/gfs @@ -87,8 +83,8 @@ ${UNINSTALL} gfs_ondisk.h gfs_ioctl.h ${incdir}/linux clean: - rm -rf linux *.o .*.o.cmd .gfs.ko.cmd \ - gfs.ko gfs.mod.c .tmp_versions *~ gfs_debug_const.h + rm -rf linux *.o .*.o.cmd .gfs.ko.cmd lm_interface.h \ + gfs.ko gfs.mod.c .tmp_versions *~ *~* Modules.symvers patches: pre add post --- cluster/gfs-kernel/src/gfs/acl.c 2006/01/09 22:25:06 1.8 +++ cluster/gfs-kernel/src/gfs/acl.c 2006/07/10 23:22:34 1.9 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -42,23 +42,22 @@ struct gfs_ea_request *er, int *remove, mode_t *mode) { - ENTER(GFN_ACL_VALIDATE_SET) struct posix_acl *acl; int error; error = gfs_acl_validate_remove(ip, access); if (error) - RETURN(GFN_ACL_VALIDATE_SET, error); + return error; if (!er->er_data) - RETURN(GFN_ACL_VALIDATE_SET, -EINVAL); + return -EINVAL; acl = posix_acl_from_xattr(er->er_data, er->er_data_len); if (IS_ERR(acl)) - RETURN(GFN_ACL_VALIDATE_SET, PTR_ERR(acl)); + return PTR_ERR(acl); if (!acl) { *remove = TRUE; - RETURN(GFN_ACL_VALIDATE_SET, 0); + return 0; } error = posix_acl_valid(acl); @@ -76,7 +75,7 @@ out: posix_acl_release(acl); - RETURN(GFN_ACL_VALIDATE_SET, error); + return error; } /** @@ -90,22 +89,20 @@ int gfs_acl_validate_remove(struct gfs_inode *ip, int access) { - ENTER(GFN_ACL_VALIDATE_REMOVE) - if (!ip->i_sbd->sd_args.ar_posix_acls) - RETURN(GFN_ACL_VALIDATE_REMOVE, -EOPNOTSUPP); + return -EOPNOTSUPP; if (current->fsuid != ip->i_di.di_uid && !capable(CAP_FOWNER)) - RETURN(GFN_ACL_VALIDATE_REMOVE, -EPERM); + return -EPERM; if (ip->i_di.di_type == GFS_FILE_LNK) - RETURN(GFN_ACL_VALIDATE_REMOVE, -EOPNOTSUPP); + return -EOPNOTSUPP; if (!access && ip->i_di.di_type != GFS_FILE_DIR) - RETURN(GFN_ACL_VALIDATE_REMOVE, -EACCES); + return -EACCES; - RETURN(GFN_ACL_VALIDATE_REMOVE, 0); + return 0; } /** - * acl_get - + * gfs_acl_get - * @ip: * @access: * @acl: @@ -114,15 +111,14 @@ */ int -acl_get(struct gfs_inode *ip, int access, struct posix_acl **acl) +gfs_acl_get(struct gfs_inode *ip, int access, struct posix_acl **acl) { - ENTER(GFN_ACL_GET) struct gfs_ea_request er; struct gfs_ea_location el; int error; if (!ip->i_di.di_eattr) - RETURN(GFN_ACL_GET, 0); + return 0; memset(&er, 0, sizeof(struct gfs_ea_request)); if (access) { @@ -136,9 +132,9 @@ error = gfs_ea_find(ip, &er, &el); if (error) - RETURN(GFN_ACL_GET, error); + return error; if (!el.el_ea) - RETURN(GFN_ACL_GET, 0); + return 0; if (!GFS_EA_DATA_LEN(el.el_ea)) goto out; @@ -161,7 +157,7 @@ out: brelse(el.el_bh); - RETURN(GFN_ACL_GET, error); + return error; } /** @@ -175,22 +171,21 @@ int gfs_check_acl(struct inode *inode, int mask) { - ENTER(GFN_CHECK_ACL) struct posix_acl *acl = NULL; int error; - error = acl_get(get_v2ip(inode), TRUE, &acl); + error = gfs_acl_get(get_v2ip(inode), TRUE, &acl); if (error) - RETURN(GFN_CHECK_ACL, error); + return error; if (acl) { error = posix_acl_permission(inode, acl, mask); posix_acl_release(acl); - RETURN(GFN_CHECK_ACL, error); + return error; } - - RETURN(GFN_CHECK_ACL, -EAGAIN); -} + + return -EAGAIN; +} /** * gfs_acl_new_prep - @@ -212,22 +207,21 @@ unsigned int *size, unsigned int *blocks) { - ENTER(GFN_ACL_NEW_PREP) struct posix_acl *acl = NULL; int set_a = FALSE, set_d = FALSE; int error; if (!dip->i_sbd->sd_args.ar_posix_acls) - RETURN(GFN_ACL_NEW_PREP, 0); + return 0; if (type == GFS_FILE_LNK) - RETURN(GFN_ACL_NEW_PREP, 0); + return 0; - error = acl_get(dip, FALSE, &acl); + error = gfs_acl_get(dip, FALSE, &acl); if (error) - RETURN(GFN_ACL_NEW_PREP, error); + return error; if (!acl) { (*mode) &= ~current->fs->umask; - RETURN(GFN_ACL_NEW_PREP, 0); + return 0; } { @@ -286,7 +280,7 @@ out: posix_acl_release(acl); - RETURN(GFN_ACL_NEW_PREP, error); + return error; } /** @@ -300,11 +294,9 @@ * Returns: errno */ -int -gfs_acl_new_init(struct gfs_inode *dip, struct gfs_inode *ip, - void *a_data, void *d_data, unsigned int size) +int gfs_acl_new_init(struct gfs_inode *dip, struct gfs_inode *ip, + void *a_data, void *d_data, unsigned int size) { - ENTER(GFN_ACL_NEW_INIT) void *data = (a_data) ? a_data : d_data; unsigned int x; int error = 0; @@ -339,7 +331,7 @@ kfree(data); - RETURN(GFN_ACL_NEW_INIT, error); + return error; } /** @@ -353,7 +345,6 @@ int gfs_acl_chmod(struct gfs_inode *ip, struct iattr *attr) { - ENTER(GFN_ACL_CHMOD) struct gfs_ea_request er; struct gfs_ea_location el; struct posix_acl *acl; @@ -369,7 +360,7 @@ error = gfs_ea_find(ip, &er, &el); if (error) - RETURN(GFN_ACL_CHMOD, error); + return error; if (!el.el_ea) goto simple; if (!GFS_EA_DATA_LEN(el.el_ea)) @@ -411,8 +402,8 @@ out: brelse(el.el_bh); - RETURN(GFN_ACL_CHMOD, error); + return error; simple: - RETURN(GFN_ACL_CHMOD, gfs_setattr_simple(ip, attr)); + return gfs_setattr_simple(ip, attr); } --- cluster/gfs-kernel/src/gfs/acl.h 2005/05/18 23:33:27 1.4 +++ cluster/gfs-kernel/src/gfs/acl.h 2006/07/10 23:22:34 1.5 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -33,6 +33,7 @@ struct gfs_ea_request *er, int *remove, mode_t *mode); int gfs_acl_validate_remove(struct gfs_inode *ip, int access); +int gfs_acl_get(struct gfs_inode *ip, int access, struct posix_acl **acl); int gfs_check_acl(struct inode *inode, int mask); int gfs_acl_new_prep(struct gfs_inode *dip, unsigned int type, mode_t *mode, --- cluster/gfs-kernel/src/gfs/bits.c 2005/01/12 23:04:18 1.5 +++ cluster/gfs-kernel/src/gfs/bits.c 2006/07/10 23:22:34 1.6 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -53,7 +53,6 @@ unsigned char *buffer, unsigned int buflen, uint32_t block, unsigned char new_state) { - ENTER(GFN_SETBIT) unsigned char *byte, *end, cur_state; unsigned int bit; @@ -70,8 +69,6 @@ *byte |= new_state << bit; } else gfs_consist_rgrpd(rgd); - - RET(GFN_SETBIT); } /** @@ -86,7 +83,6 @@ gfs_testbit(struct gfs_rgrpd *rgd, unsigned char *buffer, unsigned int buflen, uint32_t block) { - ENTER(GFN_TESTBIT) unsigned char *byte, *end, cur_state; unsigned int bit; @@ -98,7 +94,7 @@ cur_state = (*byte >> bit) & GFS_BIT_MASK; - RETURN(GFN_TESTBIT, cur_state); + return cur_state; } /** @@ -123,7 +119,6 @@ unsigned char *buffer, unsigned int buflen, uint32_t goal, unsigned char old_state) { - ENTER(GFN_BITFIT) unsigned char *byte, *end, alloc; uint32_t blk = goal; unsigned int bit; @@ -144,7 +139,7 @@ } if (((*byte >> bit) & GFS_BIT_MASK) == old_state) - RETURN(GFN_BITFIT, blk); + return blk; bit += GFS_BIT_SIZE; if (bit >= 8) { @@ -155,7 +150,7 @@ blk++; } - RETURN(GFN_BITFIT, BFITNOENT); + return BFITNOENT; } /** @@ -172,7 +167,6 @@ unsigned char *buffer, unsigned int buflen, unsigned char state) { - ENTER(GFN_BITCOUNT) unsigned char *byte = buffer; unsigned char *end = buffer + buflen; unsigned char state1 = state << 2; @@ -191,5 +185,5 @@ count++; } - RETURN(GFN_BITCOUNT, count); + return count; } --- cluster/gfs-kernel/src/gfs/bits.h 2004/06/24 08:53:27 1.1 +++ cluster/gfs-kernel/src/gfs/bits.h 2006/07/10 23:22:34 1.2 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/bmap.c 2006/01/09 22:25:06 1.8 +++ cluster/gfs-kernel/src/gfs/bmap.c 2006/07/10 23:22:34 1.9 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -56,14 +56,13 @@ gfs_unstuffer_sync(struct gfs_inode *ip, struct buffer_head *dibh, uint64_t block, void *private) { - ENTER(GFN_UNSTUFFER_SYNC) struct gfs_sbd *sdp = ip->i_sbd; struct buffer_head *bh; int error; error = gfs_get_data_buffer(ip, block, TRUE, &bh); if (error) - RETURN(GFN_UNSTUFFER_SYNC, error); + return error; gfs_buffer_copy_tail(bh, 0, dibh, sizeof(struct gfs_dinode)); @@ -71,7 +70,7 @@ brelse(bh); - RETURN(GFN_UNSTUFFER_SYNC, error); + return error; } /** @@ -88,14 +87,13 @@ gfs_unstuffer_async(struct gfs_inode *ip, struct buffer_head *dibh, uint64_t block, void *private) { - ENTER(GFN_UNSTUFFER_ASYNC) struct gfs_sbd *sdp = ip->i_sbd; struct buffer_head *bh; int error; error = gfs_get_data_buffer(ip, block, TRUE, &bh); if (error) - RETURN(GFN_UNSTUFFER_ASYNC, error); + return error; gfs_buffer_copy_tail(bh, 0, dibh, sizeof(struct gfs_dinode)); @@ -103,7 +101,7 @@ brelse(bh); - RETURN(GFN_UNSTUFFER_ASYNC, error); + return error; } /** @@ -122,18 +120,17 @@ gfs_unstuff_dinode(struct gfs_inode *ip, gfs_unstuffer_t unstuffer, void *private) { - ENTER(GFN_UNSTUFF_DINODE) struct buffer_head *bh, *dibh; uint64_t block = 0; int journaled = gfs_is_jdata(ip); int error; down_write(&ip->i_rw_mutex); - + error = gfs_get_inode_buffer(ip, &dibh); if (error) goto out; - + if (ip->i_di.di_size) { /* Get a free block, fill it with the stuffed data, and write it out to disk */ @@ -179,9 +176,9 @@ brelse(dibh); out: - up_write(&ip->i_rw_mutex); + up_write(&ip->i_rw_mutex); - RETURN(GFN_UNSTUFF_DINODE, error); + return error; } /** @@ -200,7 +197,6 @@ static unsigned int calc_tree_height(struct gfs_inode *ip, uint64_t size) { - ENTER(GFN_CALC_TREE_HEIGHT) struct gfs_sbd *sdp = ip->i_sbd; uint64_t *arr; unsigned int max, height; @@ -220,7 +216,7 @@ if (arr[height] >= size) break; - RETURN(GFN_CALC_TREE_HEIGHT, height); + return height; } /** @@ -237,7 +233,6 @@ static int build_height(struct gfs_inode *ip, int height) { - ENTER(GFN_BUILD_HEIGHT) struct gfs_sbd *sdp = ip->i_sbd; struct buffer_head *bh, *dibh; uint64_t block, *bp; @@ -248,7 +243,7 @@ while (ip->i_di.di_height < height) { error = gfs_get_inode_buffer(ip, &dibh); if (error) - RETURN(GFN_BUILD_HEIGHT, error); + return error; new_block = FALSE; bp = (uint64_t *)(dibh->b_data + sizeof(struct gfs_dinode)); @@ -302,12 +297,12 @@ brelse(dibh); } - RETURN(GFN_BUILD_HEIGHT, 0); + return 0; fail: brelse(dibh); - RETURN(GFN_BUILD_HEIGHT, error); + return error; } /** @@ -372,7 +367,6 @@ static struct metapath * find_metapath(struct gfs_inode *ip, uint64_t block) { - ENTER(GFN_FIND_METAPATH) struct gfs_sbd *sdp = ip->i_sbd; struct metapath *mp; uint64_t b = block; @@ -384,7 +378,7 @@ for (i = ip->i_di.di_height; i--;) mp->mp_list[i] = do_div(b, sdp->sd_inptrs); - RETURN(GFN_FIND_METAPATH, mp); + return mp; } /** @@ -429,23 +423,22 @@ struct buffer_head *bh, unsigned int height, struct metapath *mp, int create, int *new, uint64_t *block) { - ENTER(GFN_GET_METABLOCK) uint64_t *ptr = metapointer(bh, height, mp); int error; if (*ptr) { *block = gfs64_to_cpu(*ptr); - RETURN(GFN_GET_METABLOCK, 0); + return 0; } *block = 0; if (!create) - RETURN(GFN_GET_METABLOCK, 0); + return 0; error = gfs_metaalloc(ip, block); if (error) - RETURN(GFN_GET_METABLOCK, error); + return error; gfs_trans_add_bh(ip->i_gl, bh); @@ -454,7 +447,7 @@ *new = 1; - RETURN(GFN_GET_METABLOCK, 0); + return 0; } /** @@ -478,24 +471,23 @@ struct buffer_head *bh, struct metapath *mp, int create, int *new, uint64_t *block) { - ENTER(GFN_GET_DATABLOCK) uint64_t *ptr = metapointer(bh, ip->i_di.di_height - 1, mp); if (*ptr) { *block = gfs64_to_cpu(*ptr); - RETURN(GFN_GET_DATABLOCK, 0); + return 0; } *block = 0; if (!create) - RETURN(GFN_GET_DATABLOCK, 0); + return 0; if (gfs_is_jdata(ip)) { int error; error = gfs_metaalloc(ip, block); if (error) - RETURN(GFN_GET_DATABLOCK, error); + return error; } else gfs_blkalloc(ip, block); @@ -506,7 +498,7 @@ *new = 1; - RETURN(GFN_GET_DATABLOCK, 0); + return 0; } /** @@ -528,7 +520,6 @@ uint64_t lblock, int *new, uint64_t *dblock, uint32_t *extlen) { - ENTER(GFN_BLOCK_MAP) struct gfs_sbd *sdp = ip->i_sbd; struct buffer_head *bh; struct metapath *mp; @@ -630,8 +621,8 @@ up_write(&ip->i_rw_mutex); else up_read(&ip->i_rw_mutex); - - RETURN(GFN_BLOCK_MAP, error); + + return error; } /** @@ -647,7 +638,6 @@ static int do_grow(struct gfs_inode *ip, uint64_t size) { - ENTER(GFN_DO_GROW) struct gfs_sbd *sdp = ip->i_sbd; struct gfs_alloc *al; struct buffer_head *dibh; @@ -727,7 +717,7 @@ out: gfs_alloc_put(ip); - RETURN(GFN_DO_GROW, error); + return error; } /** @@ -752,7 +742,6 @@ struct metapath *mp, unsigned int height, uint64_t block, int first, block_call_t bc, void *data) { - ENTER(GFN_RECURSIVE_SCAN) struct gfs_sbd *sdp = ip->i_sbd; struct buffer_head *bh = NULL; uint64_t *top, *bottom; @@ -800,13 +789,13 @@ brelse(bh); - RETURN(GFN_RECURSIVE_SCAN, 0); + return 0; fail: if (bh) brelse(bh); - RETURN(GFN_RECURSIVE_SCAN, error); + return error; } /** @@ -827,7 +816,6 @@ struct buffer_head *bh, uint64_t *top, uint64_t *bottom, unsigned int height, void *data) { - ENTER(GFN_DO_STRIP) struct strip_mine *sm = (struct strip_mine *)data; struct gfs_sbd *sdp = ip->i_sbd; struct gfs_rgrp_list rlist; @@ -843,7 +831,7 @@ sm->sm_first = FALSE; if (height != sm->sm_height) - RETURN(GFN_DO_STRIP, 0); + return 0; if (sm->sm_first) { top++; @@ -854,7 +842,7 @@ error = gfs_rindex_hold(sdp, &ip->i_alloc->al_ri_gh); if (error) - RETURN(GFN_DO_STRIP, error); + return error; memset(&rlist, 0, sizeof(struct gfs_rgrp_list)); bstart = 0; @@ -961,7 +949,7 @@ out: gfs_glock_dq_uninit(&ip->i_alloc->al_ri_gh); - RETURN(GFN_DO_STRIP, error); + return error; } /** @@ -975,7 +963,6 @@ int gfs_truncator_default(struct gfs_inode *ip, uint64_t size) { - ENTER(GFN_TRUNCATOR_DEFAULT) struct gfs_sbd *sdp = ip->i_sbd; struct buffer_head *bh; uint64_t bn; @@ -985,13 +972,13 @@ error = gfs_block_map(ip, size >> sdp->sd_sb.sb_bsize_shift, ¬_new, &bn, NULL); if (error) - RETURN(GFN_TRUNCATOR_DEFAULT, error); + return error; if (!bn) - RETURN(GFN_TRUNCATOR_DEFAULT, 0); + return 0; error = gfs_get_data_buffer(ip, bn, FALSE, &bh); if (error) - RETURN(GFN_TRUNCATOR_DEFAULT, error); + return error; gfs_buffer_clear_tail(bh, size & (sdp->sd_sb.sb_bsize - 1)); @@ -999,7 +986,7 @@ brelse(bh); - RETURN(GFN_TRUNCATOR_DEFAULT, error); + return error; } /** @@ -1013,7 +1000,6 @@ static int truncator_journaled(struct gfs_inode *ip, uint64_t size) { - ENTER(GFN_TRUNCATOR_JOURNALED) struct gfs_sbd *sdp = ip->i_sbd; struct buffer_head *bh; uint64_t lbn, dbn; @@ -1026,13 +1012,13 @@ error = gfs_block_map(ip, lbn, ¬_new, &dbn, NULL); if (error) - RETURN(GFN_TRUNCATOR_JOURNALED, error); + return error; if (!dbn) - RETURN(GFN_TRUNCATOR_JOURNALED, 0); + return 0; error = gfs_trans_begin(sdp, 1, 0); if (error) - RETURN(GFN_TRUNCATOR_JOURNALED, error); + return error; error = gfs_get_data_buffer(ip, dbn, FALSE, &bh); if (!error) { @@ -1045,7 +1031,7 @@ gfs_trans_end(sdp); - RETURN(GFN_TRUNCATOR_JOURNALED, error); + return error; } /** @@ -1062,7 +1048,6 @@ int gfs_shrink(struct gfs_inode *ip, uint64_t size, gfs_truncator_t truncator) { - ENTER(GFN_SHRINK) struct gfs_sbd *sdp = ip->i_sbd; struct gfs_holder ri_gh; struct gfs_rgrpd *rgd; @@ -1092,7 +1077,7 @@ if (error) { gfs_alloc_put(ip); kfree(mp); - RETURN(GFN_SHRINK, error); + return error; } while (height--) { @@ -1107,7 +1092,7 @@ gfs_quota_unhold_m(ip); gfs_alloc_put(ip); kfree(mp); - RETURN(GFN_SHRINK, error); + return error; } } @@ -1124,12 +1109,12 @@ if (do_mod(size, sdp->sd_jbsize)) { error = truncator_journaled(ip, size); if (error) - RETURN(GFN_SHRINK, error); + return error; } } else if (size & (uint64_t)(sdp->sd_sb.sb_bsize - 1)) { error = truncator(ip, size); if (error) - RETURN(GFN_SHRINK, error); + return error; } /* Set the new size (and possibly the height) */ @@ -1137,7 +1122,7 @@ if (!size) { error = gfs_rindex_hold(sdp, &ri_gh); if (error) - RETURN(GFN_SHRINK, error); + return error; } error = gfs_trans_begin(sdp, 1, 0); @@ -1187,7 +1172,7 @@ if (!size) gfs_glock_dq_uninit(&ri_gh); - RETURN(GFN_SHRINK, error); + return error; } /** @@ -1200,14 +1185,13 @@ static int do_same(struct gfs_inode *ip) { - ENTER(GFN_DO_SAME) struct gfs_sbd *sdp = ip->i_sbd; struct buffer_head *dibh; int error; error = gfs_trans_begin(sdp, 1, 0); if (error) - RETURN(GFN_DO_SAME, error); + return error; error = gfs_get_inode_buffer(ip, &dibh); if (error) @@ -1223,7 +1207,7 @@ out: gfs_trans_end(sdp); - RETURN(GFN_DO_SAME, error); + return error; } /** @@ -1241,17 +1225,15 @@ gfs_truncatei(struct gfs_inode *ip, uint64_t size, gfs_truncator_t truncator) { - ENTER(GFN_TRUNCATEI) - if (gfs_assert_warn(ip->i_sbd, ip->i_di.di_type == GFS_FILE_REG)) - RETURN(GFN_TRUNCATEI, -EINVAL); + return -EINVAL; if (size == ip->i_di.di_size) - RETURN(GFN_TRUNCATEI, do_same(ip)); + return do_same(ip); else if (size > ip->i_di.di_size) - RETURN(GFN_TRUNCATEI, do_grow(ip, size)); + return do_grow(ip, size); else - RETURN(GFN_TRUNCATEI, gfs_shrink(ip, size, truncator)); + return gfs_shrink(ip, size, truncator); } /** @@ -1267,7 +1249,6 @@ gfs_write_calc_reserv(struct gfs_inode *ip, unsigned int len, unsigned int *data_blocks, unsigned int *ind_blocks) { - ENTER(GFN_WRITE_CALC_RESERV) struct gfs_sbd *sdp = ip->i_sbd; unsigned int tmp; @@ -1283,8 +1264,6 @@ tmp = DIV_RU(tmp, sdp->sd_inptrs); *ind_blocks += tmp; } - - RET(GFN_WRITE_CALC_RESERV); } /** @@ -1302,7 +1281,6 @@ uint64_t offset, unsigned int len, int *alloc_required) { - ENTER(GFN_WRITE_ALLOC_REQUIRED) struct gfs_sbd *sdp = ip->i_sbd; uint64_t lblock, lblock_stop, dblock; uint32_t extlen; @@ -1312,12 +1290,12 @@ *alloc_required = FALSE; if (!len) - RETURN(GFN_WRITE_ALLOC_REQUIRED, 0); + return 0; if (gfs_is_stuffed(ip)) { if (offset + len > sdp->sd_sb.sb_bsize - sizeof(struct gfs_dinode)) *alloc_required = TRUE; - RETURN(GFN_WRITE_ALLOC_REQUIRED, 0); + return 0; } if (gfs_is_jdata(ip)) { @@ -1335,15 +1313,15 @@ for (; lblock < lblock_stop; lblock += extlen) { error = gfs_block_map(ip, lblock, ¬_new, &dblock, &extlen); if (error) - RETURN(GFN_WRITE_ALLOC_REQUIRED, error); + return error; if (!dblock) { *alloc_required = TRUE; - RETURN(GFN_WRITE_ALLOC_REQUIRED, 0); + return 0; } } - RETURN(GFN_WRITE_ALLOC_REQUIRED, 0); + return 0; } /** @@ -1366,17 +1344,16 @@ struct buffer_head *bh, uint64_t *top, uint64_t *bottom, unsigned int height, void *data) { - ENTER(GFN_DO_GFM) struct gfs_user_buffer *ub = (struct gfs_user_buffer *)data; int error; error = gfs_add_bh_to_ub(ub, bh); if (error) - RETURN(GFN_DO_GFM, error); + return error; if (ip->i_di.di_type != GFS_FILE_DIR || height + 1 != ip->i_di.di_height) - RETURN(GFN_DO_GFM, 0); + return 0; for (; top < bottom; top++) if (*top) { @@ -1386,17 +1363,17 @@ DIO_START | DIO_WAIT, &data_bh); if (error) - RETURN(GFN_DO_GFM, error); + return error; error = gfs_add_bh_to_ub(ub, data_bh); brelse(data_bh); if (error) - RETURN(GFN_DO_GFM, error); + return error; } - RETURN(GFN_DO_GFM, 0); + return 0; } /** @@ -1410,7 +1387,6 @@ int gfs_get_file_meta(struct gfs_inode *ip, struct gfs_user_buffer *ub) { - ENTER(GFN_GET_FILE_META) int error; if (gfs_is_stuffed(ip)) { @@ -1426,5 +1402,5 @@ kfree(mp); } - RETURN(GFN_GET_FILE_META, error); + return error; } --- cluster/gfs-kernel/src/gfs/bmap.h 2004/06/24 08:53:27 1.1 +++ cluster/gfs-kernel/src/gfs/bmap.h 2006/07/10 23:22:34 1.2 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/daemon.c 2005/01/12 23:04:18 1.6 +++ cluster/gfs-kernel/src/gfs/daemon.c 2006/07/10 23:22:34 1.7 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -39,7 +39,6 @@ int gfs_scand(void *data) { - ENTER(GFN_SCAND) struct gfs_sbd *sdp = (struct gfs_sbd *)data; daemonize("gfs_scand"); @@ -62,7 +61,7 @@ complete(&sdp->sd_thread_completion); - RETURN(GFN_SCAND, 0); + return 0; } /** @@ -78,7 +77,6 @@ int gfs_glockd(void *data) { - ENTER(GFN_GLOCKD) struct gfs_sbd *sdp = (struct gfs_sbd *)data; daemonize("gfs_glockd"); @@ -96,8 +94,8 @@ DECLARE_WAITQUEUE(__wait_chan, current); set_current_state(TASK_INTERRUPTIBLE); add_wait_queue(&sdp->sd_reclaim_wchan, &__wait_chan); - if (!atomic_read(&sdp->sd_reclaim_count) && - test_bit(SDF_GLOCKD_RUN, &sdp->sd_flags)) + if (!atomic_read(&sdp->sd_reclaim_count) + && test_bit(SDF_GLOCKD_RUN, &sdp->sd_flags)) schedule(); remove_wait_queue(&sdp->sd_reclaim_wchan, &__wait_chan); set_current_state(TASK_RUNNING); @@ -106,7 +104,7 @@ complete(&sdp->sd_thread_completion); - RETURN(GFN_GLOCKD, 0); + return 0; } /** @@ -118,7 +116,6 @@ int gfs_recoverd(void *data) { - ENTER(GFN_RECOVERD) struct gfs_sbd *sdp = (struct gfs_sbd *)data; daemonize("gfs_recoverd"); @@ -141,7 +138,7 @@ complete(&sdp->sd_thread_completion); - RETURN(GFN_RECOVERD, 0); + return 0; } /** @@ -155,7 +152,6 @@ int gfs_logd(void *data) { - ENTER(GFN_LOGD) struct gfs_sbd *sdp = (struct gfs_sbd *)data; struct gfs_holder ji_gh; @@ -190,7 +186,7 @@ complete(&sdp->sd_thread_completion); - RETURN(GFN_LOGD, 0); + return 0; } /** @@ -202,7 +198,6 @@ int gfs_quotad(void *data) { - ENTER(GFN_QUOTAD) struct gfs_sbd *sdp = (struct gfs_sbd *)data; int error; @@ -240,7 +235,7 @@ complete(&sdp->sd_thread_completion); - RETURN(GFN_QUOTAD, 0); + return 0; } /** @@ -252,7 +247,6 @@ int gfs_inoded(void *data) { - ENTER(GFN_INODED) struct gfs_sbd *sdp = (struct gfs_sbd *)data; daemonize("gfs_inoded"); @@ -275,5 +269,5 @@ complete(&sdp->sd_thread_completion); - RETURN(GFN_INODED, 0); + return 0; } --- cluster/gfs-kernel/src/gfs/daemon.h 2004/06/24 08:53:27 1.1 +++ cluster/gfs-kernel/src/gfs/daemon.h 2006/07/10 23:22:34 1.2 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/dio.c 2006/01/09 22:25:06 1.17 +++ cluster/gfs-kernel/src/gfs/dio.c 2006/07/10 23:22:34 1.18 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -48,9 +48,8 @@ aspace_get_block(struct inode *inode, sector_t lblock, struct buffer_head *bh_result, int create) { - ENTER(GFN_ASPACE_GET_BLOCK) gfs_assert_warn(get_v2sdp(inode->i_sb), FALSE); - RETURN(GFN_ASPACE_GET_BLOCK, -ENOSYS); + return -ENOSYS; } /** @@ -64,8 +63,7 @@ static int gfs_aspace_writepage(struct page *page, struct writeback_control *wbc) { - ENTER(GFN_ASPACE_WRITEPAGE) - RETURN(GFN_ASPACE_WRITEPAGE, block_write_full_page(page, aspace_get_block, wbc)); + return block_write_full_page(page, aspace_get_block, wbc); } /** @@ -77,7 +75,6 @@ static void stuck_releasepage(struct buffer_head *bh) { - ENTER(GFN_STUCK_RELEASEPAGE) struct gfs_sbd *sdp = get_v2sdp(bh->b_page->mapping->host->i_sb); struct gfs_bufdata *bd = get_v2bd(bh); @@ -134,8 +131,6 @@ } } } - - RET(GFN_STUCK_RELEASEPAGE); } /** @@ -152,7 +147,6 @@ static int gfs_aspace_releasepage(struct page *page, gfp_t gfp_mask) { - ENTER(GFN_ASPACE_RELEASEPAGE) struct inode *aspace = page->mapping->host; struct gfs_sbd *sdp = get_v2sdp(aspace->i_sb); struct buffer_head *bh, *head; @@ -179,7 +173,7 @@ continue; } - RETURN(GFN_ASPACE_RELEASEPAGE, 0); + return 0; } bd = get_v2bd(bh); @@ -200,7 +194,7 @@ while (bh != head); out: - RETURN(GFN_ASPACE_RELEASEPAGE, try_to_free_buffers(page)); + return try_to_free_buffers(page); } static struct address_space_operations aspace_aops = { @@ -224,7 +218,6 @@ struct inode * gfs_aspace_get(struct gfs_sbd *sdp) { - ENTER(GFN_ASPACE_GET) struct inode *aspace; aspace = new_inode(sdp->sd_vfs); @@ -236,7 +229,7 @@ insert_inode_hash(aspace); } - RETURN(GFN_ASPACE_GET, aspace); + return aspace; } /** @@ -248,10 +241,8 @@ void gfs_aspace_put(struct inode *aspace) { - ENTER(GFN_ASPACE_PUT) remove_inode_hash(aspace); iput(aspace); - RET(GFN_ASPACE_PUT); } /** @@ -264,7 +255,6 @@ void gfs_ail_start_trans(struct gfs_sbd *sdp, struct gfs_trans *tr) { - ENTER(GFN_AIL_START_TRANS) struct list_head *head, *tmp, *prev; struct gfs_bufdata *bd; struct buffer_head *bh; @@ -319,8 +309,6 @@ spin_unlock(&sdp->sd_ail_lock); } while (retry); - - RET(GFN_AIL_START_TRANS); } /** @@ -333,7 +321,6 @@ int gfs_ail_empty_trans(struct gfs_sbd *sdp, struct gfs_trans *tr) { - ENTER(GFN_AIL_EMPTY_TRANS) struct list_head *head, *tmp, *prev; struct gfs_bufdata *bd; struct buffer_head *bh; @@ -369,7 +356,7 @@ spin_unlock(&sdp->sd_ail_lock); - RETURN(GFN_AIL_EMPTY_TRANS, ret); + return ret; } /** @@ -382,7 +369,6 @@ static void ail_empty_gl(struct gfs_glock *gl) { - ENTER(GFN_AIL_EMPTY_GL) struct gfs_sbd *sdp = gl->gl_sbd; struct gfs_bufdata *bd; struct buffer_head *bh; @@ -405,8 +391,6 @@ } spin_unlock(&sdp->sd_ail_lock); - - RET(GFN_AIL_EMPTY_GL); } /** @@ -418,7 +402,6 @@ void gfs_inval_buf(struct gfs_glock *gl) { - ENTER(GFN_INVAL_BUF) struct inode *aspace = gl->gl_aspace; struct address_space *mapping = gl->gl_aspace->i_mapping; @@ -429,8 +412,6 @@ atomic_dec(&aspace->i_writecount); gfs_assert_withdraw(gl->gl_sbd, !mapping->nrpages); - - RET(GFN_INVAL_BUF); } /** @@ -443,7 +424,6 @@ void gfs_sync_buf(struct gfs_glock *gl, int flags) { - ENTER(GFN_SYNC_BUF) struct address_space *mapping = gl->gl_aspace->i_mapping; int error = 0; @@ -456,8 +436,6 @@ if (error) gfs_io_error(gl->gl_sbd); - - RET(GFN_SYNC_BUF); } /** @@ -473,7 +451,6 @@ static struct buffer_head * getbuf(struct gfs_sbd *sdp, struct inode *aspace, uint64_t blkno, int create) { - ENTER(GFN_GETBUF) struct page *page; struct buffer_head *bh; unsigned int shift; @@ -489,7 +466,7 @@ } else { page = find_lock_page(aspace->i_mapping, index); if (!page) - RETURN(GFN_GETBUF, NULL); + return NULL; } if (!page_has_buffers(page)) @@ -509,7 +486,7 @@ unlock_page(page); page_cache_release(page); - RETURN(GFN_GETBUF, bh); + return bh; } /** @@ -523,8 +500,7 @@ struct buffer_head * gfs_dgetblk(struct gfs_glock *gl, uint64_t blkno) { - ENTER(GFN_DGETBLK) - RETURN(GFN_DGETBLK, getbuf(gl->gl_sbd, gl->gl_aspace, blkno, CREATE)); + return getbuf(gl->gl_sbd, gl->gl_aspace, blkno, CREATE); } /** @@ -541,7 +517,6 @@ gfs_dread(struct gfs_glock *gl, uint64_t blkno, int flags, struct buffer_head **bhp) { - ENTER(GFN_DREAD) int error; *bhp = gfs_dgetblk(gl, blkno); @@ -549,7 +524,7 @@ if (error) brelse(*bhp); - RETURN(GFN_DREAD, error); + return error; } /** @@ -561,11 +536,9 @@ void gfs_prep_new_buffer(struct buffer_head *bh) { - ENTER(GFN_PREP_NEW_BUFFER) wait_on_buffer(bh); clear_buffer_dirty(bh); set_buffer_uptodate(bh); - RET(GFN_PREP_NEW_BUFFER); } /** @@ -580,15 +553,13 @@ int gfs_dreread(struct gfs_sbd *sdp, struct buffer_head *bh, int flags) { - ENTER(GFN_DREREAD) - if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) - RETURN(GFN_DREREAD, -EIO); + return -EIO; /* Fill in meta-header if we have a cached copy, else read from disk */ if (flags & DIO_NEW) { if (gfs_mhc_fish(sdp, bh)) - RETURN(GFN_DREREAD, 0); + return 0; clear_buffer_uptodate(bh); } @@ -603,13 +574,13 @@ if (!buffer_uptodate(bh)) { gfs_io_error_bh(sdp, bh); - RETURN(GFN_DREREAD, -EIO); + return -EIO; } if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) - RETURN(GFN_DREREAD, -EIO); + return -EIO; } - RETURN(GFN_DREREAD, 0); + return 0; } /** @@ -624,12 +595,10 @@ int gfs_dwrite(struct gfs_sbd *sdp, struct buffer_head *bh, int flags) { - ENTER(GFN_DWRITE) - if (gfs_assert_warn(sdp, !test_bit(SDF_ROFS, &sdp->sd_flags))) - RETURN(GFN_DWRITE, -EIO); + return -EIO; if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) - RETURN(GFN_DWRITE, -EIO); + return -EIO; if (flags & DIO_CLEAN) { lock_buffer(bh); @@ -639,7 +608,7 @@ if (flags & DIO_DIRTY) { if (gfs_assert_warn(sdp, buffer_uptodate(bh))) - RETURN(GFN_DWRITE, -EIO); + return -EIO; mark_buffer_dirty(bh); } @@ -653,13 +622,13 @@ if (!buffer_uptodate(bh) || buffer_dirty(bh)) { gfs_io_error_bh(sdp, bh); - RETURN(GFN_DWRITE, -EIO); + return -EIO; } if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) - RETURN(GFN_DWRITE, -EIO); + return -EIO; } - RETURN(GFN_DWRITE, 0); + return 0; } /** @@ -672,7 +641,6 @@ void gfs_attach_bufdata(struct buffer_head *bh, struct gfs_glock *gl) { - ENTER(GFN_ATTACH_BUFDATA) struct gfs_bufdata *bd; lock_page(bh->b_page); @@ -680,7 +648,7 @@ /* If there's one attached already, we're done */ if (get_v2bd(bh)) { unlock_page(bh->b_page); - RET(GFN_ATTACH_BUFDATA); + return; } RETRY_MALLOC(bd = kmem_cache_alloc(gfs_bufdata_cachep, GFP_KERNEL), bd); @@ -701,8 +669,6 @@ set_v2bd(bh, bd); unlock_page(bh->b_page); - - RET(GFN_ATTACH_BUFDATA); } /** @@ -716,7 +682,6 @@ int gfs_is_pinned(struct gfs_sbd *sdp, struct buffer_head *bh) { - ENTER(GFN_IS_PINNED) struct gfs_bufdata *bd = get_v2bd(bh); int ret = FALSE; @@ -727,7 +692,7 @@ gfs_unlock_buffer(bh); } - RETURN(GFN_IS_PINNED, ret); + return ret; } /** @@ -750,7 +715,6 @@ void gfs_dpin(struct gfs_sbd *sdp, struct buffer_head *bh) { - ENTER(GFN_DPIN) struct gfs_bufdata *bd = get_v2bd(bh); char *data; @@ -799,8 +763,6 @@ gfs_unlock_buffer(bh); get_bh(bh); - - RET(GFN_DPIN); } /** @@ -832,7 +794,6 @@ void gfs_dunpin(struct gfs_sbd *sdp, struct buffer_head *bh, struct gfs_trans *tr) { - ENTER(GFN_DUNPIN) struct gfs_bufdata *bd = get_v2bd(bh); gfs_assert_withdraw(sdp, buffer_uptodate(bh)); @@ -841,7 +802,7 @@ if (gfs_assert_warn(sdp, bd->bd_pinned)) { gfs_unlock_buffer(bh); - RET(GFN_DUNPIN); + return; } /* No other (later) transaction is modifying buffer; ready to write */ @@ -871,8 +832,6 @@ spin_unlock(&sdp->sd_ail_lock); } else brelse(bh); - - RET(GFN_DUNPIN); } /** @@ -907,8 +866,6 @@ gfs_logbh_init(struct gfs_sbd *sdp, struct buffer_head *bh, uint64_t blkno, char *data) { - ENTER(GFN_LOGBH_INIT) - memset(bh, 0, sizeof(struct buffer_head)); bh->b_state = (1 << BH_Mapped) | (1 << BH_Uptodate) | (1 << BH_Lock); atomic_set(&bh->b_count, 1); @@ -918,8 +875,6 @@ bh->b_bdev = sdp->sd_vfs->s_bdev; init_buffer(bh, logbh_end_io, NULL); INIT_LIST_HEAD(&bh->b_assoc_buffers); - - RET(GFN_LOGBH_INIT); } /** @@ -932,11 +887,9 @@ void gfs_logbh_uninit(struct gfs_sbd *sdp, struct buffer_head *bh) { - ENTER(GFN_LOGBH_UNINIT) gfs_assert_warn(sdp, test_bit(SDF_SHUTDOWN, &sdp->sd_flags) || !buffer_busy(bh)); gfs_assert_warn(sdp, atomic_read(&bh->b_count) == 1); - RET(GFN_LOGBH_UNINIT); } /** @@ -950,9 +903,7 @@ void gfs_logbh_start(struct gfs_sbd *sdp, struct buffer_head *bh) { - ENTER(GFN_LOGBH_START) submit_bh(WRITE, bh); - RET(GFN_LOGBH_START); } /** @@ -968,18 +919,16 @@ int gfs_logbh_wait(struct gfs_sbd *sdp, struct buffer_head *bh) { - ENTER(GFN_LOGBH_WAIT) - wait_on_buffer(bh); if (!buffer_uptodate(bh) || buffer_dirty(bh)) { gfs_io_error_bh(sdp, bh); - RETURN(GFN_LOGBH_WAIT, -EIO); + return -EIO; } if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) - RETURN(GFN_LOGBH_WAIT, -EIO); + return -EIO; - RETURN(GFN_LOGBH_WAIT, 0); + return 0; } /** @@ -993,7 +942,6 @@ int gfs_replay_buf(struct gfs_glock *gl, struct buffer_head *bh) { - ENTER(GFN_REPLAY_BUF) struct gfs_sbd *sdp = gl->gl_sbd; struct gfs_bufdata *bd; @@ -1010,7 +958,7 @@ list_add(&bd->bd_ail_tr_list, &sdp->sd_recovery_bufs); } - RETURN(GFN_REPLAY_BUF, 0); + return 0; } /** @@ -1022,7 +970,6 @@ void gfs_replay_check(struct gfs_sbd *sdp) { - ENTER(GFN_REPLAY_CHECK) struct buffer_head *bh; struct gfs_bufdata *bd; @@ -1042,8 +989,6 @@ brelse(bh); } } - - RET(GFN_REPLAY_CHECK); } /** @@ -1055,7 +1000,6 @@ void gfs_replay_wait(struct gfs_sbd *sdp) { - ENTER(GFN_REPLAY_WAIT) struct list_head *head, *tmp, *prev; struct buffer_head *bh; struct gfs_bufdata *bd; @@ -1093,8 +1037,6 @@ gfs_io_error_bh(sdp, bh); brelse(bh); } - - RET(GFN_REPLAY_WAIT); } /** @@ -1115,7 +1057,6 @@ gfs_wipe_buffers(struct gfs_inode *ip, struct gfs_rgrpd *rgd, uint64_t bstart, uint32_t blen) { - ENTER(GFN_WIPE_BUFFERS) struct gfs_sbd *sdp = ip->i_sbd; struct inode *aspace = ip->i_gl->gl_aspace; struct buffer_head *bh; @@ -1169,8 +1110,6 @@ if (add) gfs_depend_add(rgd, ip->i_num.no_formal_ino); - - RET(GFN_WIPE_BUFFERS); } /** @@ -1185,8 +1124,6 @@ void gfs_sync_meta(struct gfs_sbd *sdp) { - ENTER(GFN_SYNC_META) - gfs_log_flush(sdp); for (;;) { gfs_ail_start(sdp, DIO_ALL); @@ -1195,8 +1132,6 @@ set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(HZ / 10); } - - RET(GFN_SYNC_META); } /** @@ -1211,7 +1146,6 @@ void gfs_flush_meta_cache(struct gfs_inode *ip) { - ENTER(GFN_FLUSH_META_CACHE) struct buffer_head **bh_slot; unsigned int x; @@ -1226,8 +1160,6 @@ } spin_unlock(&ip->i_spin); - - RET(GFN_FLUSH_META_CACHE); } /** @@ -1245,7 +1177,6 @@ gfs_get_meta_buffer(struct gfs_inode *ip, int height, uint64_t num, int new, struct buffer_head **bhp) { - ENTER(GFN_GET_META_BUFFER) struct buffer_head *bh, **bh_slot = &ip->i_cache[height]; int flags = ((new) ? DIO_NEW : 0) | DIO_START | DIO_WAIT; int error; @@ -1265,12 +1196,12 @@ error = gfs_dreread(ip->i_sbd, bh, flags); if (error) { brelse(bh); - RETURN(GFN_GET_META_BUFFER, error); + return error; } } else { error = gfs_dread(ip->i_gl, num, flags, &bh); if (error) - RETURN(GFN_GET_META_BUFFER, error); + return error; spin_lock(&ip->i_spin); if (*bh_slot != bh) { @@ -1285,7 +1216,7 @@ if (new) { if (gfs_assert_warn(ip->i_sbd, height)) { brelse(bh); - RETURN(GFN_GET_META_BUFFER, -EIO); + return -EIO; } gfs_trans_add_bh(ip->i_gl, bh); gfs_metatype_set(bh, GFS_METATYPE_IN, GFS_FORMAT_IN); @@ -1293,12 +1224,12 @@ } else if (gfs_metatype_check(ip->i_sbd, bh, (height) ? GFS_METATYPE_IN : GFS_METATYPE_DI)) { brelse(bh); - RETURN(GFN_GET_META_BUFFER, -EIO); + return -EIO; } *bhp = bh; - RETURN(GFN_GET_META_BUFFER, 0); + return 0; } /** @@ -1315,26 +1246,25 @@ gfs_get_data_buffer(struct gfs_inode *ip, uint64_t block, int new, struct buffer_head **bhp) { - ENTER(GFN_GET_DATA_BUFFER) struct buffer_head *bh; int error = 0; if (block == ip->i_num.no_addr) { if (gfs_assert_warn(ip->i_sbd, !new)) - RETURN(GFN_GET_DATA_BUFFER, -EIO); + return -EIO; error = gfs_dread(ip->i_gl, block, DIO_START | DIO_WAIT, &bh); if (error) - RETURN(GFN_GET_DATA_BUFFER, error); + return error; if (gfs_metatype_check(ip->i_sbd, bh, GFS_METATYPE_DI)) { brelse(bh); - RETURN(GFN_GET_DATA_BUFFER, -EIO); + return -EIO; } } else if (gfs_is_jdata(ip)) { if (new) { error = gfs_dread(ip->i_gl, block, DIO_NEW | DIO_START | DIO_WAIT, &bh); if (error) - RETURN(GFN_GET_DATA_BUFFER, error); + return error; gfs_trans_add_bh(ip->i_gl, bh); gfs_metatype_set(bh, GFS_METATYPE_JD, GFS_FORMAT_JD); gfs_buffer_clear_tail(bh, sizeof(struct gfs_meta_header)); @@ -1342,10 +1272,10 @@ error = gfs_dread(ip->i_gl, block, DIO_START | DIO_WAIT, &bh); if (error) - RETURN(GFN_GET_DATA_BUFFER, error); + return error; if (gfs_metatype_check(ip->i_sbd, bh, GFS_METATYPE_JD)) { brelse(bh); - RETURN(GFN_GET_DATA_BUFFER, -EIO); + return -EIO; } } } else { @@ -1356,13 +1286,13 @@ error = gfs_dread(ip->i_gl, block, DIO_START | DIO_WAIT, &bh); if (error) - RETURN(GFN_GET_DATA_BUFFER, error); + return error; } } *bhp = bh; - RETURN(GFN_GET_DATA_BUFFER, 0); + return 0; } /** @@ -1376,15 +1306,16 @@ void gfs_start_ra(struct gfs_glock *gl, uint64_t dblock, uint32_t extlen) { - ENTER(GFN_START_RA) struct gfs_sbd *sdp = gl->gl_sbd; struct inode *aspace = gl->gl_aspace; struct buffer_head *first_bh, *bh; uint32_t max_ra = gfs_tune_get(sdp, gt_max_readahead) >> sdp->sd_sb.sb_bsize_shift; int error; - if (!extlen || !max_ra) - RET(GFN_START_RA); + if (!extlen) + return; + if (!max_ra) + return; if (extlen > max_ra) extlen = max_ra; @@ -1421,6 +1352,4 @@ out: brelse(first_bh); - - RET(GFN_START_RA); } --- cluster/gfs-kernel/src/gfs/dio.h 2006/01/09 22:25:06 1.4 +++ cluster/gfs-kernel/src/gfs/dio.h 2006/07/10 23:22:34 1.5 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/dir.c 2006/02/20 04:31:33 1.12 +++ cluster/gfs-kernel/src/gfs/dir.c 2006/07/10 23:22:34 1.13 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -64,6 +64,7 @@ #include #include #include +#include #include "gfs.h" #include "dio.h" @@ -75,9 +76,6 @@ #include "rgrp.h" #include "trans.h" -#define IS_LEAF (1) /* Hashed (leaf) directory */ -#define IS_DINODE (2) /* Linear (stuffed dinode block) directory */ - #if 1 #define gfs_dir_hash2offset(h) (((uint64_t)(h)) >> 1) #define gfs_dir_offset2hash(p) ((uint32_t)(((uint64_t)(p)) << 1)) @@ -104,12 +102,11 @@ int gfs_filecmp(struct qstr *file1, char *file2, int len_of_file2) { - ENTER(GFN_FILECMP) if (file1->len != len_of_file2) - RETURN(GFN_FILECMP, FALSE); + return FALSE; if (memcmp(file1->name, file2, file1->len)) - RETURN(GFN_FILECMP, FALSE); - RETURN(GFN_FILECMP, TRUE); + return FALSE; + return TRUE; } /** @@ -127,19 +124,18 @@ dirent_first(struct gfs_inode *dip, struct buffer_head *bh, struct gfs_dirent **dent) { - ENTER(GFN_DIRENT_FIRST) struct gfs_meta_header *h = (struct gfs_meta_header *)bh->b_data; if (gfs32_to_cpu(h->mh_type) == GFS_METATYPE_LF) { if (gfs_meta_check(dip->i_sbd, bh)) - RETURN(GFN_DIRENT_FIRST, -EIO); + return -EIO; *dent = (struct gfs_dirent *)(bh->b_data + sizeof(struct gfs_leaf)); - RETURN(GFN_DIRENT_FIRST, IS_LEAF); + return IS_LEAF; } else { if (gfs_metatype_check(dip->i_sbd, bh, GFS_METATYPE_DI)) - RETURN(GFN_DIRENT_FIRST, -EIO); + return -EIO; *dent = (struct gfs_dirent *)(bh->b_data + sizeof(struct gfs_dinode)); - RETURN(GFN_DIRENT_FIRST, IS_DINODE); + return IS_DINODE; } } @@ -156,7 +152,6 @@ dirent_next(struct gfs_inode *dip, struct buffer_head *bh, struct gfs_dirent **dent) { - ENTER(GFN_DIRENT_NEXT) struct gfs_dirent *tmp, *cur; char *bh_end; uint32_t cur_rec_len; @@ -168,26 +163,26 @@ if ((char *)cur + cur_rec_len >= bh_end) { if ((char *)cur + cur_rec_len > bh_end) { gfs_consist_inode(dip); - RETURN(GFN_DIRENT_NEXT, -EIO); + return -EIO; } - RETURN(GFN_DIRENT_NEXT, -ENOENT); + return -ENOENT; } tmp = (struct gfs_dirent *)((char *)cur + cur_rec_len); if ((char *)tmp + gfs16_to_cpu(tmp->de_rec_len) > bh_end) { gfs_consist_inode(dip); - RETURN(GFN_DIRENT_NEXT, -EIO); + return -EIO; } /* Only the first dent could ever have de_ino == 0 */ if (!tmp->de_inum.no_formal_ino) { gfs_consist_inode(dip); - RETURN(GFN_DIRENT_NEXT, -EIO); + return -EIO; } *dent = tmp; - RETURN(GFN_DIRENT_NEXT, 0); + return 0; } /** @@ -203,12 +198,11 @@ dirent_del(struct gfs_inode *dip, struct buffer_head *bh, struct gfs_dirent *prev, struct gfs_dirent *cur) { - ENTER(GFN_DIRENT_DEL) uint32_t cur_rec_len, prev_rec_len; if (!cur->de_inum.no_formal_ino) { gfs_consist_inode(dip); - RET(GFN_DIRENT_DEL); + return; } gfs_trans_add_bh(dip->i_gl, bh); @@ -219,7 +213,7 @@ if (!prev) { cur->de_inum.no_formal_ino = 0; /* No endianess worries */ - RET(GFN_DIRENT_DEL); + return; } /* Combine this dentry with the previous one. */ @@ -234,8 +228,6 @@ prev_rec_len += cur_rec_len; prev->de_rec_len = cpu_to_gfs16(prev_rec_len); - - RET(GFN_DIRENT_DEL); } /** @@ -252,7 +244,6 @@ gfs_dirent_alloc(struct gfs_inode *dip, struct buffer_head *bh, int name_len, struct gfs_dirent **dent_out) { - ENTER(GFN_DIRENT_ALLOC) struct gfs_dirent *dent, *new; unsigned int rec_len = GFS_DIRENT_SIZE(name_len); unsigned int entries = 0, offset = 0; @@ -260,7 +251,7 @@ type = dirent_first(dip, bh, &dent); if (type < 0) - RETURN(GFN_DIRENT_ALLOC, type); + return type; if (type == IS_LEAF) { struct gfs_leaf *leaf = (struct gfs_leaf *)bh->b_data; @@ -275,7 +266,7 @@ if (!entries) { if (dent->de_inum.no_formal_ino) { gfs_consist_inode(dip); - RETURN(GFN_DIRENT_ALLOC, -EIO); + return -EIO; } gfs_trans_add_bh(dip->i_gl, bh); @@ -285,7 +276,7 @@ dent->de_name_len = cpu_to_gfs16(name_len); *dent_out = dent; - RETURN(GFN_DIRENT_ALLOC, 0); + return 0; } do { @@ -311,17 +302,17 @@ dent->de_rec_len = cpu_to_gfs16(dent->de_rec_len); *dent_out = new; - RETURN(GFN_DIRENT_ALLOC, 0); + return 0; } dent->de_name_len = cpu_to_gfs16(name_len); *dent_out = dent; - RETURN(GFN_DIRENT_ALLOC, 0); + return 0; } } while (dirent_next(dip, bh, &dent) == 0); - RETURN(GFN_DIRENT_ALLOC, -ENOSPC); + return -ENOSPC; } /** @@ -336,7 +327,6 @@ static int dirent_fits(struct gfs_inode *dip, struct buffer_head *bh, int name_len) { - ENTER(GFN_DIRENT_FITS) struct gfs_dirent *dent; unsigned int rec_len = GFS_DIRENT_SIZE(name_len); unsigned int entries = 0; @@ -344,7 +334,7 @@ type = dirent_first(dip, bh, &dent); if (type < 0) - RETURN(GFN_DIRENT_FITS, type); + return type; if (type == IS_LEAF) { struct gfs_leaf *leaf = (struct gfs_leaf *)bh->b_data; @@ -355,7 +345,7 @@ } if (!entries) - RETURN(GFN_DIRENT_FITS, TRUE); + return TRUE; do { uint32_t cur_rec_len, cur_name_len; @@ -365,10 +355,10 @@ if ((!dent->de_inum.no_formal_ino && cur_rec_len >= rec_len) || (cur_rec_len >= GFS_DIRENT_SIZE(cur_name_len) + rec_len)) - RETURN(GFN_DIRENT_FITS, TRUE); + return TRUE; } while (dirent_next(dip, bh, &dent) == 0); - RETURN(GFN_DIRENT_FITS, FALSE); + return FALSE; } /** @@ -386,7 +376,6 @@ struct buffer_head *bh, struct qstr *filename, struct gfs_dirent **dent_out, struct gfs_dirent **dent_prev) { - ENTER(GFN_LEAF_SEARCH) uint32_t hash; struct gfs_dirent *dent, *prev = NULL; unsigned int entries = 0; @@ -394,7 +383,7 @@ type = dirent_first(dip, bh, &dent); if (type < 0) - RETURN(GFN_LEAF_SEARCH, type); + return type; if (type == IS_LEAF) { struct gfs_leaf *leaf = (struct gfs_leaf *)bh->b_data; @@ -419,13 +408,13 @@ if (dent_prev) *dent_prev = prev; - RETURN(GFN_LEAF_SEARCH, 0); + return 0; } prev = dent; } while (dirent_next(dip, bh, &dent) == 0); - RETURN(GFN_LEAF_SEARCH, -ENOENT); + return -ENOENT; } /** @@ -440,14 +429,13 @@ static int get_leaf(struct gfs_inode *dip, uint64_t leaf_no, struct buffer_head **bhp) { - ENTER(GFN_GET_LEAF) int error; error = gfs_dread(dip->i_gl, leaf_no, DIO_START | DIO_WAIT, bhp); if (!error && gfs_metatype_check(dip->i_sbd, *bhp, GFS_METATYPE_LF)) error = -EIO; - RETURN(GFN_GET_LEAF, error); + return error; } /** @@ -462,7 +450,6 @@ static int get_leaf_nr(struct gfs_inode *dip, uint32_t index, uint64_t *leaf_out) { - ENTER(GFN_LEAF_NR) uint64_t leaf_no; int error; @@ -470,11 +457,11 @@ index * sizeof(uint64_t), sizeof(uint64_t)); if (error != sizeof(uint64_t)) - RETURN(GFN_LEAF_NR, (error < 0) ? error : -EIO); + return (error < 0) ? error : -EIO; *leaf_out = gfs64_to_cpu(leaf_no); - RETURN(GFN_LEAF_NR, 0); + return 0; } /** @@ -490,7 +477,6 @@ get_first_leaf(struct gfs_inode *dip, uint32_t index, struct buffer_head **bh_out) { - ENTER(GFN_GET_FIRST_LEAF) uint64_t leaf_no; int error; @@ -498,7 +484,7 @@ if (!error) error = get_leaf(dip, leaf_no, bh_out); - RETURN(GFN_GET_FIRST_LEAF, error); + return error; } /** @@ -514,7 +500,6 @@ get_next_leaf(struct gfs_inode *dip, struct buffer_head *bh_in, struct buffer_head **bh_out) { - ENTER(GFN_GET_NEXT_LEAF) struct gfs_leaf *leaf; int error; @@ -525,7 +510,7 @@ else error = get_leaf(dip, gfs64_to_cpu(leaf->lf_next), bh_out); - RETURN(GFN_GET_NEXT_LEAF, error); + return error; } /** @@ -544,7 +529,6 @@ struct gfs_dirent **dent_out, struct gfs_dirent **dent_prev, struct buffer_head **bh_out) { - ENTER(GFN_LINKED_LEAF_SEARCH) struct buffer_head *bh = NULL, *bh_next; uint32_t hsize, index; uint32_t hash; @@ -553,7 +537,7 @@ hsize = 1 << dip->i_di.di_depth; if (hsize * sizeof(uint64_t) != dip->i_di.di_size) { gfs_consist_inode(dip); - RETURN(GFN_LINKED_LEAF_SEARCH, -EIO); + return -EIO; } /* Figure out the address of the leaf node. */ @@ -563,7 +547,7 @@ error = get_first_leaf(dip, index, &bh_next); if (error) - RETURN(GFN_LINKED_LEAF_SEARCH, error); + return error; /* Find the entry */ @@ -577,14 +561,14 @@ switch (error) { case 0: *bh_out = bh; - RETURN(GFN_LINKED_LEAF_SEARCH, 0); + return 0; case -ENOENT: break; default: brelse(bh); - RETURN(GFN_LINKED_LEAF_SEARCH, error); + return error; } error = get_next_leaf(dip, bh, &bh_next); @@ -593,7 +577,7 @@ brelse(bh); - RETURN(GFN_LINKED_LEAF_SEARCH, error); + return error; } /** @@ -606,7 +590,6 @@ static int dir_make_exhash(struct gfs_inode *dip) { - ENTER(GFN_DIR_MAKE_EXHASH) struct gfs_sbd *sdp = dip->i_sbd; struct gfs_dirent *dent; struct buffer_head *bh, *dibh; @@ -618,7 +601,7 @@ error = gfs_get_inode_buffer(dip, &dibh); if (error) - RETURN(GFN_DIR_MAKE_EXHASH, error); + return error; /* Allocate a new block for the first leaf node */ @@ -696,11 +679,11 @@ brelse(dibh); - RETURN(GFN_DIR_MAKE_EXHASH, 0); + return 0; fail: brelse(dibh); - RETURN(GFN_DIR_MAKE_EXHASH, error); + return error; } /** @@ -715,7 +698,6 @@ static int dir_split_leaf(struct gfs_inode *dip, uint32_t index, uint64_t leaf_no) { - ENTER(GFN_DIR_SPLIT_LEAF) struct buffer_head *nbh, *obh, *dibh; struct gfs_leaf *nleaf, *oleaf; struct gfs_dirent *dent, *prev = NULL, *next = NULL, *new; @@ -729,14 +711,14 @@ error = gfs_metaalloc(dip, &bn); if (error) - RETURN(GFN_DIR_SPLIT_LEAF, error); + return error; /* Get the new leaf block */ error = gfs_dread(dip->i_gl, bn, DIO_NEW | DIO_START | DIO_WAIT, &nbh); if (error) - RETURN(GFN_DIR_SPLIT_LEAF, error); + return error; gfs_trans_add_bh(dip->i_gl, nbh); gfs_metatype_set(nbh, GFS_METATYPE_LF, GFS_FORMAT_LF); @@ -877,7 +859,7 @@ brelse(obh); brelse(nbh); - RETURN(GFN_DIR_SPLIT_LEAF, error); + return error; fail_lpfree: if (unlikely(lp_vfree)) @@ -890,7 +872,7 @@ fail: brelse(nbh); - RETURN(GFN_DIR_SPLIT_LEAF, error); + return error; } /** @@ -903,7 +885,6 @@ static int dir_double_exhash(struct gfs_inode *dip) { - ENTER(GFN_DIR_DOUBLE_EXHASH) struct gfs_sbd *sdp = dip->i_sbd; struct buffer_head *dibh; uint32_t hsize; @@ -916,7 +897,7 @@ hsize = 1 << dip->i_di.di_depth; if (hsize * sizeof(uint64_t) != dip->i_di.di_size) { gfs_consist_inode(dip); - RETURN(GFN_DIR_DOUBLE_EXHASH, -EIO); + return -EIO; } /* Allocate both the "from" and "to" buffers in one big chunk */ @@ -960,12 +941,12 @@ brelse(dibh); } - RETURN(GFN_DIR_DOUBLE_EXHASH, error); + return error; fail: kfree(buf); - RETURN(GFN_DIR_DOUBLE_EXHASH, error); + return error; } /** @@ -982,7 +963,6 @@ static int compare_dents(const void *a, const void *b) { - ENTER(GFN_COMPARE_DENTS) struct gfs_dirent *dent_a, *dent_b; uint32_t hash_a, hash_b; int ret = 0; @@ -1013,7 +993,7 @@ len_a); } - RETURN(GFN_COMPARE_DENTS, ret); + return ret; } /** @@ -1039,7 +1019,6 @@ void *opaque, gfs_filldir_t filldir, struct gfs_dirent **darr, uint32_t entries, int *copied) { - ENTER(GFN_DO_FILLDIR_MAIN) struct gfs_dirent *dent, *dent_next; struct gfs_inum inum; uint64_t off, off_next; @@ -1068,7 +1047,7 @@ if (off_next == off) { if (*copied && !run) - RETURN(GFN_DO_FILLDIR_MAIN, 1); + return 1; run = TRUE; } else run = FALSE; @@ -1085,7 +1064,7 @@ off, &inum, gfs16_to_cpu(dent->de_type)); if (error) - RETURN(GFN_DO_FILLDIR_MAIN, 1); + return 1; *copied = TRUE; } @@ -1095,7 +1074,7 @@ (*offset)++; - RETURN(GFN_DO_FILLDIR_MAIN, 0); + return 0; } /** @@ -1116,24 +1095,23 @@ void *opaque, gfs_filldir_t filldir, struct buffer_head *bh, uint32_t entries, int *copied) { - ENTER(GFN_DO_FILLDIR_SINGLE) struct gfs_dirent **darr; struct gfs_dirent *de; unsigned int e = 0; int error, do_vfree=0; if (!entries) - RETURN(GFN_DO_FILLDIR_SINGLE, 0); + return 0; darr = kmalloc(entries * sizeof(struct gfs_dirent *), GFP_KERNEL); if (unlikely(!darr)) { darr = vmalloc(entries * sizeof (struct gfs_dirent *)); if (!darr) { printk("GFS: do_filldir_single vmalloc fails, entries=%d\n", entries); - RETURN(GFN_DO_FILLDIR_SINGLE, -ENOMEM); - } else { - do_vfree = 1; + return -ENOMEM; } + else + do_vfree = 1; } dirent_first(dip, bh, &de); @@ -1164,7 +1142,7 @@ else kfree(darr); - RETURN(GFN_DO_FILLDIR_SINGLE, error); + return error; } /** @@ -1184,7 +1162,6 @@ void *opaque, gfs_filldir_t filldir, struct buffer_head *bh, int *copied) { - ENTER(GFN_DO_FILLDIR_MULTI) struct buffer_head **larr = NULL; struct gfs_dirent **darr; struct gfs_leaf *leaf; @@ -1207,7 +1184,7 @@ error = get_leaf(dip, ln, &tmp_bh); if (error) - RETURN(GFN_DO_FILLDIR_MULTI, error); + return error; leaf = (struct gfs_leaf *)tmp_bh->b_data; if (leaf->lf_entries) { @@ -1222,7 +1199,7 @@ /* Bail out if there's nothing to do */ if (!entries) - RETURN(GFN_DO_FILLDIR_MULTI, 0); + return 0; /* Alloc arrays */ @@ -1232,7 +1209,7 @@ larr = vmalloc(leaves * sizeof (struct buffer_head *)); if (!larr) { printk("GFS: do_filldir_multi vmalloc fails leaves=%d\n", leaves); - RETURN(GFN_DO_FILLDIR_MULTI, -ENOMEM); + return -ENOMEM; } else leaves_vfree = 1; } @@ -1244,14 +1221,19 @@ if (!darr) { printk("GFS: do_filldir_multi vmalloc fails entries=%d\n", entries); if (larr) { - if (leaves_vfree) + if (leaves_vfree) vfree(larr); - else + else kfree(larr); - } - RETURN(GFN_DO_FILLDIR_MULTI, -ENOMEM); - } else - entries_vfree = 1; + } + return -ENOMEM; + } else + entries_vfree = 1; + } + if (!darr) { + if (larr) + kfree(larr); + return -ENOMEM; } /* Fill in arrays */ @@ -1337,7 +1319,7 @@ kfree(larr); } - RETURN(GFN_DO_FILLDIR_MULTI, error); + return error; } /** @@ -1354,14 +1336,13 @@ dir_e_search(struct gfs_inode *dip, struct qstr *filename, struct gfs_inum *inum, unsigned int *type) { - ENTER(GFN_DIR_E_SEARCH) struct buffer_head *bh; struct gfs_dirent *dent; int error; error = linked_leaf_search(dip, filename, &dent, NULL, &bh); if (error) - RETURN(GFN_DIR_E_SEARCH, error); + return error; if (inum) gfs_inum_in(inum, (char *)&dent->de_inum); @@ -1370,7 +1351,7 @@ brelse(bh); - RETURN(GFN_DIR_E_SEARCH, 0); + return 0; } /** @@ -1386,7 +1367,6 @@ dir_e_add(struct gfs_inode *dip, struct qstr *filename, struct gfs_inum *inum, unsigned int type) { - ENTER(GFN_DIR_E_ADD) struct buffer_head *bh, *nbh, *dibh; struct gfs_leaf *leaf, *nleaf; struct gfs_dirent *dent; @@ -1399,7 +1379,7 @@ hsize = 1 << dip->i_di.di_depth; if (hsize * sizeof(uint64_t) != dip->i_di.di_size) { gfs_consist_inode(dip); - RETURN(GFN_DIR_E_ADD, -EIO); + return -EIO; } /* Figure out the address of the leaf node. */ @@ -1409,14 +1389,14 @@ error = get_leaf_nr(dip, index, &leaf_no); if (error) - RETURN(GFN_DIR_E_ADD, error); + return error; /* Add entry to the leaf */ for (;;) { error = get_leaf(dip, leaf_no, &bh); if (error) - RETURN(GFN_DIR_E_ADD, error); + return error; leaf = (struct gfs_leaf *)bh->b_data; @@ -1429,7 +1409,7 @@ error = dir_split_leaf(dip, index, leaf_no); if (error) - RETURN(GFN_DIR_E_ADD, error); + return error; goto restart; @@ -1440,7 +1420,7 @@ error = dir_double_exhash(dip); if (error) - RETURN(GFN_DIR_E_ADD, error); + return error; goto restart; @@ -1456,7 +1436,7 @@ error = gfs_metaalloc(dip, &bn); if (error) { brelse(bh); - RETURN(GFN_DIR_E_ADD, error); + return error; } error = gfs_dread(dip->i_gl, bn, @@ -1464,7 +1444,7 @@ &nbh); if (error) { brelse(bh); - RETURN(GFN_DIR_E_ADD, error); + return error; } gfs_trans_add_bh(dip->i_gl, nbh); @@ -1506,7 +1486,7 @@ error = gfs_get_inode_buffer(dip, &dibh); if (error) - RETURN(GFN_DIR_E_ADD, error); + return error; dip->i_di.di_entries++; dip->i_di.di_mtime = dip->i_di.di_ctime = get_seconds(); @@ -1515,10 +1495,10 @@ gfs_dinode_out(&dip->i_di, dibh->b_data); brelse(dibh); - RETURN(GFN_DIR_E_ADD, 0); + return 0; } - RETURN(GFN_DIR_E_ADD, -ENOENT); + return -ENOENT; } /** @@ -1532,7 +1512,6 @@ static int dir_e_del(struct gfs_inode *dip, struct qstr *filename) { - ENTER(GFN_DIR_E_DEL) struct buffer_head *bh, *dibh; struct gfs_dirent *dent, *prev; struct gfs_leaf *leaf; @@ -1542,10 +1521,10 @@ error = linked_leaf_search(dip, filename, &dent, &prev, &bh); if (error == -ENOENT) { gfs_consist_inode(dip); - RETURN(GFN_DIR_E_DEL, -EIO); + return -EIO; } if (error) - RETURN(GFN_DIR_E_DEL, error); + return error; dirent_del(dip, bh, prev, dent); /* Pins bh */ @@ -1560,7 +1539,7 @@ error = gfs_get_inode_buffer(dip, &dibh); if (error) - RETURN(GFN_DIR_E_DEL, error); + return error; if (!dip->i_di.di_entries) gfs_consist_inode(dip); @@ -1571,7 +1550,7 @@ gfs_dinode_out(&dip->i_di, dibh->b_data); brelse(dibh); - RETURN(GFN_DIR_E_DEL, 0); + return 0; } /** @@ -1588,7 +1567,6 @@ dir_e_read(struct gfs_inode *dip, uint64_t *offset, void *opaque, gfs_filldir_t filldir) { - ENTER(GFN_DIR_E_READ) struct gfs_sbd *sdp = dip->i_sbd; struct buffer_head *bh; struct gfs_leaf leaf; @@ -1602,7 +1580,7 @@ hsize = 1 << dip->i_di.di_depth; if (hsize * sizeof(uint64_t) != dip->i_di.di_size) { gfs_consist_inode(dip); - RETURN(GFN_DIR_E_READ, -EIO); + return -EIO; } hash = gfs_dir_offset2hash(*offset); @@ -1610,7 +1588,7 @@ lp = kmalloc(sdp->sd_hash_bsize, GFP_KERNEL); if (!lp) - RETURN(GFN_DIR_E_READ, -ENOMEM); + return -ENOMEM; while (index < hsize) { lp_offset = index & (sdp->sd_hash_ptrs - 1); @@ -1659,7 +1637,7 @@ out: kfree(lp); - RETURN(GFN_DIR_E_READ, error); + return error; } /** @@ -1675,7 +1653,6 @@ dir_e_mvino(struct gfs_inode *dip, struct qstr *filename, struct gfs_inum *inum, unsigned int new_type) { - ENTER(GFN_DIR_E_MVINO) struct buffer_head *bh, *dibh; struct gfs_dirent *dent; int error; @@ -1683,10 +1660,10 @@ error = linked_leaf_search(dip, filename, &dent, NULL, &bh); if (error == -ENOENT) { gfs_consist_inode(dip); - RETURN(GFN_DIR_E_MVINO, -EIO); + return -EIO; } if (error) - RETURN(GFN_DIR_E_MVINO, error); + return error; gfs_trans_add_bh(dip->i_gl, bh); @@ -1697,7 +1674,7 @@ error = gfs_get_inode_buffer(dip, &dibh); if (error) - RETURN(GFN_DIR_E_MVINO, error); + return error; dip->i_di.di_mtime = dip->i_di.di_ctime = get_seconds(); @@ -1705,7 +1682,7 @@ gfs_dinode_out(&dip->i_di, dibh->b_data); brelse(dibh); - RETURN(GFN_DIR_E_MVINO, 0); + return 0; } /** @@ -1722,19 +1699,18 @@ dir_l_search(struct gfs_inode *dip, struct qstr *filename, struct gfs_inum *inum, unsigned int *type) { - ENTER(GFN_DIR_L_SEARCH) struct buffer_head *dibh; struct gfs_dirent *dent; int error; if (!gfs_is_stuffed(dip)) { gfs_consist_inode(dip); - RETURN(GFN_DIR_L_SEARCH, -EIO); + return -EIO; } error = gfs_get_inode_buffer(dip, &dibh); if (error) - RETURN(GFN_DIR_L_SEARCH, error); + return error; error = leaf_search(dip, dibh, filename, &dent, NULL); if (!error) { @@ -1746,7 +1722,7 @@ brelse(dibh); - RETURN(GFN_DIR_L_SEARCH, error); + return error; } /** @@ -1763,19 +1739,18 @@ dir_l_add(struct gfs_inode *dip, struct qstr *filename, struct gfs_inum *inum, unsigned int type) { - ENTER(GFN_DIR_L_ADD) struct buffer_head *dibh; struct gfs_dirent *dent; int error; if (!gfs_is_stuffed(dip)) { gfs_consist_inode(dip); - RETURN(GFN_DIR_L_ADD, -EIO); + return -EIO; } error = gfs_get_inode_buffer(dip, &dibh); if (error) - RETURN(GFN_DIR_L_ADD, error); + return error; if (gfs_dirent_alloc(dip, dibh, filename->len, &dent)) { brelse(dibh); @@ -1784,7 +1759,7 @@ if (!error) error = dir_e_add(dip, filename, inum, type); - RETURN(GFN_DIR_L_ADD, error); + return error; } /* gfs_dirent_alloc() pins */ @@ -1801,7 +1776,7 @@ gfs_dinode_out(&dip->i_di, dibh->b_data); brelse(dibh); - RETURN(GFN_DIR_L_ADD, 0); + return 0; } /** @@ -1815,19 +1790,18 @@ static int dir_l_del(struct gfs_inode *dip, struct qstr *filename) { - ENTER(GFN_DIR_L_DEL) struct buffer_head *dibh; struct gfs_dirent *dent, *prev; int error; if (!gfs_is_stuffed(dip)) { gfs_consist_inode(dip); - RETURN(GFN_DIR_L_DEL, -EIO); + return -EIO; } error = gfs_get_inode_buffer(dip, &dibh); if (error) - RETURN(GFN_DIR_L_DEL, error); + return error; error = leaf_search(dip, dibh, filename, &dent, &prev); if (error == -ENOENT) { @@ -1853,7 +1827,7 @@ out: brelse(dibh); - RETURN(GFN_DIR_L_DEL, error); + return error; } /** @@ -1870,22 +1844,21 @@ dir_l_read(struct gfs_inode *dip, uint64_t *offset, void *opaque, gfs_filldir_t filldir) { - ENTER(GFN_DIR_L_READ) struct buffer_head *dibh; int copied = FALSE; int error; if (!gfs_is_stuffed(dip)) { gfs_consist_inode(dip); - RETURN(GFN_DIR_L_READ, -EIO); + return -EIO; } if (!dip->i_di.di_entries) - RETURN(GFN_DIR_L_READ, 0); + return 0; error = gfs_get_inode_buffer(dip, &dibh); if (error) - RETURN(GFN_DIR_L_READ, error); + return error; error = do_filldir_single(dip, offset, opaque, filldir, @@ -1896,7 +1869,7 @@ brelse(dibh); - RETURN(GFN_DIR_L_READ, error); + return error; } /** @@ -1912,19 +1885,18 @@ dir_l_mvino(struct gfs_inode *dip, struct qstr *filename, struct gfs_inum *inum, unsigned int new_type) { - ENTER(GFN_DIR_L_MVINO) struct buffer_head *dibh; struct gfs_dirent *dent; int error; if (!gfs_is_stuffed(dip)) { gfs_consist_inode(dip); - RETURN(GFN_DIR_L_MVINO, -EIO); + return -EIO; } error = gfs_get_inode_buffer(dip, &dibh); if (error) - RETURN(GFN_DIR_L_MVINO, error); + return error; error = leaf_search(dip, dibh, filename, &dent, NULL); if (error == -ENOENT) { @@ -1947,7 +1919,7 @@ out: brelse(dibh); - RETURN(GFN_DIR_L_MVINO, error); + return error; } /** @@ -1966,7 +1938,6 @@ gfs_dir_search(struct gfs_inode *dip, struct qstr *filename, struct gfs_inum *inum, unsigned int *type) { - ENTER(GFN_DIR_SEARCH) int error; if (dip->i_di.di_flags & GFS_DIF_EXHASH) @@ -1974,7 +1945,7 @@ else error = dir_l_search(dip, filename, inum, type); - RETURN(GFN_DIR_SEARCH, error); + return error; } /** @@ -1991,7 +1962,6 @@ gfs_dir_add(struct gfs_inode *dip, struct qstr *filename, struct gfs_inum *inum, unsigned int type) { - ENTER(GFN_DIR_ADD) int error; if (dip->i_di.di_flags & GFS_DIF_EXHASH) @@ -1999,7 +1969,7 @@ else error = dir_l_add(dip, filename, inum, type); - RETURN(GFN_DIR_ADD, error); + return error; } /** @@ -2013,7 +1983,6 @@ int gfs_dir_del(struct gfs_inode *dip, struct qstr *filename) { - ENTER(GFN_DIR_DEL) int error; if (dip->i_di.di_flags & GFS_DIF_EXHASH) @@ -2021,7 +1990,7 @@ else error = dir_l_del(dip, filename); - RETURN(GFN_DIR_DEL, error); + return error; } /** @@ -2038,7 +2007,6 @@ gfs_dir_read(struct gfs_inode *dip, uint64_t * offset, void *opaque, gfs_filldir_t filldir) { - ENTER(GFN_DIR_READ) int error; if (dip->i_di.di_flags & GFS_DIF_EXHASH) @@ -2046,7 +2014,7 @@ else error = dir_l_read(dip, offset, opaque, filldir); - RETURN(GFN_DIR_READ, error); + return error; } /** @@ -2066,7 +2034,6 @@ gfs_dir_mvino(struct gfs_inode *dip, struct qstr *filename, struct gfs_inum *inum, unsigned int new_type) { - ENTER(GFN_DIR_MVINO) int error; if (dip->i_di.di_flags & GFS_DIF_EXHASH) @@ -2074,7 +2041,7 @@ else error = dir_l_mvino(dip, filename, inum, new_type); - RETURN(GFN_DIR_MVINO, error); + return error; } /** @@ -2089,7 +2056,6 @@ static int foreach_leaf(struct gfs_inode *dip, leaf_call_t lc, void *data) { - ENTER(GFN_FOREACH_LEAF) struct gfs_sbd *sdp = dip->i_sbd; struct buffer_head *bh; struct gfs_leaf leaf; @@ -2103,12 +2069,12 @@ hsize = 1 << dip->i_di.di_depth; if (hsize * sizeof(uint64_t) != dip->i_di.di_size) { gfs_consist_inode(dip); - RETURN(GFN_FOREACH_LEAF, -EIO); + return -EIO; } lp = kmalloc(sdp->sd_hash_bsize, GFP_KERNEL); if (!lp) - RETURN(GFN_FOREACH_LEAF, -ENOMEM); + return -ENOMEM; while (index < hsize) { lp_offset = index & (sdp->sd_hash_ptrs - 1); @@ -2153,7 +2119,7 @@ out: kfree(lp); - RETURN(GFN_FOREACH_LEAF, error); + return error; } /** @@ -2172,7 +2138,6 @@ uint32_t index, uint32_t len, uint64_t leaf_no, void *data) { - ENTER(GFN_LEAF_FREE) struct gfs_sbd *sdp = dip->i_sbd; struct gfs_leaf tmp_leaf; struct gfs_rgrp_list rlist; @@ -2277,7 +2242,7 @@ out: gfs_alloc_put(dip); - RETURN(GFN_LEAF_FREE, error); + return error; } /** @@ -2293,7 +2258,6 @@ int gfs_dir_exhash_free(struct gfs_inode *dip) { - ENTER(GFN_DIR_EXHASH_FREE) struct gfs_sbd *sdp = dip->i_sbd; struct buffer_head *bh; int error; @@ -2301,14 +2265,14 @@ /* Dealloc on-disk leaves to FREEMETA state */ error = foreach_leaf(dip, leaf_free, NULL); if (error) - RETURN(GFN_DIR_EXHASH_FREE, error); + return error; /* Make this a regular file in case we crash. (We don't want to free these blocks a second time.) */ error = gfs_trans_begin(sdp, 1, 0); if (error) - RETURN(GFN_DIR_EXHASH_FREE, error); + return error; error = gfs_get_inode_buffer(dip, &bh); if (!error) { @@ -2319,7 +2283,7 @@ gfs_trans_end(sdp); - RETURN(GFN_DIR_EXHASH_FREE, error); + return error; } /** @@ -2335,7 +2299,6 @@ gfs_diradd_alloc_required(struct gfs_inode *dip, struct qstr *filename, int *alloc_required) { - ENTER(GFN_DIRADD_ALLOC_REQUIRED) struct buffer_head *bh = NULL, *bh_next; uint32_t hsize, hash, index; int error = 0; @@ -2346,7 +2309,7 @@ hsize = 1 << dip->i_di.di_depth; if (hsize * sizeof(uint64_t) != dip->i_di.di_size) { gfs_consist_inode(dip); - RETURN(GFN_DIRADD_ALLOC_REQUIRED, -EIO); + return -EIO; } hash = gfs_dir_hash(filename->name, filename->len); @@ -2354,7 +2317,7 @@ error = get_first_leaf(dip, index, &bh_next); if (error) - RETURN(GFN_DIRADD_ALLOC_REQUIRED, error); + return error; do { if (bh) @@ -2378,7 +2341,7 @@ } else { error = gfs_get_inode_buffer(dip, &bh); if (error) - RETURN(GFN_DIRADD_ALLOC_REQUIRED, error); + return error; if (!dirent_fits(dip, bh, filename->len)) *alloc_required = TRUE; @@ -2386,7 +2349,7 @@ brelse(bh); } - RETURN(GFN_DIRADD_ALLOC_REQUIRED, error); + return error; } /** @@ -2405,7 +2368,6 @@ uint32_t index, uint32_t len, uint64_t leaf_no, void *data) { - ENTER(GFN_DO_GDM) struct gfs_user_buffer *ub = (struct gfs_user_buffer *)data; struct gfs_leaf leaf; struct buffer_head *bh; @@ -2427,7 +2389,7 @@ break; } - RETURN(GFN_DO_GDM, error); + return error; } /** @@ -2441,6 +2403,5 @@ int gfs_get_dir_meta(struct gfs_inode *dip, struct gfs_user_buffer *ub) { - ENTER(GFN_GET_DIR_META) - RETURN(GFN_GET_DIR_META, foreach_leaf(dip, do_gdm, ub)); + return foreach_leaf(dip, do_gdm, ub); } --- cluster/gfs-kernel/src/gfs/dir.h 2004/06/24 08:53:27 1.1 +++ cluster/gfs-kernel/src/gfs/dir.h 2006/07/10 23:22:34 1.2 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/eaops.c 2005/09/01 02:56:31 1.4 +++ cluster/gfs-kernel/src/gfs/eaops.c 2006/07/10 23:22:34 1.5 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -20,6 +20,7 @@ #include #include #include +#include #include "gfs.h" #include "acl.h" @@ -36,7 +37,6 @@ unsigned int gfs_ea_name2type(const char *name, char **truncated_name) { - ENTER(GFN_EA_NAME2TYPE) unsigned int type; if (strncmp(name, "system.", 7) == 0) { @@ -53,7 +53,7 @@ *truncated_name = NULL; } - RETURN(GFN_EA_NAME2TYPE, type); + return type; } /** @@ -67,16 +67,14 @@ static int user_eo_get(struct gfs_inode *ip, struct gfs_ea_request *er) { - ENTER(GFN_USER_EO_GET) - { struct inode *inode = ip->i_vnode; int error = permission(inode, MAY_READ, NULL); if (error) - RETURN(GFN_USER_EO_GET, error); + return error; } - RETURN(GFN_USER_EO_GET, gfs_ea_get_i(ip, er)); + return gfs_ea_get_i(ip, er); } /** @@ -90,20 +88,18 @@ static int user_eo_set(struct gfs_inode *ip, struct gfs_ea_request *er) { - ENTER(GFN_USER_EO_SET) - { struct inode *inode = ip->i_vnode; if (S_ISREG(inode->i_mode) || (S_ISDIR(inode->i_mode) && !(inode->i_mode & S_ISVTX))) { int error = permission(inode, MAY_WRITE, NULL); if (error) - RETURN(GFN_USER_EO_SET, error); + return error; } else - RETURN(GFN_USER_EO_SET, -EPERM); + return -EPERM; } - RETURN(GFN_USER_EO_SET, gfs_ea_set_i(ip, er)); + return gfs_ea_set_i(ip, er); } /** @@ -117,20 +113,18 @@ static int user_eo_remove(struct gfs_inode *ip, struct gfs_ea_request *er) { - ENTER(GFN_USER_EO_REMOVE) - { struct inode *inode = ip->i_vnode; if (S_ISREG(inode->i_mode) || (S_ISDIR(inode->i_mode) && !(inode->i_mode & S_ISVTX))) { int error = permission(inode, MAY_WRITE, NULL); if (error) - RETURN(GFN_USER_EO_REMOVE, error); + return error; } else - RETURN(GFN_USER_EO_REMOVE, -EPERM); + return -EPERM; } - RETURN(GFN_USER_EO_REMOVE, gfs_ea_remove_i(ip, er)); + return gfs_ea_remove_i(ip, er); } /** @@ -144,14 +138,17 @@ static int system_eo_get(struct gfs_inode *ip, struct gfs_ea_request *er) { - ENTER(GFN_SYSTEM_EO_GET) - if (!GFS_ACL_IS_ACCESS(er->er_name, er->er_name_len) && !GFS_ACL_IS_DEFAULT(er->er_name, er->er_name_len) && !capable(CAP_SYS_ADMIN)) - RETURN(GFN_SYSTEM_EO_GET, -EPERM); + return -EPERM; + + if (ip->i_sbd->sd_args.ar_posix_acls == FALSE && + (GFS_ACL_IS_ACCESS(er->er_name, er->er_name_len) || + GFS_ACL_IS_DEFAULT(er->er_name, er->er_name_len))) + return -EOPNOTSUPP; - RETURN(GFN_SYSTEM_EO_GET, gfs_ea_get_i(ip, er)); + return gfs_ea_get_i(ip, er); } /** @@ -165,7 +162,6 @@ static int system_eo_set(struct gfs_inode *ip, struct gfs_ea_request *er) { - ENTER(GFN_SYSTEM_EO_SET) int remove = FALSE; int error; @@ -174,19 +170,19 @@ error = gfs_acl_validate_set(ip, TRUE, er, &remove, &er->er_mode); if (error) - RETURN(GFN_SYSTEM_EO_SET, error); + return error; error = gfs_ea_set_i(ip, er); if (error) - RETURN(GFN_SYSTEM_EO_SET, error); + return error; if (remove) gfs_ea_remove_i(ip, er); - RETURN(GFN_SYSTEM_EO_SET, 0); + return 0; } else if (GFS_ACL_IS_DEFAULT(er->er_name, er->er_name_len)) { int error = gfs_acl_validate_set(ip, FALSE, er, &remove, NULL); if (error) - RETURN(GFN_SYSTEM_EO_SET, error); + return error; if (!remove) error = gfs_ea_set_i(ip, er); else { @@ -194,10 +190,10 @@ if (error == -ENODATA) error = 0; } - RETURN(GFN_SYSTEM_EO_SET, error); + return error; } - RETURN(GFN_SYSTEM_EO_SET, -EPERM); + return -EPERM; } /** @@ -211,22 +207,20 @@ static int system_eo_remove(struct gfs_inode *ip, struct gfs_ea_request *er) { - ENTER(GFN_SYSTEM_EO_REMOVE) - if (GFS_ACL_IS_ACCESS(er->er_name, er->er_name_len)) { int error = gfs_acl_validate_remove(ip, TRUE); if (error) - RETURN(GFN_SYSTEM_EO_REMOVE, error); + return error; } else if (GFS_ACL_IS_DEFAULT(er->er_name, er->er_name_len)) { int error = gfs_acl_validate_remove(ip, FALSE); if (error) - RETURN(GFN_SYSTEM_EO_REMOVE, error); + return error; } else - RETURN(GFN_SYSTEM_EO_REMOVE, -EPERM); + return -EPERM; - RETURN(GFN_SYSTEM_EO_REMOVE, gfs_ea_remove_i(ip, er)); + return gfs_ea_remove_i(ip, er); } struct gfs_eattr_operations gfs_user_eaops = { --- cluster/gfs-kernel/src/gfs/eaops.h 2004/10/05 19:44:58 1.1 +++ cluster/gfs-kernel/src/gfs/eaops.h 2006/07/10 23:22:34 1.2 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/eattr.c 2006/01/09 22:25:06 1.8 +++ cluster/gfs-kernel/src/gfs/eattr.c 2006/07/10 23:22:34 1.9 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -20,6 +20,7 @@ #include #include #include +#include #include "gfs.h" #include "acl.h" @@ -47,15 +48,12 @@ struct gfs_ea_request *er, unsigned int *size) { - ENTER(GFN_EA_CALC_SIZE) - *size = GFS_EAREQ_SIZE_STUFFED(er); if (*size <= sdp->sd_jbsize) - RETURN(GFN_EA_CALC_SIZE, TRUE); + return TRUE; *size = GFS_EAREQ_SIZE_UNSTUFFED(sdp, er); - - RETURN(GFN_EA_CALC_SIZE, FALSE); + return FALSE; } /** @@ -69,19 +67,16 @@ int gfs_ea_check_size(struct gfs_sbd *sdp, struct gfs_ea_request *er) { - ENTER(GFN_EA_CHECK_SIZE) unsigned int size; if (er->er_data_len > GFS_EA_MAX_DATA_LEN) - RETURN(GFN_EA_CHECK_SIZE, -ERANGE); + return -ERANGE; ea_calc_size(sdp, er, &size); - - /* This can only happen with 512 byte blocks */ if (size > sdp->sd_jbsize) - RETURN(GFN_EA_CHECK_SIZE, -ERANGE); + return -ERANGE; /* This can only happen with 512 byte blocks */ - RETURN(GFN_EA_CHECK_SIZE, 0); + return 0; } typedef int (*ea_call_t) (struct gfs_inode *ip, @@ -105,12 +100,11 @@ struct buffer_head *bh, ea_call_t ea_call, void *data) { - ENTER(GFN_EA_FOREACH_I) struct gfs_ea_header *ea, *prev = NULL; int error = 0; if (gfs_metatype_check(ip->i_sbd, bh, GFS_METATYPE_EA)) - RETURN(GFN_EA_FOREACH_I, -EIO); + return -EIO; for (ea = GFS_EA_BH2FIRST(bh);; prev = ea, ea = GFS_EA2NEXT(ea)) { if (!GFS_EA_REC_LEN(ea)) @@ -124,7 +118,7 @@ error = ea_call(ip, bh, ea, prev, data); if (error) - RETURN(GFN_EA_FOREACH_I, error); + return error; if (GFS_EA_IS_LAST(ea)) { if ((char *)GFS_EA2NEXT(ea) != @@ -134,11 +128,11 @@ } } - RETURN(GFN_EA_FOREACH_I, error); + return error; fail: gfs_consist_inode(ip); - RETURN(GFN_EA_FOREACH_I, -EIO); + return -EIO; } /** @@ -155,14 +149,13 @@ ea_call_t ea_call, void *data) { - ENTER(GFN_EA_FOREACH) struct buffer_head *bh; int error; error = gfs_dread(ip->i_gl, ip->i_di.di_eattr, DIO_START | DIO_WAIT, &bh); if (error) - RETURN(GFN_EA_FOREACH, error); + return error; if (!(ip->i_di.di_flags & GFS_DIF_EA_INDIRECT)) error = ea_foreach_i(ip, bh, ea_call, data); @@ -199,7 +192,7 @@ out: brelse(bh); - RETURN(GFN_EA_FOREACH, error); + return error; } struct ea_find { @@ -226,12 +219,11 @@ struct gfs_ea_header *prev, void *private) { - ENTER(GFN_EA_FIND_I) struct ea_find *ef = (struct ea_find *)private; struct gfs_ea_request *er = ef->ef_er; if (ea->ea_type == GFS_EATYPE_UNUSED) - RETURN(GFN_EA_FIND_I, 0); + return 0; if (ea->ea_type == er->er_type) { if (ea->ea_name_len == er->er_name_len && @@ -241,17 +233,17 @@ el->el_bh = bh; el->el_ea = ea; el->el_prev = prev; - RETURN(GFN_EA_FIND_I, 1); + return 1; } } #if 0 else if ((ip->i_di.di_flags & GFS_DIF_EA_PACKED) && er->er_type == GFS_EATYPE_SYS) - RETURN(GFN_EA_FIND_I, 1); + return 1; #endif - RETURN(GFN_EA_FIND_I, 0); + return 0; } /** @@ -268,7 +260,6 @@ struct gfs_ea_request *er, struct gfs_ea_location *el) { - ENTER(GFN_EA_FIND) struct ea_find ef; int error; @@ -279,9 +270,9 @@ error = ea_foreach(ip, ea_find_i, &ef); if (error > 0) - RETURN(GFN_EA_FIND, 0); + return 0; - RETURN(GFN_EA_FIND, error); + return error; } /** @@ -306,7 +297,6 @@ struct gfs_ea_header *prev, void *private) { - ENTER(GFN_EA_DEALLOC_UNSTUFFED) int *leave = (int *)private; struct gfs_sbd *sdp = ip->i_sbd; struct gfs_rgrpd *rgd; @@ -319,7 +309,7 @@ int error; if (GFS_EA_IS_STUFFED(ea)) - RETURN(GFN_EA_DEALLOC_UNSTUFFED, 0); + return 0; dataptrs = GFS_EA2DATAPTRS(ea); for (x = 0; x < ea->ea_num_ptrs; x++, dataptrs++) @@ -328,17 +318,17 @@ break; } if (!bn) - RETURN(GFN_EA_DEALLOC_UNSTUFFED, 0); + return 0; rgd = gfs_blk2rgrpd(sdp, bn); if (!rgd) { gfs_consist_inode(ip); - RETURN(GFN_EA_DEALLOC_UNSTUFFED, -EIO); + return -EIO; } error = gfs_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, &rg_gh); if (error) - RETURN(GFN_EA_DEALLOC_UNSTUFFED, error); + return error; error = gfs_trans_begin(sdp, 2 + rgd->rd_ri.ri_length, 1); if (error) @@ -395,7 +385,7 @@ out_gunlock: gfs_glock_dq_uninit(&rg_gh); - RETURN(GFN_EA_DEALLOC_UNSTUFFED, error); + return error; } /** @@ -416,7 +406,6 @@ struct gfs_ea_header *prev, int leave) { - ENTER(GFN_EA_REMOVE_UNSTUFFED) struct gfs_alloc *al; int error; @@ -442,7 +431,7 @@ out_alloc: gfs_alloc_put(ip); - RETURN(GFN_EA_REMOVE_UNSTUFFED, error); + return error; } /**************************************************************************************************/ @@ -457,8 +446,7 @@ int gfs_ea_repack_i(struct gfs_inode *ip) { - ENTER(GFN_EA_REPACK_I) - RETURN(GFN_EA_REPACK_I, -ENOSYS); + return -ENOSYS; } /** @@ -470,13 +458,12 @@ int gfs_ea_repack(struct gfs_inode *ip) { - ENTER(GFN_EA_REPACK) struct gfs_holder gh; int error; error = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); if (error) - RETURN(GFN_EA_REPACK, error); + return error; /* Some sort of permissions checking would be nice */ @@ -484,7 +471,7 @@ gfs_glock_dq_uninit(&gh); - RETURN(GFN_EA_REPACK, error); + return error; } struct ea_list { @@ -510,13 +497,12 @@ struct gfs_ea_header *prev, void *private) { - ENTER(GFN_EA_LIST_I) struct ea_list *ei = (struct ea_list *)private; struct gfs_ea_request *er = ei->ei_er; unsigned int ea_size = GFS_EA_STRLEN(ea); if (ea->ea_type == GFS_EATYPE_UNUSED) - RETURN(GFN_EA_LIST_I, 0); + return 0; if (er->er_data_len) { char *prefix; @@ -524,7 +510,7 @@ char c = 0; if (ei->ei_size + ea_size > er->er_data_len) - RETURN(GFN_EA_LIST_I, -ERANGE); + return -ERANGE; if (ea->ea_type == GFS_EATYPE_USR) { prefix = "user."; @@ -546,7 +532,7 @@ ei->ei_size += ea_size; - RETURN(GFN_EA_LIST_I, 0); + return 0; } /** @@ -560,7 +546,6 @@ int gfs_ea_list(struct gfs_inode *ip, struct gfs_ea_request *er) { - ENTER(GFN_EA_LIST) struct gfs_holder i_gh; int error; @@ -573,7 +558,7 @@ LM_ST_SHARED, LM_FLAG_ANY, &i_gh); if (error) - RETURN(GFN_EA_LIST, error); + return error; if (ip->i_di.di_eattr) { struct ea_list ei = { .ei_er = er, .ei_size = 0 }; @@ -585,7 +570,7 @@ gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_EA_LIST, error); + return error; } /** @@ -602,7 +587,6 @@ ea_get_unstuffed(struct gfs_inode *ip, struct gfs_ea_header *ea, char *data) { - ENTER(GFN_EA_GET_UNSTUFFED) struct gfs_sbd *sdp = ip->i_sbd; struct buffer_head **bh; unsigned int amount = GFS_EA_DATA_LEN(ea); @@ -613,7 +597,7 @@ bh = kmalloc(nptrs * sizeof(struct buffer_head *), GFP_KERNEL); if (!bh) - RETURN(GFN_EA_GET_UNSTUFFED, -ENOMEM); + return -ENOMEM; for (x = 0; x < nptrs; x++) { error = gfs_dread(ip->i_gl, gfs64_to_cpu(*dataptrs), @@ -654,7 +638,7 @@ out: kfree(bh); - RETURN(GFN_EA_GET_UNSTUFFED, error); + return error; } /** @@ -671,16 +655,13 @@ struct gfs_ea_location *el, char *data) { - ENTER(GFN_EA_GET_COPY) - if (GFS_EA_IS_STUFFED(el->el_ea)) { memcpy(data, GFS_EA2DATA(el->el_ea), GFS_EA_DATA_LEN(el->el_ea)); - RETURN(GFN_EA_GET_COPY, 0); + return 0; } else - RETURN(GFN_EA_GET_COPY, - ea_get_unstuffed(ip, el->el_ea, data)); + return ea_get_unstuffed(ip, el->el_ea, data); } /** @@ -694,18 +675,17 @@ int gfs_ea_get_i(struct gfs_inode *ip, struct gfs_ea_request *er) { - ENTER(GFN_EA_GET_I) struct gfs_ea_location el; int error; if (!ip->i_di.di_eattr) - RETURN(GFN_EA_GET_I, -ENODATA); + return -ENODATA; error = gfs_ea_find(ip, er, &el); if (error) - RETURN(GFN_EA_GET_I, error); + return error; if (!el.el_ea) - RETURN(GFN_EA_GET_I, -ENODATA); + return -ENODATA; if (er->er_data_len) { if (GFS_EA_DATA_LEN(el.el_ea) > er->er_data_len) @@ -718,7 +698,7 @@ brelse(el.el_bh); - RETURN(GFN_EA_GET_I, error); + return error; } /** @@ -732,13 +712,12 @@ int gfs_ea_get(struct gfs_inode *ip, struct gfs_ea_request *er) { - ENTER(GFN_EA_GET) struct gfs_holder i_gh; int error; if (!er->er_name_len || er->er_name_len > GFS_EA_MAX_NAME_LEN) - RETURN(GFN_EA_GET, -EINVAL); + return -EINVAL; if (!er->er_data || !er->er_data_len) { er->er_data = NULL; er->er_data_len = 0; @@ -748,13 +727,13 @@ LM_ST_SHARED, LM_FLAG_ANY, &i_gh); if (error) - RETURN(GFN_EA_GET, error); + return error; error = gfs_ea_ops[er->er_type]->eo_get(ip, er); gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_EA_GET, error); + return error; } /** @@ -769,7 +748,6 @@ ea_alloc_blk(struct gfs_inode *ip, struct buffer_head **bhp) { - ENTER(GFN_EA_ALLOC_BLK) struct gfs_sbd *sdp = ip->i_sbd; struct gfs_ea_header *ea; uint64_t block; @@ -777,12 +755,12 @@ error = gfs_metaalloc(ip, &block); if (error) - RETURN(GFN_EA_ALLOC_BLK, error); + return error; error = gfs_dread(ip->i_gl, block, DIO_NEW | DIO_START | DIO_WAIT, bhp); if (error) - RETURN(GFN_EA_ALLOC_BLK, error); + return error; gfs_trans_add_bh(ip->i_gl, *bhp); gfs_metatype_set(*bhp, GFS_METATYPE_EA, GFS_FORMAT_EA); @@ -795,7 +773,7 @@ ip->i_di.di_blocks++; - RETURN(GFN_EA_ALLOC_BLK, 0); + return 0; } /** @@ -815,7 +793,6 @@ struct gfs_ea_header *ea, struct gfs_ea_request *er) { - ENTER(GFN_EA_WRITE) struct gfs_sbd *sdp = ip->i_sbd; ea->ea_data_len = cpu_to_gfs32(er->er_data_len); @@ -843,12 +820,12 @@ error = gfs_metaalloc(ip, &block); if (error) - RETURN(GFN_EA_WRITE, error); + return error; error = gfs_dread(ip->i_gl, block, DIO_NEW | DIO_START | DIO_WAIT, &bh); if (error) - RETURN(GFN_EA_WRITE, error); + return error; gfs_trans_add_bh(ip->i_gl, bh); gfs_metatype_set(bh, GFS_METATYPE_ED, GFS_FORMAT_ED); @@ -869,7 +846,7 @@ gfs_assert_withdraw(sdp, !data_len); } - RETURN(GFN_EA_WRITE, 0); + return 0; } typedef int (*ea_skeleton_call_t) (struct gfs_inode *ip, @@ -891,7 +868,6 @@ unsigned int blks, ea_skeleton_call_t skeleton_call, void *private) { - ENTER(GFN_EA_ALLOC_SKELETON) struct gfs_alloc *al; struct buffer_head *dibh; int error; @@ -949,7 +925,7 @@ out: gfs_alloc_put(ip); - RETURN(GFN_EA_ALLOC_SKELETON, error); + return error; } /** @@ -966,20 +942,19 @@ struct gfs_ea_request *er, void *private) { - ENTER(GFN_EA_INIT_I) struct buffer_head *bh; int error; error = ea_alloc_blk(ip, &bh); if (error) - RETURN(GFN_EA_INIT_I, error); + return error; ip->i_di.di_eattr = bh->b_blocknr; error = ea_write(ip, GFS_EA_BH2FIRST(bh), er); brelse(bh); - RETURN(GFN_EA_INIT_I, error); + return error; } /** @@ -993,17 +968,15 @@ static int ea_init(struct gfs_inode *ip, struct gfs_ea_request *er) { - ENTER(GFN_EA_INIT) unsigned int jbsize = ip->i_sbd->sd_jbsize; unsigned int blks = 1; if (GFS_EAREQ_SIZE_STUFFED(er) > jbsize) blks += DIV_RU(er->er_data_len, jbsize); - RETURN(GFN_EA_INIT, - ea_alloc_skeleton(ip, er, + return ea_alloc_skeleton(ip, er, blks, - ea_init_i, NULL)); + ea_init_i, NULL); } /** @@ -1016,7 +989,6 @@ static struct gfs_ea_header * ea_split_ea(struct gfs_ea_header *ea) { - ENTER(GFN_EA_SPLIT_EA) uint32_t ea_size = GFS_EA_SIZE(ea); struct gfs_ea_header *new = (struct gfs_ea_header *)((char *)ea + ea_size); uint32_t new_size = GFS_EA_REC_LEN(ea) - ea_size; @@ -1028,7 +1000,7 @@ new->ea_rec_len = cpu_to_gfs32(new_size); new->ea_flags = last; - RETURN(GFN_EA_SPLIT_EA, new); + return new; } /** @@ -1041,7 +1013,6 @@ static void ea_set_remove_stuffed(struct gfs_inode *ip, struct gfs_ea_location *el) { - ENTER(GFN_EA_SET_REMOVE_STUFFED) struct gfs_ea_header *ea = el->el_ea; struct gfs_ea_header *prev = el->el_prev; uint32_t len; @@ -1050,7 +1021,7 @@ if (!prev || !GFS_EA_IS_STUFFED(ea)) { ea->ea_type = GFS_EATYPE_UNUSED; - RET(GFN_EA_SET_REMOVE_STUFFED); + return; } else if (GFS_EA2NEXT(prev) != ea) { prev = GFS_EA2NEXT(prev); gfs_assert_withdraw(ip->i_sbd, GFS_EA2NEXT(prev) == ea); @@ -1061,8 +1032,6 @@ if (GFS_EA_IS_LAST(ea)) prev->ea_flags |= GFS_EAFLAG_LAST; - - RET(GFN_EA_SET_REMOVE_STUFFED); } struct ea_set { @@ -1090,13 +1059,12 @@ struct gfs_ea_header *ea, struct ea_set *es) { - ENTER(GFN_EA_SET_SIMPLE_NOALLOC) struct gfs_ea_request *er = es->es_er; int error; error = gfs_trans_begin(ip->i_sbd, 3, 0); if (error) - RETURN(GFN_EA_SET_SIMPLE_NOALLOC, error); + return error; gfs_trans_add_bh(ip->i_gl, bh); @@ -1125,7 +1093,7 @@ gfs_trans_end(ip->i_sbd); - RETURN(GFN_EA_SET_SIMPLE_NOALLOC, error); + return error; } /** @@ -1142,7 +1110,6 @@ struct gfs_ea_request *er, void *private) { - ENTER(GFN_EA_SET_SIMPLE_ALLOC) struct ea_set *es = (struct ea_set *)private; struct gfs_ea_header *ea = es->es_ea; int error; @@ -1154,12 +1121,12 @@ error = ea_write(ip, ea, er); if (error) - RETURN(GFN_EA_SET_SIMPLE_ALLOC, error); + return error; if (es->es_el) ea_set_remove_stuffed(ip, es->es_el); - RETURN(GFN_EA_SET_SIMPLE_ALLOC, 0); + return 0; } /** @@ -1177,7 +1144,6 @@ struct gfs_ea_header *prev, void *private) { - ENTER(GFN_EA_SET_SIMPLE) struct ea_set *es = (struct ea_set *)private; unsigned int size; int stuffed; @@ -1187,22 +1153,22 @@ if (ea->ea_type == GFS_EATYPE_UNUSED) { if (GFS_EA_REC_LEN(ea) < size) - RETURN(GFN_EA_SET_SIMPLE, 0); + return 0; if (!GFS_EA_IS_STUFFED(ea)) { error = ea_remove_unstuffed(ip, bh, ea, prev, TRUE); if (error) - RETURN(GFN_EA_SET_SIMPLE, error); + return error; } es->ea_split = FALSE; } else if (GFS_EA_REC_LEN(ea) - GFS_EA_SIZE(ea) >= size) es->ea_split = TRUE; else - RETURN(GFN_EA_SET_SIMPLE, 0); + return 0; if (stuffed) { error = ea_set_simple_noalloc(ip, bh, ea, es); if (error) - RETURN(GFN_EA_SET_SIMPLE, error); + return error; } else { unsigned int blks; @@ -1215,10 +1181,10 @@ blks, ea_set_simple_alloc, es); if (error) - RETURN(GFN_EA_SET_SIMPLE, error); + return error; } - RETURN(GFN_EA_SET_SIMPLE, 1); + return 1; } /** @@ -1235,7 +1201,6 @@ struct gfs_ea_request *er, void *private) { - ENTER(GFN_EA_SET_BLOCK) struct gfs_sbd *sdp = ip->i_sbd; struct buffer_head *indbh, *newbh; uint64_t *eablk; @@ -1247,7 +1212,7 @@ error = gfs_dread(ip->i_gl, ip->i_di.di_eattr, DIO_START | DIO_WAIT, &indbh); if (error) - RETURN(GFN_EA_SET_BLOCK, error); + return error; if (gfs_metatype_check(sdp, indbh, GFS_METATYPE_IN)) { error = -EIO; @@ -1272,12 +1237,12 @@ error = gfs_metaalloc(ip, &blk); if (error) - RETURN(GFN_EA_SET_BLOCK, error); + return error; error = gfs_dread(ip->i_gl, blk, DIO_NEW | DIO_START | DIO_WAIT, &indbh); if (error) - RETURN(GFN_EA_SET_BLOCK, error); + return error; gfs_trans_add_bh(ip->i_gl, indbh); gfs_metatype_set(indbh, GFS_METATYPE_IN, GFS_FORMAT_IN); @@ -1308,7 +1273,7 @@ out: brelse(indbh); - RETURN(GFN_EA_SET_BLOCK, error); + return error; } /** @@ -1324,8 +1289,6 @@ struct gfs_ea_request *er, struct gfs_ea_location *el) { - ENTER(GFN_EA_SET_I2) - { struct ea_set es; int error; @@ -1336,9 +1299,9 @@ error = ea_foreach(ip, ea_set_simple, &es); if (error > 0) - RETURN(GFN_EA_SET_I2, 0); + return 0; if (error) - RETURN(GFN_EA_SET_I2, error); + return error; } { unsigned int blks = 2; @@ -1348,8 +1311,7 @@ blks += DIV_RU(er->er_data_len, ip->i_sbd->sd_jbsize); - RETURN(GFN_EA_SET_I2, - ea_alloc_skeleton(ip, er, blks, ea_set_block, el)); + return ea_alloc_skeleton(ip, er, blks, ea_set_block, el); } } @@ -1364,16 +1326,13 @@ static int ea_set_remove_unstuffed(struct gfs_inode *ip, struct gfs_ea_location *el) { - ENTER(GFN_EA_SET_REMOVE_UNSTUFFED) - if (el->el_prev && GFS_EA2NEXT(el->el_prev) != el->el_ea) { el->el_prev = GFS_EA2NEXT(el->el_prev); gfs_assert_withdraw(ip->i_sbd, GFS_EA2NEXT(el->el_prev) == el->el_ea); } - RETURN(GFN_EA_SET_REMOVE_UNSTUFFED, - ea_remove_unstuffed(ip, el->el_bh, el->el_ea, el->el_prev, FALSE)); + return ea_remove_unstuffed(ip, el->el_bh, el->el_ea, el->el_prev, FALSE); } /** @@ -1387,24 +1346,23 @@ int gfs_ea_set_i(struct gfs_inode *ip, struct gfs_ea_request *er) { - ENTER(GFN_EA_SET_I) struct gfs_ea_location el; int error; if (!ip->i_di.di_eattr) { if (er->er_flags & XATTR_REPLACE) - RETURN(GFN_EA_SET_I, -ENODATA); - RETURN(GFN_EA_SET_I, ea_init(ip, er)); + return -ENODATA; + return ea_init(ip, er); } error = gfs_ea_find(ip, er, &el); if (error) - RETURN(GFN_EA_SET_I, error); + return error; if (el.el_ea) { if (IS_APPEND(ip->i_vnode)) { brelse(el.el_bh); - RETURN(GFN_EA_SET_I, -EPERM); + return -EPERM; } error = -EEXIST; @@ -1422,7 +1380,7 @@ error = ea_set_i(ip, er, NULL); } - RETURN(GFN_EA_SET_I, error); + return error; } /** @@ -1436,24 +1394,23 @@ int gfs_ea_set(struct gfs_inode *ip, struct gfs_ea_request *er) { - ENTER(GFN_EA_SET) struct gfs_holder i_gh; int error; if (!er->er_name_len || er->er_name_len > GFS_EA_MAX_NAME_LEN) - RETURN(GFN_EA_SET, -EINVAL); + return -EINVAL; if (!er->er_data || !er->er_data_len) { er->er_data = NULL; er->er_data_len = 0; } error = gfs_ea_check_size(ip->i_sbd, er); if (error) - RETURN(GFN_EA_SET, error); + return error; error = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh); if (error) - RETURN(GFN_EA_SET, error); + return error; if (IS_IMMUTABLE(ip->i_vnode)) error = -EPERM; @@ -1462,7 +1419,7 @@ gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_EA_SET, error); + return error; } /** @@ -1478,14 +1435,13 @@ ea_remove_stuffed(struct gfs_inode *ip, struct gfs_ea_location *el) { - ENTER(GFN_EA_REMOVE_STUFFED) struct gfs_ea_header *ea = el->el_ea; struct gfs_ea_header *prev = el->el_prev; int error; error = gfs_trans_begin(ip->i_sbd, 2, 0); if (error) - RETURN(GFN_EA_REMOVE_STUFFED, error); + return error; gfs_trans_add_bh(ip->i_gl, el->el_bh); @@ -1513,7 +1469,7 @@ gfs_trans_end(ip->i_sbd); - RETURN(GFN_EA_REMOVE_STUFFED, error); + return error; } /** @@ -1527,18 +1483,17 @@ int gfs_ea_remove_i(struct gfs_inode *ip, struct gfs_ea_request *er) { - ENTER(GFN_EA_REMOVE_I) struct gfs_ea_location el; int error; if (!ip->i_di.di_eattr) - RETURN(GFN_EA_REMOVE_I, -ENODATA); + return -ENODATA; error = gfs_ea_find(ip, er, &el); if (error) - RETURN(GFN_EA_REMOVE_I, error); + return error; if (!el.el_ea) - RETURN(GFN_EA_REMOVE_I, -ENODATA); + return -ENODATA; if (GFS_EA_IS_STUFFED(el.el_ea)) error = ea_remove_stuffed(ip, &el); @@ -1547,7 +1502,7 @@ brelse(el.el_bh); - RETURN(GFN_EA_REMOVE_I, error); + return error; } /** @@ -1561,17 +1516,16 @@ int gfs_ea_remove(struct gfs_inode *ip, struct gfs_ea_request *er) { - ENTER(GFN_EA_REMOVE) struct gfs_holder i_gh; int error; if (!er->er_name_len || er->er_name_len > GFS_EA_MAX_NAME_LEN) - RETURN(GFN_EA_REMOVE, -EINVAL); + return -EINVAL; error = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh); if (error) - RETURN(GFN_EA_REMOVE, error); + return error; if (IS_IMMUTABLE(ip->i_vnode) || IS_APPEND(ip->i_vnode)) error = -EPERM; @@ -1580,7 +1534,7 @@ gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_EA_REMOVE, error); + return error; } /** @@ -1594,11 +1548,10 @@ int gfs_ea_acl_init(struct gfs_inode *ip, struct gfs_ea_request *er) { - ENTER(GFN_EA_ACL_INIT) int error; if (!ip->i_di.di_eattr) - RETURN(GFN_EA_ACL_INIT, ea_init_i(ip, er, NULL)); + return ea_init_i(ip, er, NULL); { struct buffer_head *bh; @@ -1610,11 +1563,11 @@ error = gfs_dread(ip->i_gl, ip->i_di.di_eattr, DIO_START | DIO_WAIT, &bh); if (error) - RETURN(GFN_EA_ACL_INIT, error); + return error; if (gfs_metatype_check(ip->i_sbd, bh, GFS_METATYPE_EA)) { brelse(bh); - RETURN(GFN_EA_ACL_INIT, -EIO); + return -EIO; } ea = GFS_EA_BH2FIRST(bh); @@ -1622,7 +1575,7 @@ ea = ea_split_ea(ea); ea_write(ip, ea, er); brelse(bh); - RETURN(GFN_EA_ACL_INIT, 0); + return 0; } brelse(bh); @@ -1631,18 +1584,18 @@ error = ea_set_block(ip, er, NULL); gfs_assert_withdraw(ip->i_sbd, error != -ENOSPC); if (error) - RETURN(GFN_EA_ACL_INIT, error); + return error; { struct buffer_head *dibh; error = gfs_get_inode_buffer(ip, &dibh); if (error) - RETURN(GFN_EA_ACL_INIT, error); + return error; gfs_dinode_out(&ip->i_di, dibh->b_data); brelse(dibh); } - RETURN(GFN_EA_ACL_INIT, error); + return error; } /** @@ -1659,7 +1612,6 @@ struct gfs_ea_header *ea, char *data) { - ENTER(GFN_EA_ACL_CHMOD_UNSTUFFED) struct gfs_sbd *sdp = ip->i_sbd; struct buffer_head **bh; unsigned int amount = GFS_EA_DATA_LEN(ea); @@ -1670,7 +1622,7 @@ bh = kmalloc(nptrs * sizeof(struct buffer_head *), GFP_KERNEL); if (!bh) - RETURN(GFN_EA_ACL_CHMOD_UNSTUFFED, -ENOMEM); + return -ENOMEM; error = gfs_trans_begin(sdp, 1 + nptrs, 0); if (error) @@ -1717,13 +1669,13 @@ out: kfree(bh); - RETURN(GFN_EA_ACL_CHMOD_UNSTUFFED, error); + return error; fail: gfs_trans_end(sdp); kfree(bh); - RETURN(GFN_EA_ACL_CHMOD_UNSTUFFED, error); + return error; } /** @@ -1740,14 +1692,13 @@ gfs_ea_acl_chmod(struct gfs_inode *ip, struct gfs_ea_location *el, struct iattr *attr, char *data) { - ENTER(GFN_EA_ACL_CHMOD) struct buffer_head *dibh; int error; if (GFS_EA_IS_STUFFED(el->el_ea)) { error = gfs_trans_begin(ip->i_sbd, 2, 0); if (error) - RETURN(GFN_EA_ACL_CHMOD, error); + return error; gfs_trans_add_bh(ip->i_gl, el->el_bh); memcpy(GFS_EA2DATA(el->el_ea), @@ -1757,7 +1708,7 @@ error = ea_acl_chmod_unstuffed(ip, el->el_ea, data); if (error) - RETURN(GFN_EA_ACL_CHMOD, error); + return error; error = gfs_get_inode_buffer(ip, &dibh); if (!error) { @@ -1771,7 +1722,7 @@ gfs_trans_end(ip->i_sbd); - RETURN(GFN_EA_ACL_CHMOD, error); + return error; } /** @@ -1784,7 +1735,6 @@ static int ea_dealloc_indirect(struct gfs_inode *ip) { - ENTER(GFN_EA_DEALLOC_INDIRECT) struct gfs_sbd *sdp = ip->i_sbd; struct gfs_rgrp_list rlist; struct buffer_head *indbh, *dibh; @@ -1800,7 +1750,7 @@ error = gfs_dread(ip->i_gl, ip->i_di.di_eattr, DIO_START | DIO_WAIT, &indbh); if (error) - RETURN(GFN_EA_DEALLOC_INDIRECT, error); + return error; if (gfs_metatype_check(sdp, indbh, GFS_METATYPE_IN)) { error = -EIO; @@ -1897,7 +1847,7 @@ out: brelse(indbh); - RETURN(GFN_EA_DEALLOC_INDIRECT, error); + return error; } /** @@ -1910,7 +1860,6 @@ static int ea_dealloc_block(struct gfs_inode *ip) { - ENTER(GFN_EA_DEALLOC_BLOCK) struct gfs_sbd *sdp = ip->i_sbd; struct gfs_alloc *al = ip->i_alloc; struct gfs_rgrpd *rgd; @@ -1920,12 +1869,12 @@ rgd = gfs_blk2rgrpd(sdp, ip->i_di.di_eattr); if (!rgd) { gfs_consist_inode(ip); - RETURN(GFN_EA_DEALLOC_BLOCK, -EIO); + return -EIO; } error = gfs_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, &al->al_rgd_gh); if (error) - RETURN(GFN_EA_DEALLOC_BLOCK, error); + return error; error = gfs_trans_begin(sdp, 1 + rgd->rd_ri.ri_length, 1); if (error) @@ -1950,7 +1899,7 @@ out_gunlock: gfs_glock_dq_uninit(&al->al_rgd_gh); - RETURN(GFN_EA_DEALLOC_BLOCK, error); + return error; } /** @@ -1963,7 +1912,6 @@ int gfs_ea_dealloc(struct gfs_inode *ip) { - ENTER(GFN_EA_DEALLOC) struct gfs_alloc *al; int error; @@ -1998,7 +1946,7 @@ out_alloc: gfs_alloc_put(ip); - RETURN(GFN_EA_DEALLOC, error); + return error; } /** @@ -2012,14 +1960,13 @@ int gfs_get_eattr_meta(struct gfs_inode *ip, struct gfs_user_buffer *ub) { - ENTER(GFN_GET_EATTR_META) struct buffer_head *bh; int error; error = gfs_dread(ip->i_gl, ip->i_di.di_eattr, DIO_START | DIO_WAIT, &bh); if (error) - RETURN(GFN_GET_EATTR_META, error); + return error; gfs_add_bh_to_ub(ub, bh); @@ -2056,5 +2003,5 @@ out: brelse(bh); - RETURN(GFN_GET_EATTR_META, error); + return error; } --- cluster/gfs-kernel/src/gfs/eattr.h 2004/10/05 19:44:58 1.2 +++ cluster/gfs-kernel/src/gfs/eattr.h 2006/07/10 23:22:34 1.3 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/file.c 2006/02/20 04:10:34 1.7 +++ cluster/gfs-kernel/src/gfs/file.c 2006/07/10 23:22:34 1.8 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -41,7 +41,6 @@ gfs_copy2mem(struct buffer_head *bh, void **buf, unsigned int offset, unsigned int size) { - ENTER(GFN_COPY2MEM) char **p = (char **)buf; if (bh) @@ -51,7 +50,7 @@ *p += size; - RETURN(GFN_COPY2MEM, 0); + return 0; } /** @@ -68,7 +67,6 @@ gfs_copy2user(struct buffer_head *bh, void **buf, unsigned int offset, unsigned int size) { - ENTER(GFN_COPY2USER) char **p = (char **)buf; int error; @@ -82,7 +80,7 @@ else *p += size; - RETURN(GFN_COPY2USER, error); + return error; } /** @@ -106,7 +104,6 @@ uint64_t offset, unsigned int size, read_copy_fn_t copy_fn) { - ENTER(GFN_READI) struct gfs_sbd *sdp = ip->i_sbd; struct buffer_head *bh; uint64_t lblock, dblock; @@ -119,13 +116,13 @@ int error = 0; if (offset >= ip->i_di.di_size) - RETURN(GFN_READI, 0); + return 0; if ((offset + size) > ip->i_di.di_size) size = ip->i_di.di_size - offset; if (!size) - RETURN(GFN_READI, 0); + return 0; if (journaled) { lblock = offset; @@ -183,10 +180,10 @@ o = (journaled) ? sizeof(struct gfs_meta_header) : 0; } - RETURN(GFN_READI, copied); + return copied; fail: - RETURN(GFN_READI, (copied) ? copied : error); + return (copied) ? copied : error; } /** @@ -205,14 +202,13 @@ gfs_copy_from_mem(struct gfs_inode *ip, struct buffer_head *bh, void **buf, unsigned int offset, unsigned int size, int new) { - ENTER(GFN_COPY_FROM_MEM) char **p = (char **)buf; int error = 0; /* The dinode block always gets journaled */ if (bh->b_blocknr == ip->i_num.no_addr) { if (gfs_assert_warn(ip->i_sbd, !new)) - RETURN(GFN_COPY_FROM_MEM, -EIO); + return -EIO; gfs_trans_add_bh(ip->i_gl, bh); memcpy(bh->b_data + offset, *p, size); @@ -234,7 +230,7 @@ if (!error) *p += size; - RETURN(GFN_COPY_FROM_MEM, error); + return error; } /** @@ -253,14 +249,13 @@ gfs_copy_from_user(struct gfs_inode *ip, struct buffer_head *bh, void **buf, unsigned int offset, unsigned int size, int new) { - ENTER(GFN_COPY_FROM_USER) char **p = (char **)buf; int error = 0; /* the dinode block always gets journaled */ if (bh->b_blocknr == ip->i_num.no_addr) { if (gfs_assert_warn(ip->i_sbd, !new)) - RETURN(GFN_COPY_FROM_USER, -EIO); + return -EIO; gfs_trans_add_bh(ip->i_gl, bh); if (copy_from_user(bh->b_data + offset, *p, size)) error = -EFAULT; @@ -294,7 +289,7 @@ if (!error) *p += size; - RETURN(GFN_COPY_FROM_USER, error); + return error; } /** @@ -313,7 +308,6 @@ uint64_t offset, unsigned int size, write_copy_fn_t copy_fn) { - ENTER(GFN_WRITEI) struct gfs_sbd *sdp = ip->i_sbd; struct buffer_head *dibh, *bh; uint64_t lblock, dblock; @@ -327,13 +321,13 @@ int error = 0; if (!size) - RETURN(GFN_WRITEI, 0); + return 0; if (gfs_is_stuffed(ip) && ((start + size) > (sdp->sd_sb.sb_bsize - sizeof(struct gfs_dinode)))) { error = gfs_unstuff_dinode(ip, gfs_unstuffer_async, NULL); if (error) - RETURN(GFN_WRITEI, error); + return error; } if (journaled) { @@ -392,7 +386,7 @@ out: error = gfs_get_inode_buffer(ip, &dibh); if (error) - RETURN(GFN_WRITEI, error); + return error; if (ip->i_di.di_size < start + copied) ip->i_di.di_size = start + copied; @@ -402,12 +396,12 @@ gfs_dinode_out(&ip->i_di, dibh->b_data); brelse(dibh); - RETURN(GFN_WRITEI, copied); + return copied; fail: if (copied) goto out; - RETURN(GFN_WRITEI, error); + return error; } /* --- cluster/gfs-kernel/src/gfs/file.h 2006/02/20 04:10:34 1.3 +++ cluster/gfs-kernel/src/gfs/file.h 2006/07/10 23:22:34 1.4 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/fixed_div64.h 2004/06/24 08:53:27 1.1 +++ cluster/gfs-kernel/src/gfs/fixed_div64.h 2006/07/10 23:22:34 1.2 @@ -1,5 +1,6 @@ /* * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as @@ -29,8 +30,6 @@ * * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * - * Additional munging: - * Copyright (C) 2004 Red Hat, Inc. All rights reserved. */ #ifndef __FIXED_DIV64_DOT_H__ --- cluster/gfs-kernel/src/gfs/format.h 2004/06/24 08:53:27 1.1 +++ cluster/gfs-kernel/src/gfs/format.h 2006/07/10 23:22:34 1.2 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/gfs.h 2006/01/09 22:25:06 1.9 +++ cluster/gfs-kernel/src/gfs/gfs.h 2006/07/10 23:22:34 1.10 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -16,13 +16,12 @@ #define GFS_RELEASE_NAME "" +#include #include -#include "lm_interface.h" #include "fixed_div64.h" #include "lvb.h" #include "incore.h" -#include "debug.h" #include "util.h" #ifndef TRUE @@ -85,4 +84,19 @@ #define get_gl2gl(gl) ((struct gfs_glock *)(gl)->gl_object) #define set_gl2gl(gl, gl2) (gl)->gl_object = (gl2) +#define gfs_printf(fmt, args...) \ +do { \ + if (buf) { \ + int gspf_left = size - *count, gspf_out; \ + if (gspf_left <= 0) \ + goto out; \ + gspf_out = snprintf(buf + *count, gspf_left, fmt, ##args); \ + if (gspf_out < gspf_left) \ + *count += gspf_out; \ + else \ + goto out; \ + } else \ + printk(fmt, ##args); \ +} while (0) + #endif /* __GFS_DOT_H__ */ --- cluster/gfs-kernel/src/gfs/gfs_ioctl.h 2005/01/04 10:07:11 1.10 +++ cluster/gfs-kernel/src/gfs/gfs_ioctl.h 2006/07/10 23:22:34 1.11 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/gfs_ondisk.h 2005/01/12 23:04:18 1.8 +++ cluster/gfs-kernel/src/gfs/gfs_ondisk.h 2006/07/10 23:22:34 1.9 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -466,6 +466,8 @@ #define GFS_FNAMESIZE (255) #define GFS_DIRENT_SIZE(name_len) ((sizeof(struct gfs_dirent) + (name_len) + 7) & ~7) +#define IS_LEAF (1) /* Hashed (leaf) directory */ +#define IS_DINODE (2) /* Linear (stuffed dinode block) directory */ struct gfs_dirent { struct gfs_inum de_inum; /* formal inode number and block address */ @@ -727,7 +729,6 @@ static void print_array(char *title, char *buf, int count) { - ENTER(GFN_PRINT_ARRAY) int x; printk(" %s =\n", title); @@ -738,8 +739,6 @@ } if (x % 16) printk("\n"); - - RET(GFN_PRINT_ARRAY); } /** @@ -752,13 +751,10 @@ void gfs_inum_in(struct gfs_inum *no, char *buf) { - ENTER(GFN_INUM_IN) struct gfs_inum *str = (struct gfs_inum *)buf; CPIN_64(no, str, no_formal_ino); CPIN_64(no, str, no_addr); - - RET(GFN_INUM_IN); } /** @@ -771,13 +767,10 @@ void gfs_inum_out(struct gfs_inum *no, char *buf) { - ENTER(GFN_INUM_OUT) struct gfs_inum *str = (struct gfs_inum *)buf; CPOUT_64(no, str, no_formal_ino); CPOUT_64(no, str, no_addr); - - RET(GFN_INUM_OUT); } /** @@ -789,10 +782,8 @@ void gfs_inum_print(struct gfs_inum *no) { - ENTER(GFN_INUM_PRINT) pv(no, no_formal_ino, "%"PRIu64); pv(no, no_addr, "%"PRIu64); - RET(GFN_INUM_PRINT); } /** @@ -805,7 +796,6 @@ void gfs_meta_header_in(struct gfs_meta_header *mh, char *buf) { - ENTER(GFN_META_HEADER_IN) struct gfs_meta_header *str = (struct gfs_meta_header *)buf; CPIN_32(mh, str, mh_magic); @@ -813,8 +803,6 @@ CPIN_64(mh, str, mh_generation); CPIN_32(mh, str, mh_format); CPIN_32(mh, str, mh_incarn); - - RET(GFN_META_HEADER_IN); } /** @@ -829,7 +817,6 @@ void gfs_meta_header_out(struct gfs_meta_header *mh, char *buf) { - ENTER(GFN_META_HEADER_OUT) struct gfs_meta_header *str = (struct gfs_meta_header *)buf; CPOUT_32(mh, str, mh_magic); @@ -841,8 +828,6 @@ #endif CPOUT_32(mh, str, mh_format); CPOUT_32(mh, str, mh_incarn); - - RET(GFN_META_HEADER_OUT); } /** @@ -854,15 +839,11 @@ void gfs_meta_header_print(struct gfs_meta_header *mh) { - ENTER(GFN_META_HEADER_PRINT) - pv(mh, mh_magic, "0x%.8X"); pv(mh, mh_type, "%u"); pv(mh, mh_generation, "%"PRIu64); pv(mh, mh_format, "%u"); pv(mh, mh_incarn, "%u"); - - RET(GFN_META_HEADER_PRINT); } /** @@ -875,7 +856,6 @@ void gfs_sb_in(struct gfs_sb *sb, char *buf) { - ENTER(GFN_SB_IN) struct gfs_sb *str = (struct gfs_sb *)buf; gfs_meta_header_in(&sb->sb_header, buf); @@ -899,8 +879,6 @@ gfs_inum_in(&sb->sb_license_di, (char *)&str->sb_license_di); CPIN_08(sb, str, sb_reserved, 96); - - RET(GFN_SB_IN); } /** @@ -913,7 +891,6 @@ void gfs_sb_out(struct gfs_sb *sb, char *buf) { - ENTER(GFN_SB_OUT) struct gfs_sb *str = (struct gfs_sb *)buf; gfs_meta_header_out(&sb->sb_header, buf); @@ -937,8 +914,6 @@ gfs_inum_out(&sb->sb_license_di, (char *)&str->sb_license_di); CPOUT_08(sb, str, sb_reserved, 96); - - RET(GFN_SB_OUT); } /** @@ -950,8 +925,6 @@ void gfs_sb_print(struct gfs_sb *sb) { - ENTER(GFN_SB_PRINT) - gfs_meta_header_print(&sb->sb_header); pv(sb, sb_fs_format, "%u"); @@ -973,8 +946,6 @@ gfs_inum_print(&sb->sb_license_di); pa(sb, sb_reserved, 96); - - RET(GFN_SB_PRINT); } /** @@ -987,7 +958,6 @@ void gfs_jindex_in(struct gfs_jindex *jindex, char *buf) { - ENTER(GFN_JINDEX_IN) struct gfs_jindex *str = (struct gfs_jindex *)buf; CPIN_64(jindex, str, ji_addr); @@ -995,8 +965,6 @@ CPIN_32(jindex, str, ji_pad); CPIN_08(jindex, str, ji_reserved, 64); - - RET(GFN_JINDEX_IN); } /** @@ -1009,7 +977,6 @@ void gfs_jindex_out(struct gfs_jindex *jindex, char *buf) { - ENTER(GFN_JINDEX_OUT) struct gfs_jindex *str = (struct gfs_jindex *)buf; CPOUT_64(jindex, str, ji_addr); @@ -1017,8 +984,6 @@ CPOUT_32(jindex, str, ji_pad); CPOUT_08(jindex, str, ji_reserved, 64); - - RET(GFN_JINDEX_OUT); } /** @@ -1030,15 +995,11 @@ void gfs_jindex_print(struct gfs_jindex *ji) { - ENTER(GFN_JINDEX_PRINT) - pv(ji, ji_addr, "%"PRIu64); pv(ji, ji_nsegment, "%u"); pv(ji, ji_pad, "%u"); pa(ji, ji_reserved, 64); - - RET(GFN_JINDEX_PRINT); } /** @@ -1051,7 +1012,6 @@ void gfs_rindex_in(struct gfs_rindex *rindex, char *buf) { - ENTER(GFN_RINDEX_IN) struct gfs_rindex *str = (struct gfs_rindex *)buf; CPIN_64(rindex, str, ri_addr); @@ -1064,8 +1024,6 @@ CPIN_32(rindex, str, ri_bitbytes); CPIN_08(rindex, str, ri_reserved, 64); - - RET(GFN_RINDEX_IN); } /** @@ -1078,7 +1036,6 @@ void gfs_rindex_out(struct gfs_rindex *rindex, char *buf) { - ENTER(GFN_RINDEX_OUT) struct gfs_rindex *str = (struct gfs_rindex *)buf; CPOUT_64(rindex, str, ri_addr); @@ -1091,8 +1048,6 @@ CPOUT_32(rindex, str, ri_bitbytes); CPOUT_08(rindex, str, ri_reserved, 64); - - RET(GFN_RINDEX_OUT); } /** @@ -1104,8 +1059,6 @@ void gfs_rindex_print(struct gfs_rindex *ri) { - ENTER(GFN_RINDEX_PRINT) - pv(ri, ri_addr, "%"PRIu64); pv(ri, ri_length, "%u"); pv(ri, ri_pad, "%u"); @@ -1116,8 +1069,6 @@ pv(ri, ri_bitbytes, "%u"); pa(ri, ri_reserved, 64); - - RET(GFN_RINDEX_PRINT); } /** @@ -1130,7 +1081,6 @@ void gfs_rgrp_in(struct gfs_rgrp *rgrp, char *buf) { - ENTER(GFN_RGRP_IN) struct gfs_rgrp *str = (struct gfs_rgrp *)buf; gfs_meta_header_in(&rgrp->rg_header, buf); @@ -1147,8 +1097,6 @@ CPIN_32(rgrp, str, rg_freemeta); CPIN_08(rgrp, str, rg_reserved, 64); - - RET(GFN_RGRP_IN); } /** @@ -1161,7 +1109,6 @@ void gfs_rgrp_out(struct gfs_rgrp *rgrp, char *buf) { - ENTER(GFN_RGRP_OUT) struct gfs_rgrp *str = (struct gfs_rgrp *)buf; gfs_meta_header_out(&rgrp->rg_header, buf); @@ -1178,8 +1125,6 @@ CPOUT_32(rgrp, str, rg_freemeta); CPOUT_08(rgrp, str, rg_reserved, 64); - - RET(GFN_RGRP_OUT); } /** @@ -1191,8 +1136,6 @@ void gfs_rgrp_print(struct gfs_rgrp *rg) { - ENTER(GFN_RGRP_PRINT) - gfs_meta_header_print(&rg->rg_header); pv(rg, rg_flags, "%u"); @@ -1207,8 +1150,6 @@ pv(rg, rg_freemeta, "%u"); pa(rg, rg_reserved, 64); - - RET(GFN_RGRP_PRINT); } /** @@ -1221,7 +1162,6 @@ void gfs_quota_in(struct gfs_quota *quota, char *buf) { - ENTER(GFN_QUOTA_IN) struct gfs_quota *str = (struct gfs_quota *)buf; CPIN_64(quota, str, qu_limit); @@ -1229,8 +1169,6 @@ CPIN_64(quota, str, qu_value); CPIN_08(quota, str, qu_reserved, 64); - - RET(GFN_QUOTA_IN); } /** @@ -1243,7 +1181,6 @@ void gfs_quota_out(struct gfs_quota *quota, char *buf) { - ENTER(GFN_QUOTA_OUT) struct gfs_quota *str = (struct gfs_quota *)buf; CPOUT_64(quota, str, qu_limit); @@ -1251,8 +1188,6 @@ CPOUT_64(quota, str, qu_value); CPOUT_08(quota, str, qu_reserved, 64); - - RET(GFN_QUOTA_OUT); } /** @@ -1264,15 +1199,11 @@ void gfs_quota_print(struct gfs_quota *quota) { - ENTER(GFN_QUOTA_PRINT) - pv(quota, qu_limit, "%"PRIu64); pv(quota, qu_warn, "%"PRIu64); pv(quota, qu_value, "%"PRId64); pa(quota, qu_reserved, 64); - - RET(GFN_QUOTA_PRINT); } /** @@ -1285,7 +1216,6 @@ void gfs_dinode_in(struct gfs_dinode *dinode, char *buf) { - ENTER(GFN_DINODE_IN) struct gfs_dinode *str = (struct gfs_dinode *)buf; gfs_meta_header_in(&dinode->di_header, buf); @@ -1323,8 +1253,6 @@ CPIN_64(dinode, str, di_eattr); CPIN_08(dinode, str, di_reserved, 56); - - RET(GFN_DINODE_IN); } /** @@ -1337,7 +1265,6 @@ void gfs_dinode_out(struct gfs_dinode *dinode, char *buf) { - ENTER(GFN_DINODE_OUT) struct gfs_dinode *str = (struct gfs_dinode *)buf; gfs_meta_header_out(&dinode->di_header, buf); @@ -1375,8 +1302,6 @@ CPOUT_64(dinode, str, di_eattr); CPOUT_08(dinode, str, di_reserved, 56); - - RET(GFN_DINODE_OUT); } /** @@ -1388,8 +1313,6 @@ void gfs_dinode_print(struct gfs_dinode *di) { - ENTER(GFN_DINODE_PRINT) - gfs_meta_header_print(&di->di_header); gfs_inum_print(&di->di_num); @@ -1425,8 +1348,6 @@ pv(di, di_eattr, "%"PRIu64); pa(di, di_reserved, 56); - - RET(GFN_DINODE_PRINT); } /** @@ -1439,14 +1360,11 @@ void gfs_indirect_in(struct gfs_indirect *indirect, char *buf) { - ENTER(GFN_INDIRECT_IN) struct gfs_indirect *str = (struct gfs_indirect *)buf; gfs_meta_header_in(&indirect->in_header, buf); CPIN_08(indirect, str, in_reserved, 64); - - RET(GFN_INDIRECT_IN); } /** @@ -1459,14 +1377,11 @@ void gfs_indirect_out(struct gfs_indirect *indirect, char *buf) { - ENTER(GFN_INDIRECT_OUT) struct gfs_indirect *str = (struct gfs_indirect *)buf; gfs_meta_header_out(&indirect->in_header, buf); CPOUT_08(indirect, str, in_reserved, 64); - - RET(GFN_INDIRECT_OUT); } /** @@ -1478,13 +1393,9 @@ void gfs_indirect_print(struct gfs_indirect *indirect) { - ENTER(GFN_INDIRECT_PRINT) - gfs_meta_header_print(&indirect->in_header); pa(indirect, in_reserved, 64); - - RET(GFN_INDIRECT_PRINT); } /** @@ -1497,7 +1408,6 @@ void gfs_dirent_in(struct gfs_dirent *dirent, char *buf) { - ENTER(GFN_DIRENT_IN) struct gfs_dirent *str = (struct gfs_dirent *)buf; gfs_inum_in(&dirent->de_inum, (char *)&str->de_inum); @@ -1507,8 +1417,6 @@ CPIN_16(dirent, str, de_type); CPIN_08(dirent, str, de_reserved, 14); - - RET(GFN_DIRENT_IN); } /** @@ -1521,7 +1429,6 @@ void gfs_dirent_out(struct gfs_dirent *dirent, char *buf) { - ENTER(GFN_DIRENT_OUT) struct gfs_dirent *str = (struct gfs_dirent *)buf; gfs_inum_out(&dirent->de_inum, (char *)&str->de_inum); @@ -1531,8 +1438,6 @@ CPOUT_16(dirent, str, de_type); CPOUT_08(dirent, str, de_reserved, 14); - - RET(GFN_DIRENT_OUT); } /** @@ -1545,7 +1450,6 @@ void gfs_dirent_print(struct gfs_dirent *de, char *name) { - ENTER(GFN_DIRENT_PRINT) char buf[GFS_FNAMESIZE + 1]; gfs_inum_print(&de->de_inum); @@ -1559,8 +1463,6 @@ memset(buf, 0, GFS_FNAMESIZE + 1); memcpy(buf, name, de->de_name_len); printk(" name = %s\n", buf); - - RET(GFN_DIRENT_PRINT); } /** @@ -1573,7 +1475,6 @@ void gfs_leaf_in(struct gfs_leaf *leaf, char *buf) { - ENTER(GFN_LEAF_IN) struct gfs_leaf *str = (struct gfs_leaf *)buf; gfs_meta_header_in(&leaf->lf_header, buf); @@ -1584,8 +1485,6 @@ CPIN_64(leaf, str, lf_next); CPIN_08(leaf, str, lf_reserved, 64); - - RET(GFN_LEAF_IN); } /** @@ -1598,7 +1497,6 @@ void gfs_leaf_out(struct gfs_leaf *leaf, char *buf) { - ENTER(GFN_LEAF_OUT) struct gfs_leaf *str = (struct gfs_leaf *)buf; gfs_meta_header_out(&leaf->lf_header, buf); @@ -1609,8 +1507,6 @@ CPOUT_64(leaf, str, lf_next); CPOUT_08(leaf, str, lf_reserved, 64); - - RET(GFN_LEAF_OUT); } /** @@ -1622,8 +1518,6 @@ void gfs_leaf_print(struct gfs_leaf *lf) { - ENTER(GFN_LEAF_PRINT) - gfs_meta_header_print(&lf->lf_header); pv(lf, lf_depth, "%u"); @@ -1632,8 +1526,6 @@ pv(lf, lf_next, "%"PRIu64); pa(lf, lf_reserved, 64); - - RET(GFN_LEAF_PRINT); } /** @@ -1646,7 +1538,6 @@ void gfs_log_header_in(struct gfs_log_header *head, char *buf) { - ENTER(GFN_LOG_HEADER_IN) struct gfs_log_header *str = (struct gfs_log_header *)buf; gfs_meta_header_in(&head->lh_header, buf); @@ -1661,8 +1552,6 @@ CPIN_64(head, str, lh_last_dump); CPIN_08(head, str, lh_reserved, 64); - - RET(GFN_LOG_HEADER_IN); } /** @@ -1675,7 +1564,6 @@ void gfs_log_header_out(struct gfs_log_header *head, char *buf) { - ENTER(GFN_LOG_HEADER_OUT) struct gfs_log_header *str = (struct gfs_log_header *)buf; gfs_meta_header_out(&head->lh_header, buf); @@ -1690,8 +1578,6 @@ CPOUT_64(head, str, lh_last_dump); CPOUT_08(head, str, lh_reserved, 64); - - RET(GFN_LOG_HEADER_OUT); } /** @@ -1703,8 +1589,6 @@ void gfs_log_header_print(struct gfs_log_header *lh) { - ENTER(GFN_LOG_HEADER_PRINT) - gfs_meta_header_print(&lh->lh_header); pv(lh, lh_flags, "0x%.8X"); @@ -1717,8 +1601,6 @@ pv(lh, lh_last_dump, "%"PRIu64); pa(lh, lh_reserved, 64); - - RET(GFN_LOG_HEADER_PRINT); } /** @@ -1731,7 +1613,6 @@ void gfs_desc_in(struct gfs_log_descriptor *desc, char *buf) { - ENTER(GFN_DESC_IN) struct gfs_log_descriptor *str = (struct gfs_log_descriptor *)buf; gfs_meta_header_in(&desc->ld_header, buf); @@ -1742,8 +1623,6 @@ CPIN_32(desc, str, ld_data2); CPIN_08(desc, str, ld_reserved, 64); - - RET(GFN_DESC_IN); } /** @@ -1756,7 +1635,6 @@ void gfs_desc_out(struct gfs_log_descriptor *desc, char *buf) { - ENTER(GFN_DESC_OUT) struct gfs_log_descriptor *str = (struct gfs_log_descriptor *)buf; gfs_meta_header_out(&desc->ld_header, buf); @@ -1767,8 +1645,6 @@ CPOUT_32(desc, str, ld_data2); CPOUT_08(desc, str, ld_reserved, 64); - - RET(GFN_DESC_OUT); } /** @@ -1780,8 +1656,6 @@ void gfs_desc_print(struct gfs_log_descriptor *ld) { - ENTER(GFN_DESC_PRINT) - gfs_meta_header_print(&ld->ld_header); pv(ld, ld_type, "%u"); @@ -1790,8 +1664,6 @@ pv(ld, ld_data2, "%u"); pa(ld, ld_reserved, 64); - - RET(GFN_DESC_PRINT); } /** @@ -1804,14 +1676,11 @@ void gfs_block_tag_in(struct gfs_block_tag *tag, char *buf) { - ENTER(GFN_BLOCK_TAG_IN) struct gfs_block_tag *str = (struct gfs_block_tag *)buf; CPIN_64(tag, str, bt_blkno); CPIN_32(tag, str, bt_flags); CPIN_32(tag, str, bt_pad); - - RET(GFN_BLOCK_TAG_IN); } /** @@ -1824,14 +1693,11 @@ void gfs_block_tag_out(struct gfs_block_tag *tag, char *buf) { - ENTER(GFN_BLOCK_TAG_OUT) struct gfs_block_tag *str = (struct gfs_block_tag *)buf; CPOUT_64(tag, str, bt_blkno); CPOUT_32(tag, str, bt_flags); CPOUT_32(tag, str, bt_pad); - - RET(GFN_BLOCK_TAG_OUT); } /** @@ -1843,13 +1709,9 @@ void gfs_block_tag_print(struct gfs_block_tag *tag) { - ENTER(GFN_BLOCK_TAG_PRINT) - pv(tag, bt_blkno, "%"PRIu64); pv(tag, bt_flags, "%u"); pv(tag, bt_pad, "%u"); - - RET(GFN_BLOCK_TAG_PRINT); } /** @@ -1862,14 +1724,11 @@ void gfs_quota_tag_in(struct gfs_quota_tag *tag, char *buf) { - ENTER(GFN_QUOTA_TAG_IN) struct gfs_quota_tag *str = (struct gfs_quota_tag *)buf; CPIN_64(tag, str, qt_change); CPIN_32(tag, str, qt_flags); CPIN_32(tag, str, qt_id); - - RET(GFN_QUOTA_TAG_IN); } /** @@ -1882,14 +1741,11 @@ void gfs_quota_tag_out(struct gfs_quota_tag *tag, char *buf) { - ENTER(GFN_QUOTA_TAG_OUT) struct gfs_quota_tag *str = (struct gfs_quota_tag *)buf; CPOUT_64(tag, str, qt_change); CPOUT_32(tag, str, qt_flags); CPOUT_32(tag, str, qt_id); - - RET(GFN_QUOTA_TAG_OUT); } /** @@ -1901,13 +1757,9 @@ void gfs_quota_tag_print(struct gfs_quota_tag *tag) { - ENTER(GFN_QUOTA_TAG_PRINT) - pv(tag, qt_change, "%"PRId64); pv(tag, qt_flags, "0x%.8X"); pv(tag, qt_id, "%u"); - - RET(GFN_QUOTA_TAG_PRINT); } /** @@ -1920,7 +1772,6 @@ void gfs_ea_header_in(struct gfs_ea_header *ea, char *buf) { - ENTER(GFN_EA_HEADER_IN) struct gfs_ea_header *str = (struct gfs_ea_header *)buf; CPIN_32(ea, str, ea_rec_len); @@ -1930,8 +1781,6 @@ ea->ea_flags = str->ea_flags; ea->ea_num_ptrs = str->ea_num_ptrs; CPIN_32(ea, str, ea_pad); - - RET(GFN_EA_HEADER_IN); } /** @@ -1944,7 +1793,6 @@ void gfs_ea_header_out(struct gfs_ea_header *ea, char *buf) { - ENTER(GFN_EA_HEADER_OUT) struct gfs_ea_header *str = (struct gfs_ea_header *)buf; CPOUT_32(ea, str, ea_rec_len); @@ -1954,8 +1802,6 @@ str->ea_flags = ea->ea_flags; str->ea_num_ptrs = ea->ea_num_ptrs; CPOUT_32(ea, str, ea_pad); - - RET(GFN_EA_HEADER_OUT); } /** @@ -1967,7 +1813,6 @@ void gfs_ea_header_print(struct gfs_ea_header *ea, char *name) { - ENTER(GFN_EA_HEADER_PRINT) char buf[GFS_EA_MAX_NAME_LEN + 1]; pv(ea, ea_rec_len, "%u"); @@ -1981,8 +1826,6 @@ memset(buf, 0, GFS_EA_MAX_NAME_LEN + 1); memcpy(buf, name, ea->ea_name_len); printk(" name = %s\n", buf); - - RET(GFN_EA_HEADER_PRINT); } static const uint32_t crc_32_tab[] = @@ -2041,7 +1884,6 @@ uint32_t gfs_dir_hash(const char *data, int len) { - ENTER(GFN_DIR_HASH) uint32_t hash = 0xFFFFFFFF; for (; len--; data++) @@ -2049,7 +1891,7 @@ hash = ~hash; - RETURN(GFN_DIR_HASH, hash); + return hash; } #endif /* WANT_GFS_CONVERSION_FUNCTIONS */ --- cluster/gfs-kernel/src/gfs/glock.c 2006/05/17 15:27:21 1.26 +++ cluster/gfs-kernel/src/gfs/glock.c 2006/07/10 23:22:34 1.27 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -21,6 +21,7 @@ #include #include "gfs.h" +#include "lm_interface.h" #include "dio.h" #include "glock.h" #include "glops.h" @@ -93,14 +94,13 @@ static unsigned int gl_hash(struct lm_lockname *name) { - ENTER(GFN_GL_HASH) unsigned int h; h = gfs_hash(&name->ln_number, sizeof(uint64_t)); h = gfs_hash_more(&name->ln_type, sizeof(unsigned int), h); h &= GFS_GL_HASH_MASK; - RETURN(GFN_GL_HASH, h); + return h; } /** @@ -160,7 +160,6 @@ static struct gfs_glock * search_bucket(struct gfs_gl_hash_bucket *bucket, struct lm_lockname *name) { - ENTER(GFN_SEARCH_BUCKET) struct list_head *tmp, *head; struct gfs_glock *gl; @@ -176,10 +175,10 @@ atomic_inc(&gl->gl_count); - RETURN(GFN_SEARCH_BUCKET, gl); + return gl; } - RETURN(GFN_SEARCH_BUCKET, NULL); + return NULL; } /** @@ -196,7 +195,6 @@ struct gfs_glock * gfs_glock_find(struct gfs_sbd *sdp, struct lm_lockname *name) { - ENTER(GFN_GLOCK_FIND) struct gfs_gl_hash_bucket *bucket = &sdp->sd_gl_hash[gl_hash(name)]; struct gfs_glock *gl; @@ -204,7 +202,7 @@ gl = search_bucket(bucket, name); read_unlock(&bucket->hb_lock); - RETURN(GFN_GLOCK_FIND, gl); + return gl; } /** @@ -218,7 +216,6 @@ static void glock_free(struct gfs_glock *gl) { - ENTER(GFN_GLOCK_FREE) struct gfs_sbd *sdp = gl->gl_sbd; struct inode *aspace = gl->gl_aspace; @@ -241,8 +238,6 @@ kmem_cache_free(gfs_glock_cachep, gl); atomic_dec(&sdp->sd_glock_count); - - RET(GFN_GLOCK_FREE); } /** @@ -263,7 +258,6 @@ uint64_t number, struct gfs_glock_operations *glops, int create, struct gfs_glock **glp) { - ENTER(GFN_GLOCK_GET) struct lm_lockname name; struct gfs_glock *gl, *tmp; struct gfs_gl_hash_bucket *bucket; @@ -280,13 +274,13 @@ if (gl || !create) { *glp = gl; - RETURN(GFN_GLOCK_GET, 0); + return 0; } /* None found; create a new one */ gl = kmem_cache_alloc(gfs_glock_cachep, GFP_KERNEL); if (!gl) - RETURN(GFN_GLOCK_GET, -ENOMEM); + return -ENOMEM; memset(gl, 0, sizeof(struct gfs_glock)); @@ -351,7 +345,7 @@ *glp = gl; - RETURN(GFN_GLOCK_GET, 0); + return 0; fail_aspace: if (gl->gl_aspace) @@ -360,7 +354,7 @@ fail: kmem_cache_free(gfs_glock_cachep, gl); - RETURN(GFN_GLOCK_GET, error); + return error; } /** @@ -372,9 +366,7 @@ void gfs_glock_hold(struct gfs_glock *gl) { - ENTER(GFN_GLOCK_HOLD) glock_hold(gl); - RET(GFN_GLOCK_HOLD); } /** @@ -386,9 +378,7 @@ void gfs_glock_put(struct gfs_glock *gl) { - ENTER(GFN_GLOCK_PUT) glock_put(gl); - RET(GFN_GLOCK_PUT); } /** @@ -404,8 +394,6 @@ gfs_holder_init(struct gfs_glock *gl, unsigned int state, int flags, struct gfs_holder *gh) { - ENTER(GFN_HOLDER_INIT) - memset(gh, 0, sizeof(struct gfs_holder)); INIT_LIST_HEAD(&gh->gh_list); @@ -420,8 +408,6 @@ init_completion(&gh->gh_wait); glock_hold(gl); - - RET(GFN_HOLDER_INIT); } /** @@ -444,7 +430,6 @@ void gfs_holder_reinit(unsigned int state, int flags, struct gfs_holder *gh) { - ENTER(GFN_HOLDER_REINIT) int alloced; gfs_assert_warn(gh->gh_gl->gl_sbd, @@ -460,8 +445,6 @@ memset(&gh->gh_iflags, 0, sizeof(unsigned long)); if (alloced) set_bit(HIF_ALLOCED, &gh->gh_iflags); - - RET(GFN_HOLDER_REINIT); } /** @@ -473,15 +456,12 @@ void gfs_holder_uninit(struct gfs_holder *gh) { - ENTER(GFN_HOLDER_UNINIT) struct gfs_glock *gl = gh->gh_gl; gfs_assert_warn(gl->gl_sbd, list_empty(&gh->gh_list)); gh->gh_gl = NULL; glock_put(gl); - - RET(GFN_HOLDER_UNINIT); } /** @@ -500,17 +480,16 @@ struct gfs_holder * gfs_holder_get(struct gfs_glock *gl, unsigned int state, int flags) { - ENTER(GFN_HOLDER_GET) struct gfs_holder *gh; gh = kmalloc(sizeof(struct gfs_holder), GFP_KERNEL); if (!gh) - RETURN(GFN_HOLDER_GET, NULL); + return NULL; gfs_holder_init(gl, state, flags, gh); set_bit(HIF_ALLOCED, &gh->gh_iflags); - RETURN(GFN_HOLDER_GET, gh); + return gh; } /** @@ -522,15 +501,11 @@ void gfs_holder_put(struct gfs_holder *gh) { - ENTER(GFN_HOLDER_PUT) - if (gfs_assert_warn(gh->gh_gl->gl_sbd, test_bit(HIF_ALLOCED, &gh->gh_iflags))) - RET(GFN_HOLDER_PUT); + return; gfs_holder_uninit(gh); kfree(gh); - - RET(GFN_HOLDER_PUT); } /** @@ -542,7 +517,6 @@ static void handle_recurse(struct gfs_holder *gh) { - ENTER(GFN_HANDLE_RECURSE) struct gfs_glock *gl = gh->gh_gl; struct gfs_sbd *sdp = gl->gl_sbd; struct list_head *tmp, *head, *next; @@ -550,7 +524,7 @@ int found = FALSE; if (gfs_assert_warn(sdp, gh->gh_owner)) - RET(GFN_HANDLE_RECURSE); + return; for (head = &gl->gl_waiters3, tmp = head->next, next = tmp->next; tmp != head; @@ -571,8 +545,6 @@ } gfs_assert_warn(sdp, found); - - RET(GFN_HANDLE_RECURSE); } /** @@ -588,7 +560,6 @@ static void do_unrecurse(struct gfs_holder *gh) { - ENTER(GFN_DO_UNRECURSE) struct gfs_glock *gl = gh->gh_gl; struct gfs_sbd *sdp = gl->gl_sbd; struct list_head *tmp, *head; @@ -596,7 +567,7 @@ int found = FALSE; if (gfs_assert_warn(sdp, gh->gh_owner)) - RET(GFN_DO_UNRECURSE); + return; for (head = &gl->gl_waiters3, tmp = head->next; tmp != head; @@ -609,7 +580,7 @@ /* found more than one */ if (found) - RET(GFN_DO_UNRECURSE); + return; found = TRUE; last_gh = tmp_gh; @@ -618,8 +589,6 @@ /* found just one */ if (!gfs_assert_warn(sdp, found)) clear_bit(HIF_RECURSE, &last_gh->gh_iflags); - - RET(GFN_DO_UNRECURSE); } /** @@ -635,7 +604,6 @@ static int rq_mutex(struct gfs_holder *gh) { - ENTER(GFN_RQ_MUTEX) struct gfs_glock *gl = gh->gh_gl; list_del_init(&gh->gh_list); @@ -643,7 +611,7 @@ set_bit(GLF_LOCK, &gl->gl_flags); complete(&gh->gh_wait); - RETURN(GFN_RQ_MUTEX, TRUE); + return TRUE; } /** @@ -658,7 +626,6 @@ static int rq_promote(struct gfs_holder *gh) { - ENTER(GFN_RQ_PROMOTE) struct gfs_glock *gl = gh->gh_gl; struct gfs_sbd *sdp = gl->gl_sbd; struct gfs_glock_operations *glops = gl->gl_ops; @@ -684,7 +651,7 @@ spin_lock(&gl->gl_spin); } - RETURN(GFN_RQ_PROMOTE, TRUE); + return TRUE; } if (list_empty(&gl->gl_holders)) { @@ -694,10 +661,10 @@ } else { struct gfs_holder *next_gh; if (gh->gh_flags & GL_LOCAL_EXCL) - RETURN(GFN_RQ_PROMOTE, TRUE); + return TRUE; next_gh = list_entry(gl->gl_holders.next, struct gfs_holder, gh_list); if (next_gh->gh_flags & GL_LOCAL_EXCL) - RETURN(GFN_RQ_PROMOTE, TRUE); + return TRUE; recurse = test_bit(HIF_RECURSE, &gh->gh_iflags); } @@ -710,7 +677,7 @@ complete(&gh->gh_wait); - RETURN(GFN_RQ_PROMOTE, FALSE); + return FALSE; } /** @@ -737,12 +704,11 @@ static int rq_demote(struct gfs_holder *gh) { - ENTER(GFN_RQ_DEMOTE) struct gfs_glock *gl = gh->gh_gl; struct gfs_glock_operations *glops = gl->gl_ops; if (!list_empty(&gl->gl_holders)) - RETURN(GFN_RQ_DEMOTE, TRUE); + return TRUE; if (gl->gl_state == gh->gh_state || gl->gl_state == LM_ST_UNLOCKED) { list_del_init(&gh->gh_list); @@ -769,7 +735,7 @@ spin_lock(&gl->gl_spin); } - RETURN(GFN_RQ_DEMOTE, FALSE); + return FALSE; } /** @@ -782,7 +748,6 @@ static int rq_greedy(struct gfs_holder *gh) { - ENTER(GFN_RQ_GREEDY) struct gfs_glock *gl = gh->gh_gl; list_del_init(&gh->gh_list); @@ -795,7 +760,7 @@ spin_lock(&gl->gl_spin); - RETURN(GFN_RQ_GREEDY, FALSE); + return FALSE; } /** @@ -809,7 +774,6 @@ static void run_queue(struct gfs_glock *gl) { - ENTER(GFN_RUN_QUEUE) struct gfs_holder *gh; int blocked = TRUE; @@ -858,8 +822,6 @@ if (blocked) break; } - - RET(GFN_RUN_QUEUE); } /** @@ -876,7 +838,6 @@ static void lock_on_glock(struct gfs_glock *gl) { - ENTER(GFN_LOCK_ON_GLOCK) struct gfs_holder gh; gfs_holder_init(gl, 0, 0, &gh); @@ -891,8 +852,6 @@ wait_for_completion(&gh.gh_wait); gfs_holder_uninit(&gh); - - RET(GFN_LOCK_ON_GLOCK); } /** @@ -910,7 +869,6 @@ static int trylock_on_glock(struct gfs_glock *gl) { - ENTER(GFN_TRYLOCK_ON_GLOCK) int acquired = TRUE; spin_lock(&gl->gl_spin); @@ -918,7 +876,7 @@ acquired = FALSE; spin_unlock(&gl->gl_spin); - RETURN(GFN_TRYLOCK_ON_GLOCK, acquired); + return acquired; } /** @@ -932,14 +890,10 @@ static void unlock_on_glock(struct gfs_glock *gl) { - ENTER(GFN_UNLOCK_ON_GLOCK) - spin_lock(&gl->gl_spin); clear_bit(GLF_LOCK, &gl->gl_flags); run_queue(gl); spin_unlock(&gl->gl_spin); - - RET(GFN_UNLOCK_ON_GLOCK); } /** @@ -967,12 +921,11 @@ static void handle_callback(struct gfs_glock *gl, unsigned int state) { - ENTER(GFN_HANDLE_CALLBACK) struct list_head *tmp, *head; struct gfs_holder *gh, *new_gh = NULL; if (gfs_assert_warn(gl->gl_sbd, state != LM_ST_EXCLUSIVE)) - RET(GFN_HANDLE_CALLBACK); + return; restart: spin_lock(&gl->gl_spin); @@ -1016,8 +969,6 @@ if (new_gh) gfs_holder_put(new_gh); - - RET(GFN_HANDLE_CALLBACK); } /** @@ -1030,7 +981,6 @@ static void state_change(struct gfs_glock *gl, unsigned int new_state) { - ENTER(GFN_STATE_CHANGE) struct gfs_sbd *sdp = gl->gl_sbd; int held1, held2; @@ -1048,8 +998,6 @@ } gl->gl_state = new_state; - - RET(GFN_STATE_CHANGE); } /** @@ -1062,7 +1010,6 @@ static void xmote_bh(struct gfs_glock *gl, unsigned int ret) { - ENTER(GFN_XMOTE_BH) struct gfs_sbd *sdp = gl->gl_sbd; struct gfs_glock_operations *glops = gl->gl_ops; struct gfs_holder *gh = gl->gl_req_gh; @@ -1169,8 +1116,6 @@ else complete(&gh->gh_wait); } - - RET(GFN_XMOTE_BH); } /** @@ -1188,7 +1133,6 @@ void gfs_glock_xmote_th(struct gfs_glock *gl, unsigned int state, int flags) { - ENTER(GFN_GLOCK_XMOTE_TH) struct gfs_sbd *sdp = gl->gl_sbd; struct gfs_glock_operations *glops = gl->gl_ops; int lck_flags = flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB | @@ -1224,7 +1168,7 @@ else xmote_bh(gl, lck_ret); out: - RET(GFN_GLOCK_XMOTE_TH); + return; } /** @@ -1240,7 +1184,6 @@ static void drop_bh(struct gfs_glock *gl, unsigned int ret) { - ENTER(GFN_DROP_BH) struct gfs_sbd *sdp = gl->gl_sbd; struct gfs_glock_operations *glops = gl->gl_ops; struct gfs_holder *gh = gl->gl_req_gh; @@ -1281,8 +1224,6 @@ else complete(&gh->gh_wait); } - - RET(GFN_DROP_BH); } /** @@ -1294,7 +1235,6 @@ void gfs_glock_drop_th(struct gfs_glock *gl) { - ENTER(GFN_GLOCK_DROP_TH) struct gfs_sbd *sdp = gl->gl_sbd; struct gfs_glock_operations *glops = gl->gl_ops; unsigned int ret; @@ -1324,7 +1264,7 @@ else gfs_assert_warn(sdp, ret == LM_OUT_ASYNC); out: - RET(GFN_GLOCK_DROP_TH); + return; } /** @@ -1337,7 +1277,6 @@ static void do_cancels(struct gfs_holder *gh) { - ENTER(GFN_DO_CANCELS) struct gfs_glock *gl = gh->gh_gl; spin_lock(&gl->gl_spin); @@ -1362,8 +1301,6 @@ } spin_unlock(&gl->gl_spin); - - RET(GFN_DO_CANCELS); } /** @@ -1376,14 +1313,13 @@ static int glock_wait_internal(struct gfs_holder *gh) { - ENTER(GFN_GLOCK_WAIT_INTERNAL) struct gfs_glock *gl = gh->gh_gl; struct gfs_sbd *sdp = gl->gl_sbd; struct gfs_glock_operations *glops = gl->gl_ops; int error = 0; if (test_bit(HIF_ABORTED, &gh->gh_iflags)) - RETURN(GFN_GLOCK_WAIT_INTERNAL, -EIO); + return -EIO; if (gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB)) { spin_lock(&gl->gl_spin); @@ -1396,7 +1332,7 @@ do_unrecurse(gh); run_queue(gl); spin_unlock(&gl->gl_spin); - RETURN(GFN_GLOCK_WAIT_INTERNAL, GLR_TRYFAILED); + return GLR_TRYFAILED; } spin_unlock(&gl->gl_spin); } @@ -1407,7 +1343,7 @@ wait_for_completion(&gh->gh_wait); if (gh->gh_error) - RETURN(GFN_GLOCK_WAIT_INTERNAL, gh->gh_error); + return gh->gh_error; gfs_assert_withdraw(sdp, test_bit(HIF_HOLDER, &gh->gh_iflags)); gfs_assert_withdraw(sdp, relaxed_state_ok(gl->gl_state, @@ -1439,7 +1375,7 @@ spin_unlock(&gl->gl_spin); } - RETURN(GFN_GLOCK_WAIT_INTERNAL, error); + return error; } /** @@ -1464,7 +1400,6 @@ static void add_to_queue(struct gfs_holder *gh) { - ENTER(GFN_ADD_TO_QUEUE) struct gfs_glock *gl = gh->gh_gl; struct gfs_sbd *sdp = gl->gl_sbd; struct list_head *tmp, *head; @@ -1496,7 +1431,7 @@ gh->gh_error = 0; complete(&gh->gh_wait); - RET(GFN_ADD_TO_QUEUE); + return; } } @@ -1526,7 +1461,7 @@ list_add_tail(&gh->gh_list, &gl->gl_waiters3); - RET(GFN_ADD_TO_QUEUE); + return; } } } @@ -1538,12 +1473,10 @@ else list_add_tail(&gh->gh_list, &gl->gl_waiters3); - RET(GFN_ADD_TO_QUEUE); + return; fail: set_bit(HIF_ABORTED, &gh->gh_iflags); - - RET(GFN_ADD_TO_QUEUE); } /** @@ -1563,7 +1496,6 @@ int gfs_glock_nq(struct gfs_holder *gh) { - ENTER(GFN_GLOCK_NQ) struct gfs_glock *gl = gh->gh_gl; struct gfs_sbd *sdp = gl->gl_sbd; int error = 0; @@ -1577,7 +1509,7 @@ gfs_assert_warn(sdp, (gh->gh_flags & (LM_FLAG_ANY | GL_EXACT)) != (LM_FLAG_ANY | GL_EXACT))) { set_bit(HIF_ABORTED, &gh->gh_iflags); - RETURN(GFN_GLOCK_NQ, -EIO); + return -EIO; } set_bit(HIF_PROMOTE, &gh->gh_iflags); @@ -1598,7 +1530,7 @@ clear_bit(GLF_PREFETCH, &gl->gl_flags); - RETURN(GFN_GLOCK_NQ, error); + return error; } /** @@ -1611,7 +1543,6 @@ int gfs_glock_poll(struct gfs_holder *gh) { - ENTER(GFN_GLOCK_POLL) struct gfs_glock *gl = gh->gh_gl; int ready = FALSE; @@ -1627,15 +1558,15 @@ set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(HZ); if (gfs_glock_nq(gh)) - RETURN(GFN_GLOCK_POLL, TRUE); - RETURN(GFN_GLOCK_POLL, FALSE); + return TRUE; + return FALSE; } else ready = TRUE; } spin_unlock(&gl->gl_spin); - RETURN(GFN_GLOCK_POLL, ready); + return ready; } /** @@ -1648,7 +1579,6 @@ int gfs_glock_wait(struct gfs_holder *gh) { - ENTER(GFN_GLOCK_WAIT) struct gfs_glock *gl = gh->gh_gl; int error; @@ -1662,7 +1592,7 @@ error = gfs_glock_nq(gh); } - RETURN(GFN_GLOCK_WAIT, error); + return error; } /** @@ -1685,13 +1615,12 @@ void gfs_glock_dq(struct gfs_holder *gh) { - ENTER(GFN_GLOCK_DQ) struct gfs_glock *gl = gh->gh_gl; struct gfs_sbd *sdp = gl->gl_sbd; struct gfs_glock_operations *glops = gl->gl_ops; struct list_head *pos; - struct gfs_holder *tmp_gh = NULL; - int count = 0; + struct gfs_holder *tmp_gh = NULL; + int count = 0; atomic_inc(&gl->gl_sbd->sd_glock_dq_calls); @@ -1702,14 +1631,14 @@ set_bit(GLF_SYNC, &gl->gl_flags); /* Don't cache glock; request demote to unlock at inter-node scope */ - if (gh->gh_flags & GL_NOCACHE){ - list_for_each(pos, &gl->gl_holders) { - tmp_gh = list_entry(pos, struct gfs_holder, gh_list); - ++count; - } - if (tmp_gh == gh && count == 1) - handle_callback(gl, LM_ST_UNLOCKED); - } + if (gh->gh_flags & GL_NOCACHE) { + list_for_each(pos, &gl->gl_holders) { + tmp_gh = list_entry(pos, struct gfs_holder, gh_list); + ++count; + } + if (tmp_gh == gh && count == 1) + handle_callback(gl, LM_ST_UNLOCKED); + } lock_on_glock(gl); @@ -1740,8 +1669,6 @@ clear_bit(GLF_LOCK, &gl->gl_flags); run_queue(gl); spin_unlock(&gl->gl_spin); - - RET(GFN_GLOCK_DQ); } /** @@ -1766,14 +1693,13 @@ void gfs_glock_prefetch(struct gfs_glock *gl, unsigned int state, int flags) { - ENTER(GFN_GLOCK_PREFETCH) struct gfs_sbd *sdp = gl->gl_sbd; struct gfs_glock_operations *glops = gl->gl_ops; if (gfs_assert_warn(sdp, state != LM_ST_UNLOCKED) || gfs_assert_warn(sdp, (flags & (LM_FLAG_ANY | GL_EXACT)) != (LM_FLAG_ANY | GL_EXACT))) - RET(GFN_GLOCK_PREFETCH); + return; spin_lock(&gl->gl_spin); @@ -1785,7 +1711,7 @@ !list_empty(&gl->gl_waiters3) || relaxed_state_ok(gl->gl_state, state, flags)) { spin_unlock(&gl->gl_spin); - RET(GFN_GLOCK_PREFETCH); + return; } /* Let bottom half know we're prefetching, ask lock module for lock */ @@ -1799,8 +1725,6 @@ glops->go_xmote_th(gl, state, flags); atomic_inc(&gl->gl_sbd->sd_glock_prefetch_calls); - - RET(GFN_GLOCK_PREFETCH); } /** @@ -1812,7 +1736,6 @@ void gfs_glock_force_drop(struct gfs_glock *gl) { - ENTER(GFN_GLOCK_FORCE_DROP) struct gfs_holder gh; gfs_holder_init(gl, LM_ST_UNLOCKED, 0, &gh); @@ -1826,8 +1749,6 @@ wait_for_completion(&gh.gh_wait); gfs_holder_uninit(&gh); - - RET(GFN_GLOCK_FORCE_DROP); } /** @@ -1839,7 +1760,6 @@ static void greedy_work(void *data) { - ENTER(GFN_GREEDY_WORK) struct greedy *gr = (struct greedy *)data; struct gfs_holder *gh = &gr->gr_gh; struct gfs_glock *gl = gh->gh_gl; @@ -1864,8 +1784,6 @@ spin_unlock(&gl->gl_spin); glock_put(gl); } - - RET(GFN_GREEDY_WORK); } /** @@ -1879,19 +1797,18 @@ int gfs_glock_be_greedy(struct gfs_glock *gl, unsigned int time) { - ENTER(GFN_GLOCK_BE_GREEDY) struct greedy *gr; struct gfs_holder *gh; if (!time || gl->gl_sbd->sd_args.ar_localcaching || test_and_set_bit(GLF_GREEDY, &gl->gl_flags)) - RETURN(GFN_GLOCK_BE_GREEDY, 1); + return 1; gr = kmalloc(sizeof(struct greedy), GFP_KERNEL); if (!gr) { clear_bit(GLF_GREEDY, &gl->gl_flags); - RETURN(GFN_GLOCK_BE_GREEDY, 1); + return 1; } gh = &gr->gr_gh; @@ -1903,7 +1820,7 @@ set_bit(GLF_SKIP_WAITERS2, &gl->gl_flags); schedule_delayed_work(&gr->gr_work, time); - RETURN(GFN_GLOCK_BE_GREEDY, 0); + return 0; } /** @@ -1920,7 +1837,6 @@ gfs_glock_nq_init(struct gfs_glock *gl, unsigned int state, int flags, struct gfs_holder *gh) { - ENTER(GFN_GLOCK_NQ_INIT) int error; gfs_holder_init(gl, state, flags, gh); @@ -1929,7 +1845,7 @@ if (error) gfs_holder_uninit(gh); - RETURN(GFN_GLOCK_NQ_INIT, error); + return error; } /** @@ -1941,12 +1857,8 @@ void gfs_glock_dq_uninit(struct gfs_holder *gh) { - ENTER(GFN_GLOCK_DQ_UNINIT) - gfs_glock_dq(gh); gfs_holder_uninit(gh); - - RET(GFN_GLOCK_DQ_UNINIT); } /** @@ -1966,7 +1878,6 @@ uint64_t number, struct gfs_glock_operations *glops, unsigned int state, int flags, struct gfs_holder *gh) { - ENTER(GFN_GLOCK_NQ_NUM) struct gfs_glock *gl; int error; @@ -1976,7 +1887,7 @@ glock_put(gl); } - RETURN(GFN_GLOCK_NQ_NUM, error); + return error; } /** @@ -1989,7 +1900,6 @@ static int glock_compare(const void *arg_a, const void *arg_b) { - ENTER(GFN_GLOCK_COMPARE) struct gfs_holder *gh_a = *(struct gfs_holder **)arg_a; struct gfs_holder *gh_b = *(struct gfs_holder **)arg_b; struct lm_lockname *a = &gh_a->gh_gl->gl_name; @@ -2009,7 +1919,7 @@ ret = 1; } - RETURN(GFN_GLOCK_COMPARE, ret); + return ret; } /** @@ -2023,7 +1933,6 @@ static int nq_m_sync(unsigned int num_gh, struct gfs_holder *ghs, struct gfs_holder **p) { - ENTER(GFN_NQ_M_SYNC) unsigned int x; int error = 0; @@ -2043,7 +1952,7 @@ } } - RETURN(GFN_NQ_M_SYNC, error); + return error; } /** @@ -2062,19 +1971,18 @@ int gfs_glock_nq_m(unsigned int num_gh, struct gfs_holder *ghs) { - ENTER(GFN_GLOCK_NQ_M) int *e; unsigned int x; int borked = FALSE, serious = 0; int error = 0; if (!num_gh) - RETURN(GFN_GLOCK_NQ_M, 0); + return 0; /* For just one gh, do request synchronously */ if (num_gh == 1) { ghs->gh_flags &= ~(LM_FLAG_TRY | GL_ASYNC); - RETURN(GFN_GLOCK_NQ_M, gfs_glock_nq(ghs)); + return gfs_glock_nq(ghs); } /* using sizeof(struct gfs_holder *) instead of sizeof(int), because @@ -2083,7 +1991,7 @@ */ e = kmalloc(num_gh * sizeof(struct gfs_holder *), GFP_KERNEL); if (!e) - RETURN(GFN_GLOCK_NQ_M, -ENOMEM); + return -ENOMEM; /* Send off asynchronous requests */ for (x = 0; x < num_gh; x++) { @@ -2110,7 +2018,7 @@ /* If all good, done! */ if (!borked) { kfree(e); - RETURN(GFN_GLOCK_NQ_M, 0); + return 0; } for (x = 0; x < num_gh; x++) @@ -2127,7 +2035,7 @@ } kfree(e); - RETURN(GFN_GLOCK_NQ_M, error); + return error; } /** @@ -2140,13 +2048,10 @@ void gfs_glock_dq_m(unsigned int num_gh, struct gfs_holder *ghs) { - ENTER(GFN_GLOCK_DQ_M) unsigned int x; for (x = 0; x < num_gh; x++) gfs_glock_dq(&ghs[x]); - - RET(GFN_GLOCK_DQ_M); } /** @@ -2165,7 +2070,6 @@ uint64_t number, struct gfs_glock_operations *glops, unsigned int state, int flags) { - ENTER(GFN_GLOCK_PREFETCH_NUM) struct gfs_glock *gl; int error; @@ -2176,8 +2080,6 @@ glock_put(gl); } } - - RET(GFN_GLOCK_PREFETCH_NUM); } /** @@ -2189,7 +2091,6 @@ int gfs_lvb_hold(struct gfs_glock *gl) { - ENTER(GFN_LVB_HOLD) int error; lock_on_glock(gl); @@ -2199,7 +2100,7 @@ error = gfs_lm_hold_lvb(gl->gl_sbd, gl->gl_lock, &gl->gl_lvb); if (error) { unlock_on_glock(gl); - RETURN(GFN_LVB_HOLD, error); + return error; } glock_hold(gl); } @@ -2207,7 +2108,7 @@ unlock_on_glock(gl); - RETURN(GFN_LVB_HOLD, 0); + return 0; } /** @@ -2219,8 +2120,6 @@ void gfs_lvb_unhold(struct gfs_glock *gl) { - ENTER(GFN_LVB_UNHOLD) - glock_hold(gl); lock_on_glock(gl); @@ -2236,8 +2135,6 @@ unlock_on_glock(gl); glock_put(gl); - - RET(GFN_LVB_UNHOLD); } /** @@ -2249,10 +2146,8 @@ void gfs_lvb_sync(struct gfs_glock *gl) { - ENTER(GFN_LVB_SYNC) - if (gfs_assert_warn(gl->gl_sbd, atomic_read(&gl->gl_lvb_count))) - RET(GFN_LVB_SYNC); + return; lock_on_glock(gl); @@ -2260,8 +2155,6 @@ gfs_lm_sync_lvb(gl->gl_sbd, gl->gl_lock, gl->gl_lvb); unlock_on_glock(gl); - - RET(GFN_LVB_SYNC); } /** @@ -2275,12 +2168,11 @@ void blocking_cb(struct gfs_sbd *sdp, struct lm_lockname *name, unsigned int state) { - ENTER(GFN_BLOCKING_CB) struct gfs_glock *gl; gl = gfs_glock_find(sdp, name); if (!gl) - RET(GFN_BLOCKING_CB); + return; if (gl->gl_ops->go_callback) gl->gl_ops->go_callback(gl, state); @@ -2291,8 +2183,6 @@ spin_unlock(&gl->gl_spin); glock_put(gl); - - RET(GFN_BLOCKING_CB); } /** @@ -2317,7 +2207,6 @@ void gfs_glock_cb(lm_fsdata_t *fsdata, unsigned int type, void *data) { - ENTER(GFN_GLOCK_CB) struct gfs_sbd *sdp = (struct gfs_sbd *)fsdata; atomic_inc(&sdp->sd_lm_callbacks); @@ -2325,15 +2214,15 @@ switch (type) { case LM_CB_NEED_E: blocking_cb(sdp, (struct lm_lockname *)data, LM_ST_UNLOCKED); - RET(GFN_GLOCK_CB); + return; case LM_CB_NEED_D: blocking_cb(sdp, (struct lm_lockname *)data, LM_ST_DEFERRED); - RET(GFN_GLOCK_CB); + return; case LM_CB_NEED_S: blocking_cb(sdp, (struct lm_lockname *)data, LM_ST_SHARED); - RET(GFN_GLOCK_CB); + return; case LM_CB_ASYNC: { struct lm_async_cb *async = (struct lm_async_cb *)data; @@ -2341,31 +2230,29 @@ gl = gfs_glock_find(sdp, &async->lc_name); if (gfs_assert_warn(sdp, gl)) - RET(GFN_GLOCK_CB); + return; if (!gfs_assert_warn(sdp, gl->gl_req_bh)) gl->gl_req_bh(gl, async->lc_ret); glock_put(gl); - RET(GFN_GLOCK_CB); + return; } case LM_CB_NEED_RECOVERY: gfs_add_dirty_j(sdp, *(unsigned int *)data); if (test_bit(SDF_RECOVERD_RUN, &sdp->sd_flags)) wake_up_process(sdp->sd_recoverd_process); - RET(GFN_GLOCK_CB); + return; case LM_CB_DROPLOCKS: gfs_gl_hash_clear(sdp, FALSE); gfs_quota_scan(sdp); - RET(GFN_GLOCK_CB); + return; default: gfs_assert_warn(sdp, FALSE); - RET(GFN_GLOCK_CB); + return; } - - RET(GFN_GLOCK_CB); } /** @@ -2383,7 +2270,6 @@ void gfs_try_toss_inode(struct gfs_sbd *sdp, struct gfs_inum *inum) { - ENTER(GFN_TRY_TOSS_INODE) struct gfs_glock *gl; struct gfs_inode *ip; int error; @@ -2392,7 +2278,7 @@ inum->no_formal_ino, &gfs_inode_glops, NO_CREATE, &gl); if (error || !gl) - RET(GFN_TRY_TOSS_INODE); + return; if (!trylock_on_glock(gl)) goto out; @@ -2414,8 +2300,6 @@ out: glock_put(gl); - - RET(GFN_TRY_TOSS_INODE); } /** @@ -2428,12 +2312,11 @@ void gfs_iopen_go_callback(struct gfs_glock *io_gl, unsigned int state) { - ENTER(GFN_IOPEN_GO_CALLBACK) struct gfs_glock *i_gl; struct gfs_inode *ip; if (state != LM_ST_UNLOCKED) - RET(GFN_IOPEN_GO_CALLBACK); + return; spin_lock(&io_gl->gl_spin); i_gl = get_gl2gl(io_gl); @@ -2442,7 +2325,7 @@ spin_unlock(&io_gl->gl_spin); } else { spin_unlock(&io_gl->gl_spin); - RET(GFN_IOPEN_GO_CALLBACK); + return; } if (trylock_on_glock(i_gl)) { @@ -2460,8 +2343,6 @@ out: glock_put(i_gl); - - RET(GFN_IOPEN_GO_CALLBACK); } /** @@ -2483,7 +2364,6 @@ static int demote_ok(struct gfs_glock *gl) { - ENTER(GFN_DEMOTE_OK) struct gfs_sbd *sdp = gl->gl_sbd; struct gfs_glock_operations *glops = gl->gl_ops; int demote = TRUE; @@ -2497,7 +2377,7 @@ else if (glops->go_demote_ok) demote = glops->go_demote_ok(gl); - RETURN(GFN_DEMOTE_OK, demote); + return demote; } /** @@ -2509,7 +2389,6 @@ void gfs_glock_schedule_for_reclaim(struct gfs_glock *gl) { - ENTER(GFN_GLOCK_SCHEDULE_FOR_RECLAIM) struct gfs_sbd *sdp = gl->gl_sbd; spin_lock(&sdp->sd_reclaim_lock); @@ -2521,8 +2400,6 @@ spin_unlock(&sdp->sd_reclaim_lock); wake_up(&sdp->sd_reclaim_wchan); - - RET(GFN_GLOCK_SCHEDULE_FOR_RECLAIM); } /** @@ -2552,7 +2429,6 @@ void gfs_reclaim_glock(struct gfs_sbd *sdp) { - ENTER(GFN_RECLAIM_GLOCK) struct gfs_glock *gl; struct gfs_gl_hash_bucket *bucket; @@ -2561,7 +2437,7 @@ /* Nothing to reclaim? Done! */ if (list_empty(&sdp->sd_reclaim_list)) { spin_unlock(&sdp->sd_reclaim_lock); - RET(GFN_RECLAIM_GLOCK); + return; } /* Remove next victim from reclaim list */ @@ -2605,8 +2481,6 @@ write_unlock(&bucket->hb_lock); glock_put(gl); /* see gfs_glock_schedule_for_reclaim() */ } - - RET(GFN_RECLAIM_GLOCK); } /** @@ -2622,7 +2496,6 @@ examine_bucket(glock_examiner examiner, struct gfs_sbd *sdp, struct gfs_gl_hash_bucket *bucket) { - ENTER(GFN_EXAMINE_BUCKET) struct glock_plug plug; struct list_head *tmp; struct gfs_glock *gl; @@ -2649,7 +2522,7 @@ list_del(&plug.gl_list); entries = !list_empty(&bucket->hb_list); write_unlock(&bucket->hb_lock); - RETURN(GFN_EXAMINE_BUCKET, entries); + return entries; } gl = list_entry(tmp, struct gfs_glock, gl_list); @@ -2688,8 +2561,6 @@ static void scan_glock(struct gfs_glock *gl) { - ENTER(GFN_SCAN_GLOCK) - if (trylock_on_glock(gl)) { if (queue_empty(gl, &gl->gl_holders)) { /* Inode glock-type-specific; reclaim glock if gfs inode @@ -2716,8 +2587,6 @@ out: glock_put(gl); /* see examine_bucket() */ - - RET(GFN_SCAN_GLOCK); } /** @@ -2737,15 +2606,12 @@ void gfs_scand_internal(struct gfs_sbd *sdp) { - ENTER(GFN_SCAND_INTERNAL) unsigned int x; for (x = 0; x < GFS_GL_HASH_SIZE; x++) { examine_bucket(scan_glock, sdp, &sdp->sd_gl_hash[x]); cond_resched(); } - - RET(GFN_SCAND_INTERNAL); } /** @@ -2765,7 +2631,6 @@ static void clear_glock(struct gfs_glock *gl) { - ENTER(GFN_CLEAR_GLOCK) struct gfs_sbd *sdp = gl->gl_sbd; struct gfs_gl_hash_bucket *bucket = gl->gl_bucket; @@ -2805,8 +2670,6 @@ write_unlock(&bucket->hb_lock); glock_put(gl); /* see examine_bucket() */ } - - RET(GFN_CLEAR_GLOCK); } /** @@ -2821,7 +2684,6 @@ void gfs_gl_hash_clear(struct gfs_sbd *sdp, int wait) { - ENTER(GFN_GL_HASH_CLEAR) unsigned long t; unsigned int x; int cont; @@ -2848,8 +2710,6 @@ invalidate_inodes(sdp->sd_vfs); yield(); } - - RET(GFN_GL_HASH_CLEAR); } /* @@ -2871,7 +2731,6 @@ dump_holder(char *str, struct gfs_holder *gh, char *buf, unsigned int size, unsigned int *count) { - ENTER(GFN_DUMP_HOLDER) unsigned int x; int error = -ENOBUFS; @@ -2894,7 +2753,7 @@ error = 0; out: - RETURN(GFN_DUMP_HOLDER, error); + return error; } /** @@ -2911,7 +2770,6 @@ dump_inode(struct gfs_inode *ip, char *buf, unsigned int size, unsigned int *count) { - ENTER(GFN_DUMP_INODE) unsigned int x; int error = -ENOBUFS; @@ -2930,7 +2788,7 @@ error = 0; out: - RETURN(GFN_DUMP_INODE, error); + return error; } /** @@ -2947,7 +2805,6 @@ dump_glock(struct gfs_glock *gl, char *buf, unsigned int size, unsigned int *count) { - ENTER(GFN_DUMP_GLOCK) struct list_head *head, *tmp; struct gfs_holder *gh; unsigned int x; @@ -3034,7 +2891,7 @@ out: spin_unlock(&gl->gl_spin); - RETURN(GFN_DUMP_GLOCK, error); + return error; } /** @@ -3049,7 +2906,6 @@ int gfs_dump_lockstate(struct gfs_sbd *sdp, struct gfs_user_buffer *ub) { - ENTER(GFN_DUMP_LOCKSTATE) struct gfs_gl_hash_bucket *bucket; struct list_head *tmp, *head; struct gfs_glock *gl; @@ -3061,7 +2917,7 @@ if (ub) { buf = kmalloc(size, GFP_KERNEL); if (!buf) - RETURN(GFN_DUMP_LOCKSTATE, -ENOMEM); + return -ENOMEM; } for (x = 0; x < GFS_GL_HASH_SIZE; x++) { @@ -3104,5 +2960,5 @@ if (ub) kfree(buf); - RETURN(GFN_DUMP_LOCKSTATE, error); + return error; } --- cluster/gfs-kernel/src/gfs/glock.h 2005/01/12 23:04:18 1.8 +++ cluster/gfs-kernel/src/gfs/glock.h 2006/07/10 23:22:34 1.9 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -11,8 +11,8 @@ ******************************************************************************* ******************************************************************************/ -#ifndef __GLOCK_DOT_H__ -#define __GLOCK_DOT_H__ +#ifndef __GFS_GLOCK_DOT_H__ +#define __GFS_GLOCK_DOT_H__ /* Flags for lock requests; used in gfs_holder gh_flag field. */ /* These are defined in lm_interface.h, commented out here. @@ -147,4 +147,4 @@ int gfs_dump_lockstate(struct gfs_sbd *sdp, struct gfs_user_buffer *ub); -#endif /* __GLOCK_DOT_H__ */ +#endif /* __GFS_GLOCK_DOT_H__ */ --- cluster/gfs-kernel/src/gfs/glops.c 2006/01/09 22:25:06 1.12 +++ cluster/gfs-kernel/src/gfs/glops.c 2006/07/10 23:22:34 1.13 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -48,10 +48,8 @@ static void meta_go_sync(struct gfs_glock *gl, int flags) { - ENTER(GFN_META_GO_SYNC) - if (!(flags & DIO_METADATA)) - RET(GFN_META_GO_SYNC); + return; if (test_bit(GLF_DIRTY, &gl->gl_flags)) { gfs_log_flush_glock(gl); @@ -61,8 +59,6 @@ /* We've synced everything, clear SYNC request and DIRTY flags */ clear_bit(GLF_DIRTY, &gl->gl_flags); clear_bit(GLF_SYNC, &gl->gl_flags); - - RET(GFN_META_GO_SYNC); } /** @@ -75,15 +71,11 @@ static void meta_go_inval(struct gfs_glock *gl, int flags) { - ENTER(GFN_META_GO_INVAL) - if (!(flags & DIO_METADATA)) - RET(GFN_META_GO_INVAL); + return; gfs_inval_buf(gl); gl->gl_vn++; - - RET(GFN_META_GO_INVAL); } /** @@ -132,9 +124,7 @@ static int meta_go_demote_ok(struct gfs_glock *gl) { - ENTER(GFN_META_GO_DEMOTE_OK) - RETURN(GFN_META_GO_DEMOTE_OK, - (gl->gl_aspace->i_mapping->nrpages) ? FALSE : TRUE); + return (gl->gl_aspace->i_mapping->nrpages) ? FALSE : TRUE; } /** @@ -150,11 +140,9 @@ static void inode_go_xmote_th(struct gfs_glock *gl, unsigned int state, int flags) { - ENTER(GFN_INODE_GO_XMOTE_TH) if (gl->gl_state != LM_ST_UNLOCKED) gfs_inval_pte(gl); gfs_glock_xmote_th(gl, state, flags); - RET(GFN_INODE_GO_XMOTE_TH); } /** @@ -175,7 +163,6 @@ static void inode_go_xmote_bh(struct gfs_glock *gl) { - ENTER(GFN_INODE_GO_XMOTE_BH) struct gfs_holder *gh = gl->gl_req_gh; struct buffer_head *bh; int error; @@ -186,8 +173,6 @@ if (!error) brelse(bh); } - - RET(GFN_INODE_GO_XMOTE_BH); } /** @@ -202,10 +187,8 @@ static void inode_go_drop_th(struct gfs_glock *gl) { - ENTER(GFN_INODE_GO_DROP_TH) gfs_inval_pte(gl); gfs_glock_drop_th(gl); - RET(GFN_INODE_GO_DROP_TH); } /** @@ -245,7 +228,6 @@ static void inode_go_sync(struct gfs_glock *gl, int flags) { - ENTER(GFN_INODE_GO_SYNC) int meta = (flags & DIO_METADATA); int data = (flags & DIO_DATA); @@ -269,8 +251,6 @@ clear_bit(GLF_DIRTY, &gl->gl_flags); clear_bit(GLF_SYNC, &gl->gl_flags); } - - RET(GFN_INODE_GO_SYNC); } /** @@ -283,7 +263,6 @@ static void inode_go_inval(struct gfs_glock *gl, int flags) { - ENTER(GFN_INODE_GO_INVAL) int meta = (flags & DIO_METADATA); int data = (flags & DIO_DATA); @@ -293,8 +272,6 @@ } if (data) gfs_inval_page(gl); - - RET(GFN_INODE_GO_INVAL); } /** @@ -314,7 +291,6 @@ static int inode_go_demote_ok(struct gfs_glock *gl) { - ENTER(GFN_INODE_GO_DEMOTE_OK) struct gfs_sbd *sdp = gl->gl_sbd; int demote = FALSE; @@ -324,7 +300,7 @@ time_after_eq(jiffies, gl->gl_stamp + gfs_tune_get(sdp, gt_demote_secs) * HZ)) demote = TRUE; - RETURN(GFN_INODE_GO_DEMOTE_OK, demote); + return demote; } /** @@ -339,7 +315,6 @@ static int inode_go_lock(struct gfs_glock *gl, int flags) { - ENTER(GFN_INODE_GO_LOCK) struct gfs_inode *ip = get_gl2ip(gl); int error = 0; @@ -349,7 +324,7 @@ gfs_inode_attr_in(ip); } - RETURN(GFN_INODE_GO_LOCK, error); + return error; } /** @@ -363,7 +338,6 @@ static void inode_go_unlock(struct gfs_glock *gl, int flags) { - ENTER(GFN_INODE_GO_UNLOCK) struct gfs_inode *ip = get_gl2ip(gl); if (ip && test_bit(GLF_DIRTY, &gl->gl_flags)) @@ -371,8 +345,6 @@ if (ip) gfs_flush_meta_cache(ip); - - RET(GFN_INODE_GO_UNLOCK); } /** @@ -384,7 +356,6 @@ static void inode_greedy(struct gfs_glock *gl) { - ENTER(GFN_INODE_GREEDY) struct gfs_sbd *sdp = gl->gl_sbd; struct gfs_inode *ip = get_gl2ip(gl); unsigned int quantum = gfs_tune_get(sdp, gt_greedy_quantum); @@ -408,11 +379,8 @@ spin_unlock(&ip->i_spin); gfs_inode_put(ip); - - RET(GFN_INODE_GREEDY); } - /** * rgrp_go_xmote_th - promote/demote (but don't unlock) a resource group glock * @gl: the glock @@ -432,14 +400,11 @@ static void rgrp_go_xmote_th(struct gfs_glock *gl, unsigned int state, int flags) { - ENTER(GFN_RGRP_GO_XMOTE_TH) struct gfs_rgrpd *rgd = get_gl2rgd(gl); gfs_mhc_zap(rgd); gfs_depend_sync(rgd); gfs_glock_xmote_th(gl, state, flags); - - RET(GFN_RGRP_GO_XMOTE_TH); } /** @@ -454,14 +419,11 @@ static void rgrp_go_drop_th(struct gfs_glock *gl) { - ENTER(GFN_RGRP_GO_DROP_TH) struct gfs_rgrpd *rgd = get_gl2rgd(gl); gfs_mhc_zap(rgd); gfs_depend_sync(rgd); gfs_glock_drop_th(gl); - - EXIT(GFN_RGRP_GO_DROP_TH) } /** @@ -478,7 +440,6 @@ static int rgrp_go_demote_ok(struct gfs_glock *gl) { - ENTER(GFN_RGRP_GO_DEMOTE_OK) struct gfs_rgrpd *rgd = get_gl2rgd(gl); int demote = TRUE; @@ -487,7 +448,7 @@ else if (rgd && !list_empty(&rgd->rd_mhc)) /* Don't bother with lock here */ demote = FALSE; - RETURN(GFN_RGRP_GO_DEMOTE_OK, demote); + return demote; } /** @@ -504,11 +465,9 @@ static int rgrp_go_lock(struct gfs_glock *gl, int flags) { - ENTER(GFN_RGRP_GO_LOCK) if (flags & GL_SKIP) - RETURN(GFN_RGRP_GO_LOCK, 0); - RETURN(GFN_RGRP_GO_LOCK, - gfs_rgrp_read(get_gl2rgd(gl))); + return 0; + return gfs_rgrp_read(get_gl2rgd(gl)); } /** @@ -525,14 +484,12 @@ static void rgrp_go_unlock(struct gfs_glock *gl, int flags) { - ENTER(GFN_RGRP_GO_UNLOCK) struct gfs_rgrpd *rgd = get_gl2rgd(gl); if (flags & GL_SKIP) - RET(GFN_RGRP_GO_UNLOCK); + return; gfs_rgrp_relse(rgd); if (test_bit(GLF_DIRTY, &gl->gl_flags)) gfs_rgrp_lvb_fill(rgd); - RET(GFN_RGRP_GO_UNLOCK); } /** @@ -548,7 +505,6 @@ static void trans_go_xmote_th(struct gfs_glock *gl, unsigned int state, int flags) { - ENTER(GFN_TRANS_GO_XMOTE_TH) struct gfs_sbd *sdp = gl->gl_sbd; if (gl->gl_state != LM_ST_UNLOCKED && @@ -558,8 +514,6 @@ } gfs_glock_xmote_th(gl, state, flags); - - RET(GFN_TRANS_GO_XMOTE_TH); } /** @@ -572,7 +526,6 @@ static void trans_go_xmote_bh(struct gfs_glock *gl) { - ENTER(GFN_TRANS_GO_XMOTE_BH) struct gfs_sbd *sdp = gl->gl_sbd; struct gfs_glock *j_gl = sdp->sd_journal_gh.gh_gl; struct gfs_log_header head; @@ -594,8 +547,6 @@ sdp->sd_log_head = head.lh_first + 1; } } - - RET(GFN_TRANS_GO_XMOTE_BH); } /** @@ -613,7 +564,6 @@ static void trans_go_drop_th(struct gfs_glock *gl) { - ENTER(GFN_TRANS_GO_DROP_TH) struct gfs_sbd *sdp = gl->gl_sbd; if (test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) { @@ -622,8 +572,6 @@ } gfs_glock_drop_th(gl); - - RET(GFN_TRANS_GO_DROP_TH); } /** @@ -643,8 +591,7 @@ static int nondisk_go_demote_ok(struct gfs_glock *gl) { - ENTER(GFN_NONDISK_GO_DEMOTE_OK) - RETURN(GFN_NONDISK_GO_DEMOTE_OK, FALSE); + return FALSE; } /** @@ -659,9 +606,7 @@ static int quota_go_demote_ok(struct gfs_glock *gl) { - ENTER(GFN_QUOTA_GO_DEMOTE_OK) - RETURN(GFN_QUOTA_GO_DEMOTE_OK, - !atomic_read(&gl->gl_lvb_count)); + return !atomic_read(&gl->gl_lvb_count); } struct gfs_glock_operations gfs_meta_glops = { --- cluster/gfs-kernel/src/gfs/glops.h 2004/06/24 08:53:28 1.1 +++ cluster/gfs-kernel/src/gfs/glops.h 2006/07/10 23:22:34 1.2 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/incore.h 2005/10/24 15:53:59 1.24 +++ cluster/gfs-kernel/src/gfs/incore.h 2006/07/10 23:22:34 1.25 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -817,14 +817,23 @@ #define GFS_GLOCKD_DEFAULT (1) #define GFS_GLOCKD_MAX (32) +#define GFS_QUOTA_DEFAULT GFS_QUOTA_OFF +#define GFS_QUOTA_OFF 0 +#define GFS_QUOTA_ACCOUNT 1 +#define GFS_QUOTA_ON 2 + +#define GFS_DATA_DEFAULT GFS_DATA_ORDERED +#define GFS_DATA_WRITEBACK 1 +#define GFS_DATA_ORDERED 2 + + struct gfs_args { char ar_lockproto[GFS_LOCKNAME_LEN]; /* The name of the Lock Protocol */ char ar_locktable[GFS_LOCKNAME_LEN]; /* The name of the Lock Table */ char ar_hostdata[GFS_LOCKNAME_LEN]; /* The host specific data */ int ar_spectator; /* Don't get a journal because we're always RO. */ - - /* + /* * GFS can invoke some flock and disk caching optimizations if it is * not in a cluster, i.e. is a local filesystem. The chosen lock * module tells GFS, at mount time, if it supports clustering. @@ -1051,6 +1060,7 @@ /* Scan for glocks and inodes to toss from memory */ struct task_struct *sd_scand_process; /* Scand places on reclaim list*/ + struct task_struct *sd_glockd_process[GFS_GLOCKD_MAX]; unsigned int sd_glockd_num; /* # of glockd procs to do reclaiming*/ /* Recover journal of a crashed node */ --- cluster/gfs-kernel/src/gfs/inode.c 2006/01/09 22:25:06 1.23 +++ cluster/gfs-kernel/src/gfs/inode.c 2006/07/10 23:22:34 1.24 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -48,7 +48,6 @@ static void inode_attr_in(struct gfs_inode *ip, struct inode *inode) { - ENTER(GFN_INODE_ATTR_IN2) unsigned int mode; inode->i_ino = ip->i_num.no_formal_ino; @@ -86,7 +85,7 @@ if (gfs_consist_inode(ip)) printk("GFS: fsid=%s: type = %u\n", ip->i_sbd->sd_fsname, ip->i_di.di_type); - RET(GFN_INODE_ATTR_IN2); + return; }; inode->i_mode = mode | (ip->i_di.di_mode & S_IALLUGO); @@ -112,8 +111,6 @@ inode->i_flags |= S_APPEND; else inode->i_flags &= ~S_APPEND; - - RET(GFN_INODE_ATTR_IN2); } /** @@ -125,7 +122,6 @@ void gfs_inode_attr_in(struct gfs_inode *ip) { - ENTER(GFN_INODE_ATTR_IN) struct inode *inode; inode = gfs_iget(ip, NO_CREATE); @@ -134,7 +130,6 @@ iput(inode); } - RET(GFN_INODE_ATTR_IN); } /** @@ -148,7 +143,6 @@ void gfs_inode_attr_out(struct gfs_inode *ip) { - ENTER(GFN_INODE_ATTR_OUT) struct inode *inode = ip->i_vnode; ip->i_di.di_mode = inode->i_mode & S_IALLUGO; @@ -157,8 +151,6 @@ ip->i_di.di_atime = inode->i_atime.tv_sec; ip->i_di.di_mtime = inode->i_mtime.tv_sec; ip->i_di.di_ctime = inode->i_ctime.tv_sec; - - RET(GFN_INODE_ATTR_OUT); } /** @@ -179,7 +171,6 @@ struct inode * gfs_iget(struct gfs_inode *ip, int create) { - ENTER(GFN_IGET) struct inode *inode = NULL, *tmp; spin_lock(&ip->i_spin); @@ -188,11 +179,11 @@ spin_unlock(&ip->i_spin); if (inode || !create) - RETURN(GFN_IGET, inode); + return inode; tmp = new_inode(ip->i_sbd->sd_vfs); if (!tmp) - RETURN(GFN_IGET, NULL); + return NULL; inode_attr_in(ip, tmp); @@ -228,7 +219,7 @@ if (inode) { iput(tmp); - RETURN(GFN_IGET, inode); + return inode; } yield(); } @@ -243,7 +234,7 @@ insert_inode_hash(inode); - RETURN(GFN_IGET, inode); + return inode; } /** @@ -256,17 +247,16 @@ int gfs_copyin_dinode(struct gfs_inode *ip) { - ENTER(GFN_COPYIN_DINODE) struct buffer_head *dibh; int error; error = gfs_get_inode_buffer(ip, &dibh); if (error) - RETURN(GFN_COPYIN_DINODE, error); + return error; if (gfs_metatype_check(ip->i_sbd, dibh, GFS_METATYPE_DI)) { brelse(dibh); - RETURN(GFN_COPYIN_DINODE, -EIO); + return -EIO; } gfs_dinode_in(&ip->i_di, dibh->b_data); @@ -275,19 +265,19 @@ if (ip->i_num.no_formal_ino != ip->i_di.di_num.no_formal_ino) { if (gfs_consist_inode(ip)) gfs_dinode_print(&ip->i_di); - RETURN(GFN_COPYIN_DINODE, -EIO); + return -EIO; } /* Handle a moved inode (not implemented yet) */ if (ip->i_num.no_addr != ip->i_di.di_num.no_addr) { if (gfs_consist_inode(ip)) gfs_dinode_print(&ip->i_di); - RETURN(GFN_COPYIN_DINODE, -EIO); + return -EIO; } ip->i_vn = ip->i_gl->gl_vn; - RETURN(GFN_COPYIN_DINODE, 0); + return 0; } /** @@ -307,7 +297,6 @@ struct gfs_glock *io_gl, unsigned int io_state, struct gfs_inode **ipp) { - ENTER(GFN_INODE_CREATE) struct gfs_sbd *sdp = i_gl->gl_sbd; struct gfs_inode *ip; int error = 0; @@ -354,7 +343,7 @@ *ipp = ip; - RETURN(GFN_INODE_CREATE, 0); + return 0; fail_iopen: spin_lock(&io_gl->gl_spin); @@ -369,7 +358,7 @@ kmem_cache_free(gfs_inode_cachep, ip); *ipp = NULL; - RETURN(GFN_INODE_CREATE, error); + return error; } /** @@ -388,7 +377,6 @@ gfs_inode_get(struct gfs_glock *i_gl, struct gfs_inum *inum, int create, struct gfs_inode **ipp) { - ENTER(GFN_INODE_GET) struct gfs_glock *io_gl; int error = 0; @@ -409,7 +397,7 @@ } } - RETURN(GFN_INODE_GET, error); + return error; } /** @@ -421,10 +409,8 @@ void gfs_inode_hold(struct gfs_inode *ip) { - ENTER(GFN_INODE_HOLD) gfs_assert(ip->i_sbd, atomic_read(&ip->i_count) > 0,); atomic_inc(&ip->i_count); - RET(GFN_INODE_HOLD); } /** @@ -436,10 +422,8 @@ void gfs_inode_put(struct gfs_inode *ip) { - ENTER(GFN_INODE_PUT) gfs_assert(ip->i_sbd, atomic_read(&ip->i_count) > 0,); atomic_dec(&ip->i_count); - RET(GFN_INODE_PUT); } /** @@ -455,7 +439,6 @@ void gfs_inode_destroy(struct gfs_inode *ip) { - ENTER(GFN_INODE_DESTROY) struct gfs_sbd *sdp = ip->i_sbd; struct gfs_glock *io_gl = ip->i_iopen_gh.gh_gl; struct gfs_glock *i_gl = ip->i_gl; @@ -479,8 +462,6 @@ gfs_glock_put(i_gl); atomic_dec(&sdp->sd_inode_count); - - RET(GFN_INODE_DESTROY); } /** @@ -498,7 +479,6 @@ static int dinode_mark_unused(struct gfs_inode *ip) { - ENTER(GFN_DINODE_MARK_UNUSED) struct buffer_head *dibh; struct gfs_dinode *di; uint32_t incarn; @@ -508,7 +488,7 @@ error = gfs_get_inode_buffer(ip, &dibh); if (error) - RETURN(GFN_DINODE_MARK_UNUSED, error); + return error; di = (struct gfs_dinode *)dibh->b_data; @@ -525,7 +505,7 @@ brelse(dibh); - RETURN(GFN_DINODE_MARK_UNUSED, 0); + return 0; } /** @@ -538,7 +518,6 @@ static int dinode_dealloc(struct gfs_inode *ip) { - ENTER(GFN_DINODE_DEALLOC) struct gfs_sbd *sdp = ip->i_sbd; struct gfs_alloc *al; struct gfs_rgrpd *rgd; @@ -547,7 +526,7 @@ if (ip->i_di.di_blocks != 1) { if (gfs_consist_inode(ip)) gfs_dinode_print(&ip->i_di); - RETURN(GFN_DINODE_DEALLOC, -EIO); + return -EIO; } al = gfs_alloc_get(ip); @@ -608,7 +587,7 @@ out: gfs_alloc_put(ip); - RETURN(GFN_DINODE_DEALLOC, error); + return error; } /** @@ -629,7 +608,6 @@ inode_dealloc(struct gfs_sbd *sdp, struct gfs_inum *inum, struct gfs_holder *io_gh) { - ENTER(GFN_INODE_DEALLOC2) struct gfs_inode *ip; struct gfs_holder i_gh; int error; @@ -639,7 +617,7 @@ inum->no_formal_ino, &gfs_inode_glops, LM_ST_EXCLUSIVE, 0, &i_gh); if (error) - RETURN(GFN_INODE_DEALLOC2, error); + return error; /* We reacquire the iopen lock here to avoid a race with the NFS server calling gfs_read_inode() with the inode number of a inode we're in @@ -712,7 +690,7 @@ gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_INODE_DEALLOC2, 0); + return 0; fail_iput: gfs_inode_put(ip); @@ -721,7 +699,7 @@ fail: gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_INODE_DEALLOC2, error); + return error; } /** @@ -735,7 +713,6 @@ static int inode_dealloc_init(struct gfs_sbd *sdp, struct gfs_inum *inum) { - ENTER(GFN_INODE_DEALLOC_INIT) struct gfs_holder io_gh; int error = 0; @@ -751,9 +728,9 @@ case 0: break; case GLR_TRYFAILED: - RETURN(GFN_INODE_DEALLOC_INIT, 1); + return 1; default: - RETURN(GFN_INODE_DEALLOC_INIT, error); + return error; } /* Unlock here to prevent deadlock */ @@ -764,7 +741,7 @@ error = inode_dealloc(sdp, inum, &io_gh); gfs_holder_uninit(&io_gh); - RETURN(GFN_INODE_DEALLOC_INIT, error); + return error; } /** @@ -779,14 +756,13 @@ static int inode_dealloc_uninit(struct gfs_sbd *sdp, struct gfs_inum *inum) { - ENTER(GFN_INODE_DEALLOC_UNINIT) struct gfs_rgrpd *rgd; struct gfs_holder ri_gh, rgd_gh; int error; error = gfs_rindex_hold(sdp, &ri_gh); if (error) - RETURN(GFN_INODE_DEALLOC_UNINIT, error); + return error; rgd = gfs_blk2rgrpd(sdp, inum->no_addr); if (!rgd) { @@ -816,7 +792,7 @@ gfs_glock_dq_uninit(&rgd_gh); gfs_glock_dq_uninit(&ri_gh); - RETURN(GFN_INODE_DEALLOC_UNINIT, 0); + return 0; fail_gunlock: gfs_glock_dq_uninit(&rgd_gh); @@ -824,7 +800,7 @@ fail: gfs_glock_dq_uninit(&ri_gh); - RETURN(GFN_INODE_DEALLOC_UNINIT, error); + return error; } /** @@ -837,13 +813,10 @@ int gfs_inode_dealloc(struct gfs_sbd *sdp, struct gfs_inum *inum) { - ENTER(GFN_INODE_DEALLOC) if (inum->no_formal_ino) - RETURN(GFN_INODE_DEALLOC, - inode_dealloc_init(sdp, inum)); + return inode_dealloc_init(sdp, inum); else - RETURN(GFN_INODE_DEALLOC, - inode_dealloc_uninit(sdp, inum)); + return inode_dealloc_uninit(sdp, inum); } /** @@ -857,7 +830,6 @@ int gfs_change_nlink(struct gfs_inode *ip, int diff) { - ENTER(GFN_CHANGE_NLINK) struct buffer_head *dibh; uint32_t nlink; int error; @@ -870,12 +842,12 @@ if (diff < 0 && nlink > ip->i_di.di_nlink) { if (gfs_consist_inode(ip)) gfs_dinode_print(&ip->i_di); - RETURN(GFN_CHANGE_NLINK, -EIO); + return -EIO; } error = gfs_get_inode_buffer(ip, &dibh); if (error) - RETURN(GFN_CHANGE_NLINK, error); + return error; ip->i_di.di_nlink = nlink; ip->i_di.di_ctime = get_seconds(); @@ -884,7 +856,7 @@ gfs_dinode_out(&ip->i_di, dibh->b_data); brelse(dibh); - RETURN(GFN_CHANGE_NLINK, 0); + return 0; } /** @@ -904,7 +876,6 @@ gfs_lookupi(struct gfs_holder *d_gh, struct qstr *name, int is_root, struct gfs_holder *i_gh) { - ENTER(GFN_LOOKUPI) struct gfs_inode *dip = get_gl2ip(d_gh->gh_gl); struct gfs_sbd *sdp = dip->i_sbd; struct gfs_glock *gl; @@ -916,7 +887,7 @@ i_gh->gh_gl = NULL; if (!name->len || name->len > GFS_FNAMESIZE) - RETURN(GFN_LOOKUPI, -ENAMETOOLONG); + return -ENAMETOOLONG; if (gfs_filecmp(name, ".", 1) || (gfs_filecmp(name, "..", 2) && dip == sdp->sd_rooti)) { @@ -928,26 +899,26 @@ i_gh); if (error) { gfs_glock_dq(d_gh); - RETURN(GFN_LOOKUPI, error); + return error; } gfs_inode_hold(dip); } - RETURN(GFN_LOOKUPI, error); + return error; } if (gfs_assert_warn(sdp, !gfs_glock_is_locked_by_me(d_gh->gh_gl))) - RETURN(GFN_LOOKUPI, -EINVAL); + return -EINVAL; gfs_holder_reinit(LM_ST_SHARED, 0, d_gh); error = gfs_glock_nq(d_gh); if (error) - RETURN(GFN_LOOKUPI, error); + return error; if (!is_root) { error = permission(dip->i_vnode, MAY_EXEC, NULL); if (error) { gfs_glock_dq(d_gh); - RETURN(GFN_LOOKUPI, error); + return error; } } @@ -956,7 +927,7 @@ gfs_glock_dq(d_gh); if (error == -ENOENT) error = 0; - RETURN(GFN_LOOKUPI, error); + return error; } restart: @@ -964,7 +935,7 @@ CREATE, &gl); if (error) { gfs_glock_dq(d_gh); - RETURN(GFN_LOOKUPI, error); + return error; } /* Acquire the second lock */ @@ -1034,7 +1005,7 @@ out: gfs_glock_put(gl); - RETURN(GFN_LOOKUPI, error); + return error; } /** @@ -1049,17 +1020,16 @@ static int create_ok(struct gfs_inode *dip, struct qstr *name, unsigned int type) { - ENTER(GFN_CREATE_OK) int error; error = permission(dip->i_vnode, MAY_WRITE | MAY_EXEC, NULL); if (error) - RETURN(GFN_CREATE_OK, error); + return error; /* Don't create entries in an unlinked directory */ if (!dip->i_di.di_nlink) - RETURN(GFN_CREATE_OK, -EPERM); + return -EPERM; error = gfs_dir_search(dip, name, NULL, NULL); switch (error) { @@ -1067,17 +1037,17 @@ error = 0; break; case 0: - RETURN(GFN_CREATE_OK, -EEXIST); + return -EEXIST; default: - RETURN(GFN_CREATE_OK, error); + return error; } if (dip->i_di.di_entries == (uint32_t)-1) - RETURN(GFN_CREATE_OK, -EFBIG); + return -EFBIG; if (type == GFS_FILE_DIR && dip->i_di.di_nlink == (uint32_t)-1) - RETURN(GFN_CREATE_OK, -EMLINK); + return -EMLINK; - RETURN(GFN_CREATE_OK, 0); + return 0; } /** @@ -1094,7 +1064,6 @@ static int dinode_alloc(struct gfs_inode *dip, struct gfs_unlinked **ul) { - ENTER(GFN_DINODE_ALLOC) struct gfs_sbd *sdp = dip->i_sbd; struct gfs_alloc *al; struct gfs_inum inum; @@ -1130,7 +1099,7 @@ out: gfs_alloc_put(dip); - RETURN(GFN_DINODE_ALLOC, error); + return error; } /** @@ -1143,10 +1112,8 @@ static void pick_formal_ino(struct gfs_sbd *sdp, struct gfs_inum *inum) { - ENTER(GFN_PICK_FORMAL_INO) /* This won't always be true */ inum->no_formal_ino = inum->no_addr; - RET(GFN_PICK_FORMAL_INO); } /** @@ -1167,7 +1134,6 @@ unsigned int type, unsigned int mode, unsigned int uid, unsigned int gid) { - ENTER(GFN_MAKE_DINODE) struct gfs_sbd *sdp = dip->i_sbd; struct gfs_dinode di; struct buffer_head *dibh; @@ -1178,7 +1144,7 @@ DIO_NEW | DIO_START | DIO_WAIT, &dibh); if (error) - RETURN(GFN_MAKE_DINODE, error); + return error; gfs_trans_add_bh(gl, dibh); gfs_metatype_set(dibh, GFS_METATYPE_DI, GFS_FORMAT_DI); @@ -1203,7 +1169,7 @@ printk("GFS: fsid=%s: block = %"PRIu64"\n", sdp->sd_fsname, inum->no_addr); brelse(dibh); - RETURN(GFN_MAKE_DINODE, -EIO); + return -EIO; } di.di_rgrp = rgd->rd_ri.ri_addr; @@ -1227,7 +1193,7 @@ gfs_dinode_out(&di, dibh->b_data); brelse(dibh); - RETURN(GFN_MAKE_DINODE, 0); + return 0; } /** @@ -1247,7 +1213,6 @@ struct gfs_inum *inum, struct gfs_glock *gl, unsigned int type, mode_t mode) { - ENTER(GFN_INODE_INIT_AND_LINK) struct gfs_sbd *sdp = dip->i_sbd; struct gfs_alloc *al; struct gfs_inode *ip; @@ -1279,7 +1244,7 @@ &acl_a_data, &acl_d_data, &acl_size, &acl_blocks); if (error) - RETURN(GFN_INODE_INIT_AND_LINK, error); + return error; al = gfs_alloc_get(dip); @@ -1362,7 +1327,7 @@ if (!alloc_required) gfs_glock_dq_uninit(&al->al_ri_gh); - RETURN(GFN_INODE_INIT_AND_LINK, error); + return error; fail_end_trans: gfs_trans_end(sdp); @@ -1383,7 +1348,7 @@ else if (acl_d_data) kfree(acl_d_data); - RETURN(GFN_INODE_INIT_AND_LINK, error); + return error; } /** @@ -1406,7 +1371,6 @@ unsigned int type, unsigned int mode, struct gfs_holder *i_gh) { - ENTER(GFN_CREATEI) struct gfs_inode *dip = get_gl2ip(d_gh->gh_gl); struct gfs_sbd *sdp = dip->i_sbd; struct gfs_unlinked *ul; @@ -1415,12 +1379,12 @@ int error; if (!name->len || name->len > GFS_FNAMESIZE) - RETURN(GFN_CREATEI, -ENAMETOOLONG); + return -ENAMETOOLONG; gfs_holder_reinit(LM_ST_EXCLUSIVE, 0, d_gh); error = gfs_glock_nq(d_gh); if (error) - RETURN(GFN_CREATEI, error); + return error; error = create_ok(dip, name, type); if (error) @@ -1441,7 +1405,7 @@ LM_ST_EXCLUSIVE, GL_SKIP, i_gh); if (error) { gfs_unlinked_unlock(sdp, ul); - RETURN(GFN_CREATEI, error); + return error; } gfs_holder_reinit(LM_ST_EXCLUSIVE, 0, d_gh); @@ -1449,7 +1413,7 @@ if (error) { gfs_glock_dq_uninit(i_gh); gfs_unlinked_unlock(sdp, ul); - RETURN(GFN_CREATEI, error); + return error; } error = create_ok(dip, name, type); @@ -1476,7 +1440,7 @@ gfs_glock_dq_uninit(&io_gh); - RETURN(GFN_CREATEI, 0); + return 0; fail_gunlock_io: gfs_glock_dq_uninit(&io_gh); @@ -1490,7 +1454,7 @@ fail: gfs_glock_dq(d_gh); - RETURN(GFN_CREATEI, error); + return error; } /** @@ -1507,17 +1471,16 @@ int gfs_unlinki(struct gfs_inode *dip, struct qstr *name, struct gfs_inode *ip) { - ENTER(GFN_UNLINKI) struct gfs_sbd *sdp = dip->i_sbd; int error; error = gfs_dir_del(dip, name); if (error) - RETURN(GFN_UNLINKI, error); + return error; error = gfs_change_nlink(ip, -1); if (error) - RETURN(GFN_UNLINKI, error); + return error; /* If this inode is being unlinked from the directory structure, we need to mark that in the log so that it isn't lost during @@ -1528,7 +1491,7 @@ set_bit(GLF_STICKY, &ip->i_gl->gl_flags); } - RETURN(GFN_UNLINKI, 0); + return 0; } /** @@ -1545,7 +1508,6 @@ int gfs_rmdiri(struct gfs_inode *dip, struct qstr *name, struct gfs_inode *ip) { - ENTER(GFN_RMDIRI) struct gfs_sbd *sdp = dip->i_sbd; struct qstr dotname; int error; @@ -1553,32 +1515,32 @@ if (ip->i_di.di_entries != 2) { if (gfs_consist_inode(ip)) gfs_dinode_print(&ip->i_di); - RETURN(GFN_RMDIRI, -EIO); + return -EIO; } error = gfs_dir_del(dip, name); if (error) - RETURN(GFN_RMDIRI, error); + return error; error = gfs_change_nlink(dip, -1); if (error) - RETURN(GFN_RMDIRI, error); + return error; dotname.len = 1; dotname.name = "."; error = gfs_dir_del(ip, &dotname); if (error) - RETURN(GFN_RMDIRI, error); + return error; dotname.len = 2; dotname.name = ".."; error = gfs_dir_del(ip, &dotname); if (error) - RETURN(GFN_RMDIRI, error); + return error; error = gfs_change_nlink(ip, -2); if (error) - RETURN(GFN_RMDIRI, error); + return error; /* This inode is being unlinked from the directory structure and we need to mark that in the log so that it isn't lost during @@ -1587,7 +1549,7 @@ gfs_trans_add_unlinked(sdp, GFS_LOG_DESC_IUL, &ip->i_num); set_bit(GLF_STICKY, &ip->i_gl->gl_flags); - RETURN(GFN_RMDIRI, 0); + return 0; } /* @@ -1604,40 +1566,39 @@ int gfs_unlink_ok(struct gfs_inode *dip, struct qstr *name, struct gfs_inode *ip) { - ENTER(GFN_UNLINK_OK) struct gfs_inum inum; unsigned int type; int error; if (IS_IMMUTABLE(ip->i_vnode) || IS_APPEND(ip->i_vnode)) - RETURN(GFN_UNLINK_OK, -EPERM); + return -EPERM; if ((dip->i_di.di_mode & S_ISVTX) && dip->i_di.di_uid != current->fsuid && ip->i_di.di_uid != current->fsuid && !capable(CAP_FOWNER)) - RETURN(GFN_UNLINK_OK, -EPERM); + return -EPERM; if (IS_APPEND(dip->i_vnode)) - RETURN(GFN_UNLINK_OK, -EPERM); + return -EPERM; error = permission(dip->i_vnode, MAY_WRITE | MAY_EXEC, NULL); if (error) - RETURN(GFN_UNLINK_OK, error); + return error; error = gfs_dir_search(dip, name, &inum, &type); if (error) - RETURN(GFN_UNLINK_OK, error); + return error; if (inum.no_formal_ino != ip->i_num.no_formal_ino) - RETURN(GFN_UNLINK_OK, -ENOENT); + return -ENOENT; if (ip->i_di.di_type != type) { gfs_consist_inode(dip); - RETURN(GFN_UNLINK_OK, -EIO); + return -EIO; } - RETURN(GFN_UNLINK_OK, 0); + return 0; } /* @@ -1654,7 +1615,6 @@ int gfs_ok_to_move(struct gfs_inode *this, struct gfs_inode *to) { - ENTER(GFN_OK_TO_MOVE) struct gfs_sbd *sdp = this->i_sbd; struct gfs_inode *tmp; struct gfs_holder to_gh, tmp_gh; @@ -1701,7 +1661,7 @@ gfs_inode_put(to); - RETURN(GFN_OK_TO_MOVE, error); + return error; } /** @@ -1719,7 +1679,6 @@ int gfs_readlinki(struct gfs_inode *ip, char **buf, unsigned int *len) { - ENTER(GFN_READLINKI) struct gfs_holder i_gh; struct buffer_head *dibh; unsigned int x; @@ -1729,7 +1688,7 @@ error = gfs_glock_nq_atime(&i_gh); if (error) { gfs_holder_uninit(&i_gh); - RETURN(GFN_READLINKI, error); + return error; } if (!ip->i_di.di_size) { @@ -1760,7 +1719,7 @@ out: gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_READLINKI, error); + return error; } /** @@ -1781,7 +1740,6 @@ int gfs_glock_nq_atime(struct gfs_holder *gh) { - ENTER(GFN_GLOCK_NQ_ATIME) struct gfs_glock *gl = gh->gh_gl; struct gfs_sbd *sdp = gl->gl_sbd; struct gfs_inode *ip = get_gl2ip(gl); @@ -1793,7 +1751,7 @@ if (gfs_assert_warn(sdp, gh->gh_flags & GL_ATIME) || gfs_assert_warn(sdp, !(gh->gh_flags & GL_ASYNC)) || gfs_assert_warn(sdp, gl->gl_ops == &gfs_inode_glops)) - RETURN(GFN_GLOCK_NQ_ATIME, -EINVAL); + return -EINVAL; /* Save original request state of lock holder */ state = gh->gh_state; @@ -1801,11 +1759,11 @@ error = gfs_glock_nq(gh); if (error) - RETURN(GFN_GLOCK_NQ_ATIME, error); + return error; if (test_bit(SDF_NOATIME, &sdp->sd_flags) || test_bit(SDF_ROFS, &sdp->sd_flags)) - RETURN(GFN_GLOCK_NQ_ATIME, 0); + return 0; curtime = get_seconds(); if (curtime - ip->i_di.di_atime >= quantum) { @@ -1816,7 +1774,7 @@ gh); error = gfs_glock_nq(gh); if (error) - RETURN(GFN_GLOCK_NQ_ATIME, error); + return error; /* Verify that atime hasn't been updated while we were trying to get exclusive lock. */ @@ -1827,7 +1785,7 @@ error = gfs_trans_begin(sdp, 1, 0); if (error == -EROFS) - RETURN(GFN_GLOCK_NQ_ATIME, 0); + return 0; if (error) goto fail; @@ -1850,11 +1808,11 @@ if (gfs_glock_is_blocking(gl)) { gfs_glock_dq(gh); gfs_holder_reinit(state, flags, gh); - RETURN(GFN_GLOCK_NQ_ATIME, gfs_glock_nq(gh)); + return gfs_glock_nq(gh); } } - RETURN(GFN_GLOCK_NQ_ATIME, 0); + return 0; fail_end_trans: gfs_trans_end(sdp); @@ -1862,7 +1820,7 @@ fail: gfs_glock_dq(gh); - RETURN(GFN_GLOCK_NQ_ATIME, error); + return error; } /** @@ -1882,7 +1840,6 @@ static int glock_compare_atime(const void *arg_a, const void *arg_b) { - ENTER(GFN_GLOCK_COMPARE_ATIME) struct gfs_holder *gh_a = *(struct gfs_holder **)arg_a; struct gfs_holder *gh_b = *(struct gfs_holder **)arg_b; struct lm_lockname *a = &gh_a->gh_gl->gl_name; @@ -1902,7 +1859,7 @@ ret = 1; } - RETURN(GFN_GLOCK_COMPARE_ATIME, ret); + return ret; } /** @@ -1918,13 +1875,12 @@ int gfs_glock_nq_m_atime(unsigned int num_gh, struct gfs_holder *ghs) { - ENTER(GFN_GLOCK_NQ_M_ATIME) struct gfs_holder **p; unsigned int x; int error = 0; if (!num_gh) - RETURN(GFN_GLOCK_NQ_M_ATIME, 0); + return 0; if (num_gh == 1) { ghs->gh_flags &= ~(LM_FLAG_TRY | GL_ASYNC); @@ -1932,12 +1888,12 @@ error = gfs_glock_nq_atime(ghs); else error = gfs_glock_nq(ghs); - RETURN(GFN_GLOCK_NQ_M_ATIME, error); + return error; } p = kmalloc(num_gh * sizeof(struct gfs_holder *), GFP_KERNEL); if (!p) - RETURN(GFN_GLOCK_NQ_M_ATIME, -ENOMEM); + return -ENOMEM; for (x = 0; x < num_gh; x++) p[x] = &ghs[x]; @@ -1960,8 +1916,7 @@ } kfree(p); - - RETURN(GFN_GLOCK_NQ_M_ATIME, error); + return error; } /** @@ -1974,12 +1929,11 @@ void gfs_try_toss_vnode(struct gfs_inode *ip) { - ENTER(GFN_TRY_TOSS_VNODE) struct inode *inode; inode = gfs_iget(ip, NO_CREATE); if (!inode) - RET(GFN_TRY_TOSS_VNODE); + return; d_prune_aliases(inode); @@ -2007,8 +1961,27 @@ inode->i_nlink = 0; iput(inode); +} + + +static int +__gfs_setattr_simple(struct gfs_inode *ip, struct iattr *attr) +{ + struct buffer_head *dibh; + int error; - RET(GFN_TRY_TOSS_VNODE); + error = gfs_get_inode_buffer(ip, &dibh); + if (!error) { + error = inode_setattr(ip->i_vnode, attr); + gfs_assert_warn(ip->i_sbd, !error); + gfs_inode_attr_out(ip); + + gfs_trans_add_bh(ip->i_gl, dibh); + gfs_dinode_out(&ip->i_di, dibh->b_data); + brelse(dibh); + } + + return error; } /** @@ -2024,31 +1997,23 @@ int gfs_setattr_simple(struct gfs_inode *ip, struct iattr *attr) { - ENTER(GFN_SETATTR_SIMPLE) - struct buffer_head *dibh; int error; + if (get_transaction) + return __gfs_setattr_simple(ip, attr); + /* Trans may require: one dinode block. */ error = gfs_trans_begin(ip->i_sbd, 1, 0); if (error) - RETURN(GFN_SETATTR_SIMPLE, error); + return error; - error = gfs_get_inode_buffer(ip, &dibh); - if (!error) { - error = inode_setattr(ip->i_vnode, attr); - gfs_assert_warn(ip->i_sbd, !error); - gfs_inode_attr_out(ip); - - gfs_trans_add_bh(ip->i_gl, dibh); - gfs_dinode_out(&ip->i_di, dibh->b_data); - brelse(dibh); - } + error = __gfs_setattr_simple(ip, attr); gfs_trans_end(ip->i_sbd); - RETURN(GFN_SETATTR_SIMPLE, error); + return error; } /** @@ -2061,7 +2026,6 @@ static void iah_make_jdata(struct gfs_glock *gl, struct gfs_inum *inum) { - ENTER(GFN_IAH_MAKE_JDATA) struct buffer_head *bh; struct gfs_dinode *di; uint32_t flags; @@ -2071,7 +2035,7 @@ /* This should only fail if we are already shutdown. */ if (gfs_assert_withdraw(gl->gl_sbd, !error)) - RET(GFN_IAH_MAKE_JDATA); + return; di = (struct gfs_dinode *)bh->b_data; @@ -2080,8 +2044,6 @@ di->di_flags = cpu_to_gfs32(flags); brelse(bh); - - RET(GFN_IAH_MAKE_JDATA); } /** @@ -2096,7 +2058,6 @@ static int iah_super_update(struct gfs_sbd *sdp) { - ENTER(GFN_IAH_SUPER_UPDATE) struct gfs_glock *gl; struct buffer_head *bh; int error; @@ -2105,7 +2066,7 @@ GFS_SB_LOCK, &gfs_meta_glops, NO_CREATE, &gl); if (gfs_assert_withdraw(sdp, !error && gl)) /* This should already be held. */ - RETURN(GFN_IAH_SUPER_UPDATE, -EINVAL); + return -EINVAL; error = gfs_dread(gl, GFS_SB_ADDR >> sdp->sd_fsb2bb_shift, DIO_START | DIO_WAIT, &bh); @@ -2117,7 +2078,7 @@ gfs_glock_put(gl); - RETURN(GFN_IAH_SUPER_UPDATE, error); + return error; } /** @@ -2140,7 +2101,6 @@ static int inode_alloc_hidden(struct gfs_sbd *sdp, struct gfs_inum *inum) { - ENTER(GFN_INODE_ALLOC_HIDDEN) struct gfs_inode *dip = sdp->sd_rooti; struct gfs_holder d_gh, i_gh; struct gfs_unlinked *ul; @@ -2148,7 +2108,7 @@ error = gfs_glock_nq_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, &d_gh); if (error) - RETURN(GFN_INODE_ALLOC_HIDDEN, error); + return error; error = dinode_alloc(dip, &ul); if (error) @@ -2209,7 +2169,7 @@ gfs_log_flush(sdp); - RETURN(GFN_INODE_ALLOC_HIDDEN, 0); + return 0; fail_end_trans: gfs_trans_end(sdp); @@ -2227,7 +2187,7 @@ fail: gfs_glock_dq_uninit(&d_gh); - RETURN(GFN_INODE_ALLOC_HIDDEN, error); + return error; } /** @@ -2240,9 +2200,7 @@ int gfs_alloc_qinode(struct gfs_sbd *sdp) { - ENTER(GFN_ALLOC_QINODE) - RETURN(GFN_ALLOC_QINODE, - inode_alloc_hidden(sdp, &sdp->sd_sb.sb_quota_di)); + return inode_alloc_hidden(sdp, &sdp->sd_sb.sb_quota_di); } /** @@ -2255,7 +2213,5 @@ int gfs_alloc_linode(struct gfs_sbd *sdp) { - ENTER(GFN_ALLOC_LINODE) - RETURN(GFN_ALLOC_LINODE, - inode_alloc_hidden(sdp, &sdp->sd_sb.sb_license_di)); + return inode_alloc_hidden(sdp, &sdp->sd_sb.sb_license_di); } --- cluster/gfs-kernel/src/gfs/inode.h 2004/10/08 22:02:50 1.3 +++ cluster/gfs-kernel/src/gfs/inode.h 2006/07/10 23:22:34 1.4 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/ioctl.c 2005/10/24 15:53:59 1.10 +++ cluster/gfs-kernel/src/gfs/ioctl.c 2006/07/10 23:22:34 1.11 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -58,7 +58,6 @@ gi_skeleton(struct gfs_inode *ip, struct gfs_ioctl *gi, gi_filler_t filler) { - ENTER(GFN_GI_SKELETON) unsigned int size = gfs_tune_get(ip->i_sbd, gt_lockdump_size); char *buf; unsigned int count = 0; @@ -69,7 +68,7 @@ buf = kmalloc(size, GFP_KERNEL); if (!buf) - RETURN(GFN_GI_SKELETON, -ENOMEM); + return -ENOMEM; error = filler(ip, gi, buf, size, &count); if (error) @@ -83,7 +82,7 @@ out: kfree(buf); - RETURN(GFN_GI_SKELETON, error); + return error; } /** @@ -105,11 +104,10 @@ unsigned int size, unsigned int *count) { - ENTER(GFN_GI_GET_COOKIE) int error = -ENOBUFS; if (gi->gi_argc != 1) - RETURN(GFN_GI_GET_COOKIE, -EINVAL); + return -EINVAL; gfs_printf("version 0\n"); gfs_printf("%lu", (unsigned long)ip->i_sbd); @@ -117,7 +115,7 @@ error = 0; out: - RETURN(GFN_GI_GET_COOKIE, error); + return error; } /** @@ -131,20 +129,19 @@ static int gi_get_super(struct gfs_sbd *sdp, struct gfs_ioctl *gi) { - ENTER(GFN_GI_GET_SUPER) struct gfs_holder sb_gh; struct buffer_head *bh; struct gfs_sb *sb; int error; if (gi->gi_argc != 1) - RETURN(GFN_GI_GET_SUPER, -EINVAL); + return -EINVAL; if (gi->gi_size != sizeof(struct gfs_sb)) - RETURN(GFN_GI_GET_SUPER, -EINVAL); + return -EINVAL; sb = kmalloc(sizeof(struct gfs_sb), GFP_KERNEL); if (!sb) - RETURN(GFN_GI_GET_SUPER, -ENOMEM); + return -ENOMEM; error = gfs_glock_nq_num(sdp, GFS_SB_LOCK, &gfs_meta_glops, @@ -172,7 +169,7 @@ out: kfree(sb); - RETURN(GFN_GI_GET_SUPER, error); + return error; } /** @@ -193,12 +190,11 @@ unsigned int size, unsigned int *count) { - ENTER(GFN_GI_GET_ARGS) struct gfs_args *args = &ip->i_sbd->sd_args; int error = -ENOBUFS; if (gi->gi_argc != 1) - RETURN(GFN_GI_GET_ARGS, -EINVAL); + return -EINVAL; gfs_printf("version 0\n"); gfs_printf("lockproto %s\n", args->ar_lockproto); @@ -216,7 +212,7 @@ error = 0; out: - RETURN(GFN_GI_GET_ARGS, error); + return error; } /** @@ -237,12 +233,11 @@ unsigned int size, unsigned int *count) { - ENTER(GFN_GI_GET_LOCKSTRUCT) struct lm_lockstruct *ls = &ip->i_sbd->sd_lockstruct; int error = -ENOBUFS; if (gi->gi_argc != 1) - RETURN(GFN_GI_GET_LOCKSTRUCT, -EINVAL); + return -EINVAL; gfs_printf("version 0\n"); gfs_printf("jid %u\n", ls->ls_jid); @@ -253,7 +248,7 @@ error = 0; out: - RETURN(GFN_GI_GET_LOCKSTRUCT, error); + return error; } /** @@ -274,16 +269,15 @@ unsigned int size, unsigned int *count) { - ENTER(GFN_GI_GET_STAT_GFS) struct gfs_stat_gfs sg; int error; if (gi->gi_argc != 1) - RETURN(GFN_GI_GET_STAT_GFS, -EINVAL); + return -EINVAL; error = gfs_stat_gfs(ip->i_sbd, &sg, TRUE); if (error) - RETURN(GFN_GI_GET_STAT_GFS, error); + return error; error = -ENOBUFS; @@ -299,7 +293,7 @@ error = 0; out: - RETURN(GFN_GI_GET_STAT_GFS, error); + return error; } /** @@ -314,13 +308,12 @@ static unsigned int handle_roll(atomic_t *a) { - ENTER(GFN_HANDLE_ROLL) int x = atomic_read(a); if (x < 0) { atomic_set(a, 0); - RETURN(GFN_HANDLE_ROLL, 0); + return 0; } - RETURN(GFN_HANDLE_ROLL, (unsigned int)x); + return (unsigned int)x; } /** @@ -341,12 +334,11 @@ unsigned int size, unsigned int *count) { - ENTER(GFN_GI_GET_COUNTERS) struct gfs_sbd *sdp = ip->i_sbd; int error = -ENOBUFS; if (gi->gi_argc != 1) - RETURN(GFN_GI_GET_COUNTERS, -EINVAL); + return -EINVAL; gfs_printf("version 0\n"); gfs_printf("sd_glock_count:locks::%d\n", @@ -419,7 +411,7 @@ error = 0; out: - RETURN(GFN_GI_GET_COUNTERS, error); + return error; } /** @@ -440,12 +432,11 @@ unsigned int size, unsigned int *count) { - ENTER(GFN_GI_GET_TUNE) struct gfs_tune *gt = &ip->i_sbd->sd_tune; - int error = -ENOBUFS; + int error = -ENOBUFS; if (gi->gi_argc != 1) - RETURN(GFN_GI_GET_TUNE, -EINVAL); + return -EINVAL; spin_lock(>->gt_spin); @@ -495,7 +486,7 @@ out: spin_unlock(>->gt_spin); - RETURN(GFN_GI_GET_TUNE, error); + return error; } #define tune_set(f, v) \ @@ -516,128 +507,127 @@ static int gi_set_tune(struct gfs_sbd *sdp, struct gfs_ioctl *gi) { - ENTER(GFN_GI_SET_TUNE) struct gfs_tune *gt = &sdp->sd_tune; char param[ARG_SIZE], value[ARG_SIZE]; unsigned int x; if (!capable(CAP_SYS_ADMIN)) - RETURN(GFN_GI_SET_TUNE, -EACCES); + return -EACCES; if (gi->gi_argc != 3) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; if (strncpy_from_user(param, gi->gi_argv[1], ARG_SIZE) < 0) - RETURN(GFN_GI_SET_TUNE, -EFAULT); + return -EFAULT; param[ARG_SIZE - 1] = 0; if (strncpy_from_user(value, gi->gi_argv[2], ARG_SIZE) < 0) - RETURN(GFN_GI_SET_TUNE, -EFAULT); + return -EFAULT; value[ARG_SIZE - 1] = 0; if (strcmp(param, "ilimit1") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_ilimit1, x); } else if (strcmp(param, "ilimit1_tries") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_ilimit1_tries, x); } else if (strcmp(param, "ilimit1_min") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_ilimit1_min, x); } else if (strcmp(param, "ilimit2") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_ilimit2, x); } else if (strcmp(param, "ilimit2_tries") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_ilimit2_tries, x); } else if (strcmp(param, "ilimit2_min") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_ilimit2_min, x); } else if (strcmp(param, "demote_secs") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_demote_secs, x); } else if (strcmp(param, "incore_log_blocks") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_incore_log_blocks, x); } else if (strcmp(param, "jindex_refresh_secs") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_jindex_refresh_secs, x); } else if (strcmp(param, "depend_secs") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_depend_secs, x); } else if (strcmp(param, "scand_secs") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_scand_secs, x); wake_up_process(sdp->sd_scand_process); } else if (strcmp(param, "recoverd_secs") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_recoverd_secs, x); wake_up_process(sdp->sd_recoverd_process); } else if (strcmp(param, "logd_secs") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_logd_secs, x); wake_up_process(sdp->sd_logd_process); } else if (strcmp(param, "quotad_secs") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_quotad_secs, x); wake_up_process(sdp->sd_quotad_process); } else if (strcmp(param, "inoded_secs") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_inoded_secs, x); wake_up_process(sdp->sd_inoded_process); } else if (strcmp(param, "quota_simul_sync") == 0) { if (sscanf(value, "%u", &x) != 1 || !x) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_quota_simul_sync, x); } else if (strcmp(param, "quota_warn_period") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_quota_warn_period, x); } else if (strcmp(param, "atime_quantum") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_atime_quantum, x); } else if (strcmp(param, "quota_quantum") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_quota_quantum, x); } else if (strcmp(param, "quota_scale") == 0) { unsigned int y; if (sscanf(value, "%u %u", &x, &y) != 2 || !y) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; spin_lock(>->gt_spin); gt->gt_quota_scale_num = x; gt->gt_quota_scale_den = y; @@ -645,7 +635,7 @@ } else if (strcmp(param, "quota_enforce") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; x = !!x; spin_lock(>->gt_spin); gt->gt_quota_enforce = x; @@ -655,7 +645,7 @@ } else if (strcmp(param, "quota_account") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; x = !!x; spin_lock(>->gt_spin); gt->gt_quota_account = x; @@ -674,90 +664,90 @@ } else if (strcmp(param, "new_files_jdata") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; x = !!x; tune_set(gt_new_files_jdata, x); } else if (strcmp(param, "new_files_directio") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; x = !!x; tune_set(gt_new_files_directio, x); } else if (strcmp(param, "max_atomic_write") == 0) { if (sscanf(value, "%u", &x) != 1 || !x) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_max_atomic_write, x); } else if (strcmp(param, "max_readahead") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_max_readahead, x); } else if (strcmp(param, "lockdump_size") == 0) { if (sscanf(value, "%u", &x) != 1 || !x) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_lockdump_size, x); } else if (strcmp(param, "stall_secs") == 0) { if (sscanf(value, "%u", &x) != 1 || !x) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_stall_secs, x); } else if (strcmp(param, "complain_secs") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_complain_secs, x); } else if (strcmp(param, "reclaim_limit") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_reclaim_limit, x); } else if (strcmp(param, "entries_per_readdir") == 0) { if (sscanf(value, "%u", &x) != 1 || !x) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_entries_per_readdir, x); } else if (strcmp(param, "prefetch_secs") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_prefetch_secs, x); } else if (strcmp(param, "statfs_slots") == 0) { if (sscanf(value, "%u", &x) != 1 || !x) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_statfs_slots, x); } else if (strcmp(param, "max_mhc") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_max_mhc, x); } else if (strcmp(param, "greedy_default") == 0) { if (sscanf(value, "%u", &x) != 1 || !x) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_greedy_default, x); } else if (strcmp(param, "greedy_quantum") == 0) { if (sscanf(value, "%u", &x) != 1 || !x) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_greedy_quantum, x); } else if (strcmp(param, "greedy_max") == 0) { if (sscanf(value, "%u", &x) != 1 || !x) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_greedy_max, x); } else if (strcmp(param, "rgrp_try_threshold") == 0) { if (sscanf(value, "%u", &x) != 1) - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; tune_set(gt_rgrp_try_threshold, x); } else - RETURN(GFN_GI_SET_TUNE, -EINVAL); + return -EINVAL; - RETURN(GFN_GI_SET_TUNE, 0); + return 0; } /** @@ -778,20 +768,19 @@ unsigned int size, unsigned int *count) { - ENTER(GFN_GI_DO_RECLAIM) uint64_t inodes, metadata; int error; if (!capable(CAP_SYS_ADMIN)) - RETURN(GFN_GI_DO_RECLAIM, -EACCES); + return -EACCES; if (gi->gi_argc != 1) - RETURN(GFN_GI_DO_RECLAIM, -EINVAL); + return -EINVAL; error = gfs_reclaim_metadata(ip->i_sbd, &inodes, &metadata); if (error) - RETURN(GFN_GI_DO_RECLAIM, error); + return error; error = -ENOBUFS; @@ -802,7 +791,7 @@ error = 0; out: - RETURN(GFN_GI_DO_RECLAIM, error); + return error; } /** @@ -816,13 +805,12 @@ static int gi_do_shrink(struct gfs_sbd *sdp, struct gfs_ioctl *gi) { - ENTER(GFN_GI_DO_SHRINK) if (!capable(CAP_SYS_ADMIN)) - RETURN(GFN_GI_DO_SHRINK, -EACCES); + return -EACCES; if (gi->gi_argc != 1) - RETURN(GFN_GI_DO_SHRINK, -EINVAL); + return -EINVAL; gfs_gl_hash_clear(sdp, FALSE); - RETURN(GFN_GI_DO_SHRINK, 0); + return 0; } /** @@ -836,19 +824,18 @@ static int gi_get_file_stat(struct gfs_inode *ip, struct gfs_ioctl *gi) { - ENTER(GFN_GI_GET_FILE_STAT) struct gfs_holder i_gh; struct gfs_dinode *di; int error; if (gi->gi_argc != 1) - RETURN(GFN_GI_GET_FILE_STAT, -EINVAL); + return -EINVAL; if (gi->gi_size != sizeof(struct gfs_dinode)) - RETURN(GFN_GI_GET_FILE_STAT, -EINVAL); + return -EINVAL; di = kmalloc(sizeof(struct gfs_dinode), GFP_KERNEL); if (!di) - RETURN(GFN_GI_GET_FILE_STAT, -ENOMEM); + return -ENOMEM; error = gfs_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh); if (error) @@ -865,7 +852,7 @@ out: kfree(di); - RETURN(GFN_GI_GET_FILE_STAT, error); + return error; } /** @@ -879,7 +866,6 @@ static int gi_set_file_flag(struct gfs_inode *ip, struct gfs_ioctl *gi) { - ENTER(GFN_GI_SET_FILE_FLAG) char buf[ARG_SIZE]; int set; uint32_t flag; @@ -888,10 +874,10 @@ int error; if (gi->gi_argc != 3) - RETURN(GFN_GI_SET_FILE_FLAG, -EINVAL); + return -EINVAL; if (strncpy_from_user(buf, gi->gi_argv[1], ARG_SIZE) < 0) - RETURN(GFN_GI_SET_FILE_FLAG, -EFAULT); + return -EFAULT; buf[ARG_SIZE - 1] = 0; if (strcmp(buf, "set") == 0) @@ -899,15 +885,15 @@ else if (strcmp(buf, "clear") == 0) set = FALSE; else - RETURN(GFN_GI_SET_FILE_FLAG, -EINVAL); + return -EINVAL; if (strncpy_from_user(buf, gi->gi_argv[2], ARG_SIZE) < 0) - RETURN(GFN_GI_SET_FILE_FLAG, -EFAULT); + return -EFAULT; buf[ARG_SIZE - 1] = 0; error = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh); if (error) - RETURN(GFN_GI_SET_FILE_FLAG, error); + return error; error = -EACCES; if (ip->i_di.di_uid != current->fsuid && !capable(CAP_FOWNER)) @@ -973,7 +959,7 @@ out: gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_GI_SET_FILE_FLAG, error); + return error; } @@ -988,13 +974,12 @@ static int gi_get_file_meta(struct gfs_inode *ip, struct gfs_ioctl *gi) { - ENTER(GFN_GI_GET_FILE_META) struct gfs_holder i_gh; struct gfs_user_buffer ub; int error; if (gi->gi_argc != 1) - RETURN(GFN_GI_GET_FILE_META, -EINVAL); + return -EINVAL; ub.ub_data = gi->gi_data; ub.ub_size = gi->gi_size; @@ -1002,7 +987,7 @@ error = gfs_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh); if (error) - RETURN(GFN_GI_GET_FILE_META, error); + return error; error = -EACCES; if (ip->i_di.di_uid != current->fsuid && !capable(CAP_FOWNER)) @@ -1030,7 +1015,7 @@ out: gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_GI_GET_FILE_META, error); + return error; } /** @@ -1045,11 +1030,10 @@ static int gi_do_file_flush(struct gfs_inode *ip, struct gfs_ioctl *gi) { - ENTER(GFN_GI_DO_FILE_FLUSH) if (gi->gi_argc != 1) - RETURN(GFN_GI_DO_FILE_FLUSH, -EINVAL); + return -EINVAL; gfs_glock_force_drop(ip->i_gl); - RETURN(GFN_GI_DO_FILE_FLUSH, 0); + return 0; } /** @@ -1063,26 +1047,25 @@ static struct gfs_inode * gi2hip(struct gfs_sbd *sdp, struct gfs_ioctl *gi) { - ENTER(GFN_GI2HIP) char buf[ARG_SIZE]; if (gi->gi_argc != 2) - RETURN(GFN_GI2HIP, ERR_PTR(-EINVAL)); + return ERR_PTR(-EINVAL); if (strncpy_from_user(buf, gi->gi_argv[1], ARG_SIZE) < 0) - RETURN(GFN_GI2HIP, ERR_PTR(-EFAULT)); + return ERR_PTR(-EFAULT); buf[ARG_SIZE - 1] = 0; if (strcmp(buf, "jindex") == 0) - RETURN(GFN_GI2HIP, sdp->sd_jiinode); + return sdp->sd_jiinode; else if (strcmp(buf, "rindex") == 0) - RETURN(GFN_GI2HIP, sdp->sd_riinode); + return sdp->sd_riinode; else if (strcmp(buf, "quota") == 0) - RETURN(GFN_GI2HIP, sdp->sd_qinode); + return sdp->sd_qinode; else if (strcmp(buf, "license") == 0) - RETURN(GFN_GI2HIP, sdp->sd_linode); + return sdp->sd_linode; else - RETURN(GFN_GI2HIP, ERR_PTR(-EINVAL)); + return ERR_PTR(-EINVAL); } /** @@ -1096,7 +1079,6 @@ static int gi_get_hfile_stat(struct gfs_sbd *sdp, struct gfs_ioctl *gi) { - ENTER(GFN_GI_GET_HFILE_STAT) struct gfs_inode *ip; struct gfs_dinode *di; struct gfs_holder i_gh; @@ -1104,14 +1086,14 @@ ip = gi2hip(sdp, gi); if (IS_ERR(ip)) - RETURN(GFN_GI_GET_HFILE_STAT, PTR_ERR(ip)); + return PTR_ERR(ip); if (gi->gi_size != sizeof(struct gfs_dinode)) - RETURN(GFN_GI_GET_HFILE_STAT, -EINVAL); + return -EINVAL; di = kmalloc(sizeof(struct gfs_dinode), GFP_KERNEL); if (!di) - RETURN(GFN_GI_GET_HFILE_STAT, -ENOMEM); + return -ENOMEM; error = gfs_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh); if (error) @@ -1128,7 +1110,7 @@ out: kfree(di); - RETURN(GFN_GI_GET_HFILE_STAT, error); + return error; } /** @@ -1142,31 +1124,30 @@ static int gi_do_hfile_read(struct gfs_sbd *sdp, struct gfs_ioctl *gi) { - ENTER(GFN_GI_DO_HFILE_READ) struct gfs_inode *ip; struct gfs_holder i_gh; int error; if (!capable(CAP_SYS_ADMIN)) - RETURN(GFN_GI_DO_HFILE_READ, -EACCES); + return -EACCES; ip = gi2hip(sdp, gi); if (IS_ERR(ip)) - RETURN(GFN_GI_DO_HFILE_READ, PTR_ERR(ip)); + return PTR_ERR(ip); if (!access_ok(VERIFY_WRITE, gi->gi_data, gi->gi_size)) - RETURN(GFN_GI_DO_HFILE_READ, -EFAULT); + return -EFAULT; error = gfs_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &i_gh); if (error) - RETURN(GFN_GI_DO_HFILE_READ, error); + return error; error = gfs_readi(ip, gi->gi_data, gi->gi_offset, gi->gi_size, gfs_copy2user); gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_GI_DO_HFILE_READ, error); + return error; } /** @@ -1180,7 +1161,6 @@ static int gi_do_hfile_write(struct gfs_sbd *sdp, struct gfs_ioctl *gi) { - ENTER(GFN_GI_DO_HFILE_WRITE) struct gfs_inode *ip; struct gfs_alloc *al = NULL; struct gfs_holder i_gh; @@ -1189,21 +1169,21 @@ int error; if (!capable(CAP_SYS_ADMIN)) - RETURN(GFN_GI_DO_HFILE_WRITE, -EACCES); + return -EACCES; ip = gi2hip(sdp, gi); if (IS_ERR(ip)) - RETURN(GFN_GI_DO_HFILE_WRITE, PTR_ERR(ip)); + return PTR_ERR(ip); if (!access_ok(VERIFY_READ, gi->gi_data, gi->gi_size)) - RETURN(GFN_GI_DO_HFILE_WRITE, -EFAULT); + return -EFAULT; gfs_write_calc_reserv(ip, gi->gi_size, &data_blocks, &ind_blocks); error = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, LM_FLAG_PRIORITY | GL_SYNC, &i_gh); if (error) - RETURN(GFN_GI_DO_HFILE_WRITE, error); + return error; if (!gfs_is_jdata(ip)) { gfs_consist_inode(ip); @@ -1271,7 +1251,7 @@ ip->i_gl->gl_vn++; gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_GI_DO_HFILE_WRITE, error); + return error; } /** @@ -1285,28 +1265,27 @@ static int gi_do_hfile_trunc(struct gfs_sbd *sdp, struct gfs_ioctl *gi) { - ENTER(GFN_GI_DO_HFILE_TRUNC) struct gfs_inode *ip; struct gfs_holder i_gh; int error; if (!capable(CAP_SYS_ADMIN)) - RETURN(GFN_GI_DO_HFILE_TRUNC, -EACCES); + return -EACCES; ip = gi2hip(sdp, gi); if (IS_ERR(ip)) - RETURN(GFN_GI_DO_HFILE_TRUNC, PTR_ERR(ip)); + return PTR_ERR(ip); error = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_SYNC, &i_gh); if (error) - RETURN(GFN_GI_DO_HFILE_TRUNC, error); + return error; error = gfs_truncatei(ip, gi->gi_offset, NULL); ip->i_gl->gl_vn++; gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_GI_DO_HFILE_TRUNC, error); + return error; } /** @@ -1320,12 +1299,11 @@ static int gi_do_quota_sync(struct gfs_sbd *sdp, struct gfs_ioctl *gi) { - ENTER(GFN_GI_DO_QUOTA_SYNC) if (!capable(CAP_SYS_ADMIN)) - RETURN(GFN_GI_DO_QUOTA_SYNC, -EACCES); + return -EACCES; if (gi->gi_argc != 1) - RETURN(GFN_GI_DO_QUOTA_SYNC, -EINVAL); - RETURN(GFN_GI_DO_QUOTA_SYNC, gfs_quota_sync(sdp)); + return -EINVAL; + return gfs_quota_sync(sdp); } /** @@ -1339,18 +1317,17 @@ static int gi_do_quota_refresh(struct gfs_sbd *sdp, struct gfs_ioctl *gi) { - ENTER(GFN_GI_DO_QUOTA_REFRESH) char buf[ARG_SIZE]; int user; uint32_t id; if (!capable(CAP_SYS_ADMIN)) - RETURN(GFN_GI_DO_QUOTA_REFRESH, -EACCES); + return -EACCES; if (gi->gi_argc != 2) - RETURN(GFN_GI_DO_QUOTA_REFRESH, -EINVAL); + return -EINVAL; if (strncpy_from_user(buf, gi->gi_argv[1], ARG_SIZE) < 0) - RETURN(GFN_GI_DO_QUOTA_REFRESH, -EFAULT); + return -EFAULT; buf[ARG_SIZE - 1] = 0; switch (buf[0]) { @@ -1361,17 +1338,16 @@ user = FALSE; break; default: - RETURN(GFN_GI_DO_QUOTA_REFRESH, -EINVAL); + return -EINVAL; } if (buf[1] != ':') - RETURN(GFN_GI_DO_QUOTA_REFRESH, -EINVAL); + return -EINVAL; if (sscanf(buf + 2, "%u", &id) != 1) - RETURN(GFN_GI_DO_QUOTA_REFRESH, -EINVAL); + return -EINVAL; - RETURN(GFN_GI_DO_QUOTA_REFRESH, - gfs_quota_refresh(sdp, user, id)); + return gfs_quota_refresh(sdp, user, id); } /** @@ -1385,7 +1361,6 @@ static int gi_do_quota_read(struct gfs_sbd *sdp, struct gfs_ioctl *gi) { - ENTER(GFN_GI_DO_QUOTA_READ) char buf[ARG_SIZE]; int user; uint32_t id; @@ -1393,12 +1368,12 @@ int error; if (gi->gi_argc != 2) - RETURN(GFN_GI_DO_QUOTA_READ, -EINVAL); + return -EINVAL; if (gi->gi_size != sizeof(struct gfs_quota)) - RETURN(GFN_GI_DO_QUOTA_READ, -EINVAL); + return -EINVAL; if (strncpy_from_user(buf, gi->gi_argv[1], ARG_SIZE) < 0) - RETURN(GFN_GI_DO_QUOTA_READ, -EFAULT); + return -EFAULT; buf[ARG_SIZE - 1] = 0; switch (buf[0]) { @@ -1409,23 +1384,23 @@ user = FALSE; break; default: - RETURN(GFN_GI_DO_QUOTA_READ, -EINVAL); + return -EINVAL; } if (buf[1] != ':') - RETURN(GFN_GI_DO_QUOTA_READ, -EINVAL); + return -EINVAL; if (sscanf(buf + 2, "%u", &id) != 1) - RETURN(GFN_GI_DO_QUOTA_READ, -EINVAL); + return -EINVAL; error = gfs_quota_read(sdp, user, id, &q); if (error) - RETURN(GFN_GI_DO_QUOTA_READ, error); + return error; if (copy_to_user(gi->gi_data, &q, sizeof(struct gfs_quota))) - RETURN(GFN_GI_DO_QUOTA_READ, -EFAULT); + return -EFAULT; - RETURN(GFN_GI_DO_QUOTA_READ, 0); + return 0; } /** @@ -1439,7 +1414,6 @@ int gfs_ioctl_i(struct gfs_inode *ip, void *arg) { - ENTER(GFN_IOCTL_I) struct gfs_ioctl *gi_user = (struct gfs_ioctl *)arg; struct gfs_ioctl gi; char **argv; @@ -1447,12 +1421,12 @@ int error = -EFAULT; if (copy_from_user(&gi, gi_user, sizeof(struct gfs_ioctl))) - RETURN(GFN_IOCTL_I, -EFAULT); + return -EFAULT; if (!gi.gi_argc) - RETURN(GFN_IOCTL_I, -EINVAL); + return -EINVAL; argv = kmalloc(gi.gi_argc * sizeof(char *), GFP_KERNEL); if (!argv) - RETURN(GFN_IOCTL_I, -ENOMEM); + return -ENOMEM; if (copy_from_user(argv, gi.gi_argv, gi.gi_argc * sizeof(char *))) goto out; @@ -1510,7 +1484,7 @@ out: kfree(argv); - RETURN(GFN_IOCTL_I, error); + return error; } --- cluster/gfs-kernel/src/gfs/ioctl.h 2005/01/04 10:07:12 1.2 +++ cluster/gfs-kernel/src/gfs/ioctl.h 2006/07/10 23:22:34 1.3 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/lm.c 2006/01/09 21:12:24 1.10 +++ cluster/gfs-kernel/src/gfs/lm.c 2006/07/10 23:22:34 1.11 @@ -1,87 +1,65 @@ -/****************************************************************************** -******************************************************************************* -** -** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 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. -** -******************************************************************************* -******************************************************************************/ +/* + * 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 v.2. + */ #include #include -#include #include -#include #include #include +#include +#include #include "gfs.h" -#include "dio.h" +#include "lm_interface.h" +#include "incore.h" #include "glock.h" #include "lm.h" #include "super.h" - -/** - * lm_cb - - * @fsdata: - * @type: - * @data: - * - */ - -static void -lm_cb(lm_fsdata_t *fsdata, unsigned int type, void *data) -{ - ENTER(GFN_LM_CB) - if (type == LM_CB_ASYNC) - atomic_dec(&((struct gfs_sbd *)fsdata)->sd_lm_outstanding); - gfs_glock_cb(fsdata, type, data); - RET(GFN_LM_CB); -} +#include "util.h" +#include "lvb.h" /** * gfs_lm_mount - mount a locking protocol * @sdp: the filesystem * @args: mount arguements - * @silent: if TRUE, don't complain if the FS isn't a GFS fs + * @silent: if 1, don't complain if the FS isn't a GFS fs * * Returns: errno */ -int -gfs_lm_mount(struct gfs_sbd *sdp, int silent) +int gfs_lm_mount(struct gfs_sbd *sdp, int silent) { - ENTER(GFN_LM_MOUNT) - char *proto = sdp->sd_proto_name, *table = sdp->sd_table_name; + char *proto = sdp->sd_proto_name; + char *table = sdp->sd_table_name; int flags = 0; int error; if (sdp->sd_args.ar_spectator) flags |= LM_MFLAG_SPECTATOR; - printk("GFS: Trying to join cluster \"%s\", \"%s\"\n", - proto, table); + printk("Trying to join cluster \"%s\", \"%s\"\n", proto, table); - atomic_inc(&sdp->sd_lm_outstanding); - error = gfs_mount_lockproto(proto, table, sdp->sd_args.ar_hostdata, - lm_cb, sdp, - GFS_MIN_LVB_SIZE, flags, - &sdp->sd_lockstruct, &sdp->sd_kobj); - atomic_dec(&sdp->sd_lm_outstanding); + error = gfs2_mount_lockproto(proto, table, sdp->sd_args.ar_hostdata, + gfs_glock_cb, sdp, + GFS_MIN_LVB_SIZE, flags, + &sdp->sd_lockstruct, &sdp->sd_kobj); if (error) { - printk("GFS: can't mount proto = %s, table = %s, hostdata = %s\n", - proto, table, sdp->sd_args.ar_hostdata); + printk("can't mount proto=%s, table=%s, hostdata=%s\n", + proto, table, sdp->sd_args.ar_hostdata); goto out; } if (gfs_assert_warn(sdp, sdp->sd_lockstruct.ls_lockspace) || gfs_assert_warn(sdp, sdp->sd_lockstruct.ls_ops) || - gfs_assert_warn(sdp, sdp->sd_lockstruct.ls_lvb_size >= GFS_MIN_LVB_SIZE)) { - gfs_unmount_lockproto(&sdp->sd_lockstruct); + gfs_assert_warn(sdp, sdp->sd_lockstruct.ls_lvb_size >= + GFS_MIN_LVB_SIZE)) { + gfs2_unmount_lockproto(&sdp->sd_lockstruct); goto out; } @@ -91,402 +69,173 @@ snprintf(sdp->sd_fsname, 256, "%s.%u", table, sdp->sd_lockstruct.ls_jid); - printk("GFS: fsid=%s: Joined cluster. Now mounting FS...\n", - sdp->sd_fsname); + printk("Joined cluster. Now mounting FS...\n"); + if ((sdp->sd_lockstruct.ls_flags & LM_LSFLAG_LOCAL) && + !sdp->sd_args.ar_ignore_local_fs) { + sdp->sd_args.ar_localflocks = 1; + sdp->sd_args.ar_localcaching = 1; + } out: - RETURN(GFN_LM_MOUNT, error); + return error; } -/** - * gfs_lm_others_may_mount - - * @sdp: - * - */ - -void -gfs_lm_others_may_mount(struct gfs_sbd *sdp) +void gfs_lm_others_may_mount(struct gfs_sbd *sdp) { - ENTER(GFN_LM_OTHERS_MAY_MOUNT) - atomic_inc(&sdp->sd_lm_outstanding); if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) - sdp->sd_lockstruct.ls_ops->lm_others_may_mount(sdp->sd_lockstruct.ls_lockspace); - atomic_dec(&sdp->sd_lm_outstanding); - RET(GFN_LM_OTHERS_MAY_MOUNT); + sdp->sd_lockstruct.ls_ops->lm_others_may_mount( + sdp->sd_lockstruct.ls_lockspace); } -/** - * gfs_lm_unmount - Unmount lock protocol - * @sdp: The GFS superblock - * - */ - -void -gfs_lm_unmount(struct gfs_sbd *sdp) +void gfs_lm_unmount(struct gfs_sbd *sdp) { - ENTER(GFN_LM_UNMOUNT) - atomic_inc(&sdp->sd_lm_outstanding); if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) - gfs_unmount_lockproto(&sdp->sd_lockstruct); - atomic_dec(&sdp->sd_lm_outstanding); - RET(GFN_LM_UNMOUNT); + gfs2_unmount_lockproto(&sdp->sd_lockstruct); } -/** - * gfs_lm_withdraw - - * @sdp: - * - * Returns: -1 if this call withdrew the machine, - * 0 if it was already withdrawn - */ - -int -gfs_lm_withdraw(struct gfs_sbd *sdp, char *fmt, ...) +int gfs_lm_withdraw(struct gfs_sbd *sdp, char *fmt, ...) { - ENTER(GFN_LM_WITHDRAW) va_list args; if (test_and_set_bit(SDF_SHUTDOWN, &sdp->sd_flags)) - RETURN(GFN_LM_WITHDRAW, 0); + return 0; va_start(args, fmt); vprintk(fmt, args); va_end(args); - printk("GFS: fsid=%s: about to withdraw from the cluster\n", - sdp->sd_fsname); + printk("about to withdraw from the cluster\n"); + BUG_ON(sdp->sd_args.ar_debug); + - if (sdp->sd_args.ar_debug) - BUG(); + printk("waiting for outstanding I/O\n"); - printk("GFS: fsid=%s: waiting for outstanding I/O\n", - sdp->sd_fsname); + /* FIXME: suspend dm device so oustanding bio's complete + and all further io requests fail */ - while (atomic_read(&sdp->sd_bio_outstanding)) { - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(HZ / 10); - } -/* - * I'm still not sure if we want to do this. If we do, we need to - * add code to cancel outstanding requests. - * - while (atomic_read(&sdp->sd_lm_outstanding)) { - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(HZ / 10); - } - */ - - printk("GFS: fsid=%s: telling LM to withdraw\n", - sdp->sd_fsname); - - atomic_inc(&sdp->sd_lm_outstanding); - gfs_withdraw_lockproto(&sdp->sd_lockstruct); - atomic_dec(&sdp->sd_lm_outstanding); + printk("telling LM to withdraw\n"); + gfs2_withdraw_lockproto(&sdp->sd_lockstruct); + printk("withdrawn\n"); + dump_stack(); - printk("GFS: fsid=%s: withdrawn\n", - sdp->sd_fsname); - - RETURN(GFN_LM_WITHDRAW, -1); + return -1; } -/** - * gfs_lm_get_lock - - * @sdp: - * @name: - * @lockp: - * - * Returns: errno - */ - -int -gfs_lm_get_lock(struct gfs_sbd *sdp, - struct lm_lockname *name, lm_lock_t **lockp) +int gfs_lm_get_lock(struct gfs_sbd *sdp, struct lm_lockname *name, + lm_lock_t **lockp) { - ENTER(GFN_LM_GET_LOCK) int error; - - atomic_inc(&sdp->sd_lm_outstanding); if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) error = -EIO; else - error = sdp->sd_lockstruct.ls_ops->lm_get_lock(sdp->sd_lockstruct.ls_lockspace, - name, lockp); - atomic_dec(&sdp->sd_lm_outstanding); - - RETURN(GFN_LM_GET_LOCK, error); + error = sdp->sd_lockstruct.ls_ops->lm_get_lock( + sdp->sd_lockstruct.ls_lockspace, name, lockp); + return error; } -/** - * gfs_lm_put_lock - - * @sdp: - * @lock: - * - */ - -void -gfs_lm_put_lock(struct gfs_sbd *sdp, lm_lock_t *lock) +void gfs_lm_put_lock(struct gfs_sbd *sdp, lm_lock_t *lock) { - ENTER(GFN_LM_PUT_LOCK) - atomic_inc(&sdp->sd_lm_outstanding); if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) sdp->sd_lockstruct.ls_ops->lm_put_lock(lock); - atomic_dec(&sdp->sd_lm_outstanding); - RET(GFN_LM_PUT_LOCK); } -/** - * gfs_lm_lock - - * @sdp: - * @lock: - * @cur_state: - * @req_state: - * @flags: - * - * Returns: - */ - -unsigned int -gfs_lm_lock(struct gfs_sbd *sdp, lm_lock_t *lock, - unsigned int cur_state, unsigned int req_state, - unsigned int flags) +unsigned int gfs_lm_lock(struct gfs_sbd *sdp, lm_lock_t *lock, + unsigned int cur_state, unsigned int req_state, + unsigned int flags) { - ENTER(GFN_LM_LOCK) int ret; - - atomic_inc(&sdp->sd_lm_outstanding); if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) ret = 0; else ret = sdp->sd_lockstruct.ls_ops->lm_lock(lock, cur_state, req_state, flags); - if (ret != LM_OUT_ASYNC) - atomic_dec(&sdp->sd_lm_outstanding); - - RETURN(GFN_LM_LOCK, ret); + return ret; } -/** - * gfs_lm_lock - - * @sdp: - * @lock: - * @cur_state: - * - * Returns: - */ - -unsigned int -gfs_lm_unlock(struct gfs_sbd *sdp, lm_lock_t *lock, - unsigned int cur_state) +unsigned int gfs_lm_unlock(struct gfs_sbd *sdp, lm_lock_t *lock, + unsigned int cur_state) { - ENTER(GFN_LM_UNLOCK) int ret; - - atomic_inc(&sdp->sd_lm_outstanding); if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) ret = 0; else ret = sdp->sd_lockstruct.ls_ops->lm_unlock(lock, cur_state); - if (ret != LM_OUT_ASYNC) - atomic_dec(&sdp->sd_lm_outstanding); - - RETURN(GFN_LM_UNLOCK, ret); + return ret; } -/** - * gfs_lm_cancel - - * @sdp: - * @lock: - * - */ - -void -gfs_lm_cancel(struct gfs_sbd *sdp, lm_lock_t *lock) +void gfs_lm_cancel(struct gfs_sbd *sdp, lm_lock_t *lock) { - ENTER(GFN_LM_CANCEL) - atomic_inc(&sdp->sd_lm_outstanding); if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) sdp->sd_lockstruct.ls_ops->lm_cancel(lock); - atomic_dec(&sdp->sd_lm_outstanding); - RET(GFN_LM_CANCEL); } -/** - * gfs_lm_hold_lvb - - * @sdp: - * @lock: - * @lvbp: - * - * Returns: errno - */ - -int -gfs_lm_hold_lvb(struct gfs_sbd *sdp, lm_lock_t *lock, char **lvbp) +int gfs_lm_hold_lvb(struct gfs_sbd *sdp, lm_lock_t *lock, char **lvbp) { - ENTER(GFN_LM_HOLD_LVB) int error; - - atomic_inc(&sdp->sd_lm_outstanding); if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) error = -EIO; else error = sdp->sd_lockstruct.ls_ops->lm_hold_lvb(lock, lvbp); - atomic_dec(&sdp->sd_lm_outstanding); - - RETURN(GFN_LM_HOLD_LVB, error); + return error; } -/** - * gfs_lm_unhold_lvb - - * @sdp: - * @lock: - * @lvb: - * - */ - -void -gfs_lm_unhold_lvb(struct gfs_sbd *sdp, lm_lock_t *lock, char *lvb) +void gfs_lm_unhold_lvb(struct gfs_sbd *sdp, lm_lock_t *lock, char *lvb) { - ENTER(GFN_LM_UNHOLD_LVB) - atomic_inc(&sdp->sd_lm_outstanding); if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) sdp->sd_lockstruct.ls_ops->lm_unhold_lvb(lock, lvb); - atomic_dec(&sdp->sd_lm_outstanding); - RET(GFN_LM_UNHOLD_LVB); } -/** - * gfs_lm_sync_lvb - - * @sdp: - * @lock: - * @lvb: - * - */ - -void -gfs_lm_sync_lvb(struct gfs_sbd *sdp, lm_lock_t *lock, char *lvb) +void gfs_lm_sync_lvb(struct gfs_sbd *sdp, lm_lock_t *lock, char *lvb) { - ENTER(GFN_LM_SYNC_LVB) - atomic_inc(&sdp->sd_lm_outstanding); if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) sdp->sd_lockstruct.ls_ops->lm_sync_lvb(lock, lvb); - atomic_dec(&sdp->sd_lm_outstanding); - RET(GFN_LM_SYNC_LVB); } -/** - * gfs_lm_plock_get - - * @sdp: - * @name: - * @file: - * @fl: - * - * Returns: errno - */ - -int -gfs_lm_plock_get(struct gfs_sbd *sdp, - struct lm_lockname *name, - struct file *file, struct file_lock *fl) +int gfs_lm_plock_get(struct gfs_sbd *sdp, struct lm_lockname *name, + struct file *file, struct file_lock *fl) { - ENTER(GFN_LM_PLOCK_GET) int error; - - atomic_inc(&sdp->sd_lm_outstanding); if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) error = -EIO; else error = sdp->sd_lockstruct.ls_ops->lm_plock_get( sdp->sd_lockstruct.ls_lockspace, name, file, fl); - atomic_dec(&sdp->sd_lm_outstanding); - - RETURN(GFN_LM_PLOCK_GET, error); + return error; } -/** - * gfs_lm_plock - - * @sdp: - * @name: - * @file: - * @cmd: - * @fl: - * - * Returns: errno - */ - -int -gfs_lm_plock(struct gfs_sbd *sdp, - struct lm_lockname *name, - struct file *file, int cmd, struct file_lock *fl) +int gfs_lm_plock(struct gfs_sbd *sdp, struct lm_lockname *name, + struct file *file, int cmd, struct file_lock *fl) { - ENTER(GFN_LM_PLOCK) int error; - - atomic_inc(&sdp->sd_lm_outstanding); if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) error = -EIO; else error = sdp->sd_lockstruct.ls_ops->lm_plock( sdp->sd_lockstruct.ls_lockspace, name, file, cmd, fl); - atomic_dec(&sdp->sd_lm_outstanding); - - RETURN(GFN_LM_PLOCK, error); + return error; } -/** - * gfs_lm_punlock - - * @sdp: - * @name: - * @file: - * @fl: - * - * Returns: errno - */ - -int -gfs_lm_punlock(struct gfs_sbd *sdp, - struct lm_lockname *name, - struct file *file, struct file_lock *fl) +int gfs_lm_punlock(struct gfs_sbd *sdp, struct lm_lockname *name, + struct file *file, struct file_lock *fl) { - ENTER(GFN_LM_PUNLOCK) int error; - - atomic_inc(&sdp->sd_lm_outstanding); if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) error = -EIO; else error = sdp->sd_lockstruct.ls_ops->lm_punlock( sdp->sd_lockstruct.ls_lockspace, name, file, fl); - atomic_dec(&sdp->sd_lm_outstanding); - - RETURN(GFN_LM_PUNLOCK, error); + return error; } -/** - * gfs_lm_recovery_done - - * @sdp: - * @jid: - * @message: - * - */ - -void -gfs_lm_recovery_done(struct gfs_sbd *sdp, - unsigned int jid, unsigned int message) +void gfs_lm_recovery_done(struct gfs_sbd *sdp, unsigned int jid, + unsigned int message) { - ENTER(GFN_LM_RECOVERY_DONE) - - atomic_inc(&sdp->sd_lm_outstanding); if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) - sdp->sd_lockstruct.ls_ops->lm_recovery_done(sdp->sd_lockstruct.ls_lockspace, - jid, - message); - atomic_dec(&sdp->sd_lm_outstanding); - - RET(GFN_LM_RECOVERY_DONE); + sdp->sd_lockstruct.ls_ops->lm_recovery_done( + sdp->sd_lockstruct.ls_lockspace, jid, message); } - --- cluster/gfs-kernel/src/gfs/lm.h 2004/12/18 03:11:13 1.1 +++ cluster/gfs-kernel/src/gfs/lm.h 2006/07/10 23:22:34 1.2 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/log.c 2005/05/04 16:49:23 1.18 +++ cluster/gfs-kernel/src/gfs/log.c 2006/07/10 23:22:34 1.19 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -59,7 +59,6 @@ unsigned int gfs_struct2blk(struct gfs_sbd *sdp, unsigned int nstruct, unsigned int ssize) { - ENTER(GFN_STRUCT2BLK) unsigned int blks; unsigned int first, second; @@ -71,7 +70,7 @@ blks += DIV_RU(nstruct - first, second); } - RETURN(GFN_STRUCT2BLK, blks); + return blks; } /** @@ -85,9 +84,7 @@ unsigned int gfs_blk2seg(struct gfs_sbd *sdp, unsigned int blocks) { - ENTER(GFN_BLK2SEG) - RETURN(GFN_BLK2SEG, - DIV_RU(blocks, sdp->sd_sb.sb_seg_size - 1)); + return DIV_RU(blocks, sdp->sd_sb.sb_seg_size - 1); } /** @@ -145,7 +142,6 @@ void gfs_ail_start(struct gfs_sbd *sdp, int flags) { - ENTER(GFN_AIL_START) struct list_head *head = &sdp->sd_log_ail; struct list_head *first, *tmp; struct gfs_trans *first_tr, *tr; @@ -154,7 +150,7 @@ if (list_empty(head)) { gfs_log_unlock(sdp); - RET(GFN_AIL_START); + return; } first = head->prev; @@ -173,8 +169,6 @@ } gfs_log_unlock(sdp); - - RET(GFN_AIL_START); } /** @@ -190,7 +184,6 @@ static uint64_t current_tail(struct gfs_sbd *sdp) { - ENTER(GFN_CURRENT_TAIL) struct gfs_trans *tr; uint64_t tail; @@ -199,7 +192,7 @@ if (!gfs_log_is_header(sdp, tail)) { tail--; - gfs_assert(sdp, gfs_log_is_header(sdp, tail),); + gfs_assert(sdp, gfs_log_is_header(sdp, tail), ); } } else { tr = list_entry(sdp->sd_log_ail.prev, @@ -207,7 +200,7 @@ tail = tr->tr_first_head; } - RETURN(GFN_CURRENT_TAIL, tail); + return tail; } /** @@ -226,7 +219,6 @@ int gfs_ail_empty(struct gfs_sbd *sdp) { - ENTER(GFN_AIL_EMPTY) struct list_head *head, *tmp, *prev; struct gfs_trans *tr; uint64_t oldtail, newtail; @@ -265,7 +257,7 @@ gfs_log_unlock(sdp); - RETURN(GFN_AIL_EMPTY, ret); + return ret; } /** @@ -280,13 +272,13 @@ int gfs_log_reserve(struct gfs_sbd *sdp, unsigned int segments, int jump_queue) { - ENTER(GFN_LOG_RESERVE) struct list_head list; unsigned int try = 0; - if (gfs_assert_warn(sdp, segments) || - gfs_assert_warn(sdp, segments < sdp->sd_jdesc.ji_nsegment)) - RETURN(GFN_LOG_RESERVE, -EINVAL); + if (gfs_assert_warn(sdp, segments)) + return -EINVAL; + if (gfs_assert_warn(sdp, segments < sdp->sd_jdesc.ji_nsegment)) + return -EINVAL; INIT_LIST_HEAD(&list); @@ -334,7 +326,7 @@ yield(); } - RETURN(GFN_LOG_RESERVE, 0); + return 0; } /** @@ -347,13 +339,11 @@ void gfs_log_release(struct gfs_sbd *sdp, unsigned int segments) { - ENTER(GFN_LOG_RELEASE) spin_lock(&sdp->sd_log_seg_lock); sdp->sd_log_seg_free += segments; gfs_assert(sdp, sdp->sd_log_seg_free + sdp->sd_log_seg_ail2 <= sdp->sd_jdesc.ji_nsegment,); spin_unlock(&sdp->sd_log_seg_lock); - RET(GFN_LOG_RELEASE); } /** @@ -384,7 +374,6 @@ static struct gfs_log_buf * log_get_header(struct gfs_sbd *sdp, struct gfs_trans *tr, int next) { - ENTER(GFN_LOG_GET_HEADER) struct gfs_log_buf *lb; struct list_head *bmem; struct gfs_log_header header; @@ -444,7 +433,7 @@ /* Find next log buffer to fill */ log_incr_head(sdp, &tr->tr_log_head); - RETURN(GFN_LOG_GET_HEADER, lb); + return lb; } /** @@ -464,7 +453,6 @@ struct gfs_log_buf * gfs_log_get_buf(struct gfs_sbd *sdp, struct gfs_trans *tr) { - ENTER(GFN_LOG_GET_BUF) struct gfs_log_buf *lb; struct list_head *bmem; @@ -496,7 +484,7 @@ /* Find next log buffer to fill */ log_incr_head(sdp, &tr->tr_log_head); - RETURN(GFN_LOG_GET_BUF, lb); + return lb; } /** @@ -519,7 +507,6 @@ gfs_log_fake_buf(struct gfs_sbd *sdp, struct gfs_trans *tr, char *data, struct buffer_head *unlock) { - ENTER(GFN_LOG_FAKE_BUF) struct gfs_log_buf *lb; if (gfs_log_is_header(sdp, tr->tr_log_head)) @@ -540,8 +527,6 @@ /* Find next log buffer to fill */ log_incr_head(sdp, &tr->tr_log_head); - - RET(GFN_LOG_FAKE_BUF); } /** @@ -558,7 +543,6 @@ static void check_seg_usage(struct gfs_sbd *sdp, struct gfs_trans *tr) { - ENTER(GFN_CHECK_SEG_USAGE) struct gfs_jindex *jdesc = &sdp->sd_jdesc; unsigned int dist; unsigned int segments; @@ -607,8 +591,6 @@ break; } } - - EXIT(GFN_CHECK_SEG_USAGE) } /** @@ -626,7 +608,6 @@ static void log_free_buf(struct gfs_sbd *sdp, struct gfs_log_buf *lb) { - ENTER(GFN_LOG_FREE_BUF) char *bmem; bmem = lb->lb_bh.b_data; @@ -638,8 +619,6 @@ kfree(bmem); kfree(lb); - - EXIT(GFN_LOG_FREE_BUF) } /** @@ -657,7 +636,6 @@ static int sync_trans(struct gfs_sbd *sdp, struct gfs_trans *tr) { - ENTER(GFN_SYNC_TRANS) struct list_head *tmp, *head, *prev; struct gfs_log_descriptor desc; struct gfs_log_buf *lb; @@ -707,7 +685,7 @@ log_free_buf(sdp, lb); } - RETURN(GFN_SYNC_TRANS, error); + return error; } /** @@ -723,7 +701,6 @@ static int commit_trans(struct gfs_sbd *sdp, struct gfs_trans *tr) { - ENTER(GFN_COMMIT_TRANS) struct gfs_log_buf *lb; int error; @@ -742,7 +719,7 @@ } log_free_buf(sdp, lb); - RETURN(GFN_COMMIT_TRANS, error); + return error; } /** @@ -756,7 +733,6 @@ static int disk_commit(struct gfs_sbd *sdp, struct gfs_trans *tr) { - ENTER(GFN_DISK_COMMIT) uint64_t last_dump, last_dump_wrap; int error = 0; @@ -802,8 +778,8 @@ if (sdp->sd_log_head > tr->tr_log_head) sdp->sd_log_wrap++; - sdp->sd_log_head = tr->tr_log_head; - sdp->sd_sequence++; + sdp->sd_log_head = tr->tr_log_head; + sdp->sd_sequence++; out: gfs_assert_warn(sdp, !tr->tr_num_free_bufs && @@ -811,7 +787,7 @@ gfs_assert_warn(sdp, !tr->tr_num_free_bmem && list_empty(&tr->tr_free_bmem)); - RETURN(GFN_DISK_COMMIT, error); + return error; } /** @@ -824,7 +800,6 @@ static void add_trans_to_ail(struct gfs_sbd *sdp, struct gfs_trans *tr) { - ENTER(GFN_ADD_TRANS_TO_AIL) struct gfs_log_element *le; while (!list_empty(&tr->tr_elements)) { @@ -834,8 +809,6 @@ } list_add(&tr->tr_list, &sdp->sd_log_ail); - - RET(GFN_ADD_TRANS_TO_AIL); } /** @@ -855,7 +828,6 @@ static void log_refund(struct gfs_sbd *sdp, struct gfs_trans *tr) { - ENTER(GFN_LOG_REFUND) struct gfs_log_buf *lb; struct list_head *bmem; unsigned int num_bufs = 0, num_bmem = 0; @@ -897,8 +869,6 @@ kfree(bmem); tr->tr_num_free_bmem--; } - - RET(GFN_LOG_REFUND); } /** @@ -914,7 +884,6 @@ trans_combine(struct gfs_sbd *sdp, struct gfs_trans *tr, struct gfs_trans *new_tr) { - ENTER(GFN_TRANS_COMBINE) struct gfs_log_element *le; struct gfs_log_buf *lb; struct list_head *bmem; @@ -956,8 +925,6 @@ gfs_assert_warn(sdp, !new_tr->tr_num_free_bmem); kfree(new_tr); - - RET(GFN_TRANS_COMBINE); } static void @@ -1006,7 +973,7 @@ static void log_flush_internal(struct gfs_sbd *sdp, struct gfs_glock *gl) { - ENTER(GFN_LOG_FLUSH_INTERNAL) + struct gfs_trans *trans = NULL, *tr; int error; @@ -1067,8 +1034,6 @@ if (test_bit(SDF_NEED_LOG_DUMP, &sdp->sd_flags)) gfs_log_dump(sdp, FALSE); - - RET(GFN_LOG_FLUSH_INTERNAL); } /** @@ -1080,9 +1045,7 @@ void gfs_log_flush(struct gfs_sbd *sdp) { - ENTER(GFN_LOG_FLUSH) log_flush_internal(sdp, NULL); - RET(GFN_LOG_FLUSH); } /** @@ -1094,9 +1057,7 @@ void gfs_log_flush_glock(struct gfs_glock *gl) { - ENTER(GFN_LOG_FLUSH_GLOCK) log_flush_internal(gl->gl_sbd, gl); - RET(GFN_LOG_FLUSH_GLOCK); } /** @@ -1112,7 +1073,6 @@ static void incore_commit(struct gfs_sbd *sdp, struct gfs_trans *new_tr) { - ENTER(GFN_INCORE_COMMIT) struct gfs_log_element *le; struct gfs_trans *trans = NULL, *exist_tr; struct gfs_log_buf *lb; @@ -1194,8 +1154,6 @@ log_refund(sdp, trans); list_add(&trans->tr_list, &sdp->sd_log_incore); - - RET(GFN_INCORE_COMMIT); } /** @@ -1209,7 +1167,6 @@ void gfs_log_commit(struct gfs_sbd *sdp, struct gfs_trans *tr) { - ENTER(GFN_LOG_COMMIT) struct gfs_log_buf *lb; struct list_head *bmem; unsigned int num_mblks = 0, num_eblks = 0, num_bufs = 0, num_bmem = 0; @@ -1258,7 +1215,6 @@ gfs_log_unlock(sdp); } - RET(GFN_LOG_COMMIT); } /** @@ -1271,7 +1227,6 @@ void gfs_log_dump(struct gfs_sbd *sdp, int force) { - ENTER(GFN_LOG_DUMP) struct gfs_log_element *le; struct gfs_trans tr; struct gfs_log_buf *lb; @@ -1282,7 +1237,7 @@ if (test_and_set_bit(SDF_IN_LOG_DUMP, &sdp->sd_flags)) { gfs_assert(sdp, !force,); - RET(GFN_LOG_DUMP); + return; } memset(&tr, 0, sizeof(struct gfs_trans)); @@ -1384,8 +1339,6 @@ out: gfs_log_unlock(sdp); clear_bit(SDF_IN_LOG_DUMP, &sdp->sd_flags); - - RET(GFN_LOG_DUMP); } /** @@ -1397,7 +1350,6 @@ void gfs_log_shutdown(struct gfs_sbd *sdp) { - ENTER(GFN_LOG_SHUTDOWN) struct gfs_log_buf *lb; char *bmem; struct gfs_log_header head; @@ -1471,13 +1423,20 @@ gfs_logbh_wait(sdp, &lb->lb_bh); gfs_logbh_uninit(sdp, &lb->lb_bh); - sdp->sd_log_head++; + /* If a withdraw is called before we've a chance to relock the trans + * lock, the sd_log_head points to the wrong place, and a umount will + * fail on asserts because of this. + * Adding one puts sd_log_head at a value that passes the assert. The + * value may not be correct for on disk, but we've withdrawn so there is + * no more disk io. + * If we're not withdrawn, the next io will grab the trans lock, which + * will fill sd_log_head with the correct value. + */ + sdp->sd_log_head += 1; out: gfs_log_unlock(sdp); kfree(lb); kfree(bmem); - - RET(GFN_LOG_SHUTDOWN); } --- cluster/gfs-kernel/src/gfs/log.h 2005/03/03 16:38:49 1.3 +++ cluster/gfs-kernel/src/gfs/log.h 2006/07/10 23:22:34 1.4 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/lops.c 2006/01/09 22:25:06 1.8 +++ cluster/gfs-kernel/src/gfs/lops.c 2006/07/10 23:22:34 1.9 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -39,7 +39,6 @@ static void generic_le_add(struct gfs_sbd *sdp, struct gfs_log_element *le) { - ENTER(GFN_GENERIC_LE_ADD) struct gfs_trans *tr; /* Make sure it's not attached to a transaction already */ @@ -53,8 +52,6 @@ le->le_trans = tr; list_add(&le->le_list, &tr->tr_elements); - - RET(GFN_GENERIC_LE_ADD); } /** @@ -69,14 +66,11 @@ static void glock_trans_end(struct gfs_sbd *sdp, struct gfs_log_element *le) { - ENTER(GFN_GLOCK_TRANS_END) struct gfs_glock *gl = container_of(le, struct gfs_glock, gl_new_le); gfs_assert(sdp, gfs_glock_is_locked_by_me(gl) && gfs_glock_is_held_excl(gl),); gfs_glock_put(gl); - - RET(GFN_GLOCK_TRANS_END); } /** @@ -90,7 +84,6 @@ static void glock_print(struct gfs_sbd *sdp, struct gfs_log_element *le, unsigned int where) { - ENTER(GFN_GLOCK_PRINT) struct gfs_glock *gl; switch (where) { @@ -102,14 +95,12 @@ break; default: gfs_assert_warn(sdp, FALSE); - RET(GFN_GLOCK_PRINT); + return; } printk(" Glock: (%u, %"PRIu64")\n", gl->gl_name.ln_type, gl->gl_name.ln_number); - - RET(GFN_GLOCK_PRINT); } /** @@ -132,9 +123,9 @@ static struct gfs_trans * glock_overlap_trans(struct gfs_sbd *sdp, struct gfs_log_element *le) { - ENTER(GFN_GLOCK_OVERLAP_TRANS) struct gfs_glock *gl = container_of(le, struct gfs_glock, gl_new_le); - RETURN(GFN_GLOCK_OVERLAP_TRANS, gl->gl_incore_le.le_trans); + + return gl->gl_incore_le.le_trans; } /** @@ -167,7 +158,6 @@ glock_incore_commit(struct gfs_sbd *sdp, struct gfs_trans *tr, struct gfs_log_element *le) { - ENTER(GFN_GLOCK_INCORE_COMMIT) struct gfs_glock *gl = container_of(le, struct gfs_glock, gl_new_le); /* Transactions were combined, based on this glock */ @@ -187,8 +177,6 @@ /* Remove gl->gl_new_le from "new" trans */ le->le_trans = NULL; list_del_init(&le->le_list); - - RET(GFN_GLOCK_INCORE_COMMIT); } /** @@ -203,10 +191,8 @@ static void glock_add_to_ail(struct gfs_sbd *sdp, struct gfs_log_element *le) { - ENTER(GFN_GLOCK_ADD_TO_AIL) le->le_trans = NULL; list_del_init(&le->le_list); - RET(GFN_GLOCK_ADD_TO_AIL); } /** @@ -221,9 +207,7 @@ glock_trans_combine(struct gfs_sbd *sdp, struct gfs_trans *tr, struct gfs_trans *new_tr) { - ENTER(GFN_GLOCK_TRANS_COMBINE) tr->tr_num_gl += new_tr->tr_num_gl; - RET(GFN_GLOCK_TRANS_COMBINE); } /** @@ -237,7 +221,6 @@ static void buf_print(struct gfs_sbd *sdp, struct gfs_log_element *le, unsigned int where) { - ENTER(GFN_BUF_PRINT) struct gfs_bufdata *bd; switch (where) { @@ -249,12 +232,10 @@ break; default: gfs_assert_warn(sdp, FALSE); - RET(GFN_BUF_PRINT); + return; } printk(" Buffer: %"PRIu64"\n", (uint64_t)bd->bd_bh->b_blocknr); - - RET(GFN_BUF_PRINT); } /** @@ -279,7 +260,6 @@ buf_incore_commit(struct gfs_sbd *sdp, struct gfs_trans *tr, struct gfs_log_element *le) { - ENTER(GFN_BUF_INCORE_COMMIT) struct gfs_bufdata *bd = container_of(le, struct gfs_bufdata, bd_new_le); /* We've completed our (atomic) changes to this buffer for this trans. @@ -307,8 +287,6 @@ /* Reset buffer's bd_new_le */ le->le_trans = NULL; list_del_init(&le->le_list); - - RET(GFN_BUF_INCORE_COMMIT); } /** @@ -321,7 +299,6 @@ static void buf_add_to_ail(struct gfs_sbd *sdp, struct gfs_log_element *le) { - ENTER(GFN_BUF_ADD_TO_AIL) struct gfs_bufdata *bd = container_of(le, struct gfs_bufdata, bd_incore_le); @@ -333,8 +310,6 @@ gfs_assert(sdp, sdp->sd_log_buffers,); sdp->sd_log_buffers--; - - RET(GFN_BUF_ADD_TO_AIL); } /** @@ -353,7 +328,6 @@ unsigned int *mblks, unsigned int *eblks, unsigned int *blocks, unsigned int *bmem) { - ENTER(GFN_BUF_TRANS_SIZE) unsigned int cblks; if (tr->tr_num_buf) { @@ -367,8 +341,6 @@ if (bmem) *bmem += cblks; } - - RET(GFN_BUF_TRANS_SIZE); } /** @@ -383,9 +355,7 @@ buf_trans_combine(struct gfs_sbd *sdp, struct gfs_trans *tr, struct gfs_trans *new_tr) { - ENTER(GFN_BUF_TRANS_COMBINE) tr->tr_num_buf += new_tr->tr_num_buf; - RET(GFN_BUF_TRANS_COMBINE); } /** @@ -404,7 +374,6 @@ static void increment_generation(struct gfs_sbd *sdp, struct gfs_bufdata *bd) { - ENTER(GFN_INCREMENT_GENERATION) struct gfs_meta_header *mh, *mh2; uint64_t tmp64; @@ -419,8 +388,6 @@ mh2->mh_generation = tmp64; } mh->mh_generation = tmp64; - - RET(GFN_INCREMENT_GENERATION); } /** @@ -434,7 +401,6 @@ static void buf_build_bhlist(struct gfs_sbd *sdp, struct gfs_trans *tr) { - ENTER(GFN_BUF_BUILD_BHLIST) struct list_head *tmp, *head; struct gfs_log_element *le; struct gfs_bufdata *bd; @@ -446,7 +412,7 @@ unsigned int x, bufs; if (!tr->tr_num_buf) - RET(GFN_BUF_BUILD_BHLIST); + return; /* set up control buffers for descriptor and tags */ @@ -521,8 +487,6 @@ gfs_assert(sdp, x == num_ctl,); gfs_assert(sdp, bufs == tr->tr_num_buf,); - - RET(GFN_BUF_BUILD_BHLIST); } /** @@ -538,12 +502,10 @@ buf_before_scan(struct gfs_sbd *sdp, unsigned int jid, struct gfs_log_header *head, unsigned int pass) { - ENTER(GFN_BUF_BEFORE_SCAN) if (pass == GFS_RECPASS_A1) sdp->sd_recovery_replays = sdp->sd_recovery_skips = sdp->sd_recovery_sames = 0; - RET(GFN_BUF_BEFORE_SCAN); } /** @@ -568,7 +530,6 @@ replay_block(struct gfs_sbd *sdp, struct gfs_jindex *jdesc, struct gfs_glock *gl, struct gfs_block_tag *tag, uint64_t blkno) { - ENTER(GFN_REPLAY_BLOCK) struct buffer_head *inplace_bh, *log_bh; struct gfs_meta_header inplace_mh, log_mh; int replay_block = TRUE; @@ -583,22 +544,22 @@ error = gfs_dread(gl, tag->bt_blkno, DIO_START | DIO_WAIT, &inplace_bh); if (error) - RETURN(GFN_REPLAY_BLOCK, error); + return error; if (gfs_meta_check(sdp, inplace_bh)) { brelse(inplace_bh); - RETURN(GFN_REPLAY_BLOCK, -EIO); + return -EIO; } gfs_meta_header_in(&inplace_mh, inplace_bh->b_data); error = gfs_dread(gl, blkno, DIO_START | DIO_WAIT, &log_bh); if (error) { brelse(inplace_bh); - RETURN(GFN_REPLAY_BLOCK, error); + return error; } if (gfs_meta_check(sdp, log_bh)) { brelse(inplace_bh); brelse(log_bh); - RETURN(GFN_REPLAY_BLOCK, -EIO); + return -EIO; } gfs_meta_header_in(&log_mh, log_bh->b_data); @@ -627,7 +588,7 @@ brelse(log_bh); brelse(inplace_bh); - RETURN(GFN_REPLAY_BLOCK, error); + return error; } /** @@ -647,7 +608,6 @@ struct gfs_glock *gl, uint64_t start, struct gfs_log_descriptor *desc, unsigned int pass) { - ENTER(GFN_BUF_SCAN_ELEMENTS) struct gfs_block_tag tag; struct buffer_head *bh; uint64_t cblk = start; @@ -657,15 +617,15 @@ int error; if (pass != GFS_RECPASS_A1) - RETURN(GFN_BUF_SCAN_ELEMENTS, 0); + return 0; if (desc->ld_type != GFS_LOG_DESC_METADATA) - RETURN(GFN_BUF_SCAN_ELEMENTS, 0); + return 0; x = gfs_struct2blk(sdp, num_tags, sizeof(struct gfs_block_tag)); while (x--) { error = gfs_increment_blkno(sdp, jdesc, gl, &start, TRUE); if (error) - RETURN(GFN_BUF_SCAN_ELEMENTS, error); + return error; } for (;;) { @@ -673,7 +633,7 @@ error = gfs_dread(gl, cblk, DIO_START | DIO_WAIT, &bh); if (error) - RETURN(GFN_BUF_SCAN_ELEMENTS, error); + return error; /* Do readahead for the inplace blocks in this control block */ { @@ -712,17 +672,17 @@ error = gfs_increment_blkno(sdp, jdesc, gl, &cblk, TRUE); if (error) - RETURN(GFN_BUF_SCAN_ELEMENTS, error); + return error; offset = 0; } - RETURN(GFN_BUF_SCAN_ELEMENTS, 0); + return 0; out_drelse: brelse(bh); - RETURN(GFN_BUF_SCAN_ELEMENTS, error); + return error; } /** @@ -736,8 +696,6 @@ static void buf_after_scan(struct gfs_sbd *sdp, unsigned int jid, unsigned int pass) { - ENTER(GFN_BUF_AFTER_SCAN) - if (pass == GFS_RECPASS_A1) { printk("GFS: fsid=%s: jid=%u: Replayed %u of %u blocks\n", sdp->sd_fsname, jid, @@ -748,8 +706,6 @@ sdp->sd_fsname, jid, sdp->sd_recovery_replays, sdp->sd_recovery_skips, sdp->sd_recovery_sames); } - - RET(GFN_BUF_AFTER_SCAN); } /** @@ -764,7 +720,6 @@ unlinked_print(struct gfs_sbd *sdp, struct gfs_log_element *le, unsigned int where) { - ENTER(GFN_UNLINKED_PRINT) struct gfs_unlinked *ul; char *type; @@ -781,14 +736,12 @@ break; default: gfs_assert_warn(sdp, FALSE); - RET(GFN_UNLINKED_PRINT); + return; } printk(" unlinked: %"PRIu64"/%"PRIu64", %s\n", ul->ul_inum.no_formal_ino, ul->ul_inum.no_addr, type); - - RET(GFN_UNLINKED_PRINT); } /** @@ -803,7 +756,6 @@ unlinked_incore_commit(struct gfs_sbd *sdp, struct gfs_trans *tr, struct gfs_log_element *le) { - ENTER(GFN_UNLINKED_INCORE_COMMIT) struct gfs_unlinked *ul = container_of(le, struct gfs_unlinked, ul_new_le); @@ -857,8 +809,6 @@ le->le_trans = NULL; list_del_init(&le->le_list); gfs_unlinked_put(sdp, ul); - - RET(GFN_UNLINKED_INCORE_COMMIT); } /** @@ -871,7 +821,6 @@ static void unlinked_add_to_ail(struct gfs_sbd *sdp, struct gfs_log_element *le) { - ENTER(GFN_UNLINKED_ADD_TO_AIL) struct gfs_unlinked *ul = container_of(le, struct gfs_unlinked, ul_incore_le); @@ -893,8 +842,6 @@ le->le_trans = NULL; list_del_init(&le->le_list); gfs_unlinked_put(sdp, ul); - - RET(GFN_UNLINKED_ADD_TO_AIL); } /** @@ -907,10 +854,8 @@ static void unlinked_clean_dump(struct gfs_sbd *sdp, struct gfs_log_element *le) { - ENTER(GFN_UNLINKED_CLEAN_DUMP) le->le_trans = NULL; list_del_init(&le->le_list); - RET(GFN_UNLINKED_CLEAN_DUMP); } /** @@ -929,7 +874,6 @@ unsigned int *mblks, unsigned int *eblks, unsigned int *blocks, unsigned int *bmem) { - ENTER(GFN_UNLINKED_TRANS_SIZE) unsigned int ublks = 0; if (tr->tr_num_iul) @@ -945,8 +889,6 @@ *blocks += ublks; if (bmem) *bmem += ublks; - - RET(GFN_UNLINKED_TRANS_SIZE); } /** @@ -961,10 +903,8 @@ unlinked_trans_combine(struct gfs_sbd *sdp, struct gfs_trans *tr, struct gfs_trans *new_tr) { - ENTER(GFN_UNLINKED_TRANS_COMBINE) tr->tr_num_iul += new_tr->tr_num_iul; tr->tr_num_ida += new_tr->tr_num_ida; - RET(GFN_UNLINKED_TRANS_COMBINE); } /** @@ -983,7 +923,6 @@ static void unlinked_build_bhlist(struct gfs_sbd *sdp, struct gfs_trans *tr) { - ENTER(GFN_UNLINKED_BUILD_BHLIST) struct list_head *tmp, *head; struct gfs_log_element *le; struct gfs_unlinked *ul; @@ -1064,8 +1003,6 @@ gfs_assert(sdp, entries == number,); } - - RET(GFN_UNLINKED_BUILD_BHLIST); } /** @@ -1081,7 +1018,6 @@ unlinked_dump_size(struct gfs_sbd *sdp, unsigned int *elements, unsigned int *blocks, unsigned int *bmem) { - ENTER(GFN_UNLINKED_DUMP_SIZE) unsigned int c = atomic_read(&sdp->sd_unlinked_od_count); unsigned int b = gfs_struct2blk(sdp, c, sizeof(struct gfs_inum)); @@ -1091,8 +1027,6 @@ *blocks += b; if (bmem) *bmem += b; - - RET(GFN_UNLINKED_DUMP_SIZE); } /** @@ -1105,7 +1039,6 @@ static void unlinked_build_dump(struct gfs_sbd *sdp, struct gfs_trans *tr) { - ENTER(GFN_UNLINKED_BUILD_DUMP) struct list_head *tmp, *head; struct gfs_unlinked *ul; unsigned int x = 0; @@ -1131,8 +1064,6 @@ spin_unlock(&sdp->sd_unlinked_lock); gfs_assert(sdp, x == atomic_read(&sdp->sd_unlinked_od_count),); - - RET(GFN_UNLINKED_BUILD_DUMP); } /** @@ -1148,10 +1079,8 @@ unlinked_before_scan(struct gfs_sbd *sdp, unsigned int jid, struct gfs_log_header *head, unsigned int pass) { - ENTER(GFN_UNLINKED_BEFORE_SCAN) if (pass == GFS_RECPASS_B1) clear_bit(SDF_FOUND_UL_DUMP, &sdp->sd_flags); - RET(GFN_UNLINKED_BEFORE_SCAN); } /** @@ -1171,7 +1100,6 @@ struct gfs_glock *gl, uint64_t start, struct gfs_log_descriptor *desc, unsigned int pass) { - ENTER(GFN_UNLINKED_SCAN_ELEMENTS) struct gfs_inum inum; struct buffer_head *bh; unsigned int offset = sizeof(struct gfs_log_descriptor); @@ -1179,7 +1107,7 @@ int error; if (pass != GFS_RECPASS_B1) - RETURN(GFN_UNLINKED_SCAN_ELEMENTS, 0); + return 0; switch (desc->ld_type) { case GFS_LOG_DESC_IUL: @@ -1196,13 +1124,13 @@ break; default: - RETURN(GFN_UNLINKED_SCAN_ELEMENTS, 0); + return 0; } for (x = 0; x < desc->ld_length; x++) { error = gfs_dread(gl, start, DIO_START | DIO_WAIT, &bh); if (error) - RETURN(GFN_UNLINKED_SCAN_ELEMENTS, error); + return error; for (; offset + sizeof(struct gfs_inum) <= sdp->sd_sb.sb_bsize; @@ -1217,12 +1145,12 @@ error = gfs_increment_blkno(sdp, jdesc, gl, &start, TRUE); if (error) - RETURN(GFN_UNLINKED_SCAN_ELEMENTS, error); + return error; offset = 0; } - RETURN(GFN_UNLINKED_SCAN_ELEMENTS, 0); + return 0; } /** @@ -1236,13 +1164,11 @@ static void unlinked_after_scan(struct gfs_sbd *sdp, unsigned int jid, unsigned int pass) { - ENTER(GFN_UNLINKED_AFTER_SCAN) if (pass == GFS_RECPASS_B1) { gfs_assert(sdp, test_bit(SDF_FOUND_UL_DUMP, &sdp->sd_flags),); printk("GFS: fsid=%s: Found %d unlinked inodes\n", sdp->sd_fsname, atomic_read(&sdp->sd_unlinked_ic_count)); } - RET(GFN_UNLINKED_AFTER_SCAN); } /** @@ -1256,15 +1182,12 @@ static void quota_print(struct gfs_sbd *sdp, struct gfs_log_element *le, unsigned int where) { - ENTER(GFN_QUOTA_PRINT_LOP) struct gfs_quota_le *ql; ql = container_of(le, struct gfs_quota_le, ql_le); printk(" quota: %s %u: %"PRId64" blocks\n", (test_bit(QDF_USER, &ql->ql_data->qd_flags)) ? "user" : "group", ql->ql_data->qd_id, ql->ql_change); - - RET(GFN_QUOTA_PRINT_LOP); } /** @@ -1279,7 +1202,6 @@ quota_incore_commit(struct gfs_sbd *sdp, struct gfs_trans *tr, struct gfs_log_element *le) { - ENTER(GFN_QUOTA_INCORE_COMMIT) struct gfs_quota_le *ql = container_of(le, struct gfs_quota_le, ql_le); struct gfs_quota_data *qd = ql->ql_data; @@ -1332,8 +1254,6 @@ list_add(&ql->ql_data_list, &qd->qd_le_list); } } - - RET(GFN_QUOTA_INCORE_COMMIT); } /** @@ -1346,7 +1266,6 @@ static void quota_add_to_ail(struct gfs_sbd *sdp, struct gfs_log_element *le) { - ENTER(GFN_QUOTA_ADD_TO_AIL) struct gfs_quota_le *ql = container_of(le, struct gfs_quota_le, ql_le); struct gfs_quota_data *qd = ql->ql_data; @@ -1369,8 +1288,6 @@ list_del(&le->le_list); gfs_quota_put(sdp, qd); kfree(ql); - - RET(GFN_QUOTA_ADD_TO_AIL); } /** @@ -1383,10 +1300,8 @@ static void quota_clean_dump(struct gfs_sbd *sdp, struct gfs_log_element *le) { - ENTER(GFN_QUOTA_CLEAN_DUMP) le->le_trans = NULL; list_del_init(&le->le_list); - RET(GFN_QUOTA_CLEAN_DUMP); } /** @@ -1405,7 +1320,6 @@ unsigned int *mblks, unsigned int *eblks, unsigned int *blocks, unsigned int *bmem) { - ENTER(GFN_QUOTA_TRANS_SIZE) unsigned int qblks; if (tr->tr_num_q) { @@ -1419,8 +1333,6 @@ if (bmem) *bmem += qblks; } - - RET(GFN_QUOTA_TRANS_SIZE); } /** @@ -1435,9 +1347,7 @@ quota_trans_combine(struct gfs_sbd *sdp, struct gfs_trans *tr, struct gfs_trans *new_tr) { - ENTER(GFN_QUOTA_TRANS_COMBINE) tr->tr_num_q += new_tr->tr_num_q; - RET(GFN_QUOTA_TRANS_COMBINE); } /** @@ -1450,7 +1360,6 @@ static void quota_build_bhlist(struct gfs_sbd *sdp, struct gfs_trans *tr) { - ENTER(GFN_QUOTA_BUILD_BHLIST) struct list_head *tmp, *head; struct gfs_log_element *le; struct gfs_quota_le *ql; @@ -1460,7 +1369,7 @@ unsigned int offset = sizeof(struct gfs_log_descriptor), entries = 0; if (!tr->tr_num_q && !(tr->tr_flags & TRF_LOG_DUMP)) - RET(GFN_QUOTA_BUILD_BHLIST); + return; lb = gfs_log_get_buf(sdp, tr); @@ -1503,8 +1412,6 @@ } gfs_assert(sdp, entries == tr->tr_num_q,); - - RET(GFN_QUOTA_BUILD_BHLIST); } /** @@ -1520,7 +1427,6 @@ quota_dump_size(struct gfs_sbd *sdp, unsigned int *elements, unsigned int *blocks, unsigned int *bmem) { - ENTER(GFN_QUOTA_DUMP_SIZE) unsigned int c = atomic_read(&sdp->sd_quota_od_count); unsigned int b = gfs_struct2blk(sdp, c, sizeof(struct gfs_quota_tag)); @@ -1530,8 +1436,6 @@ *blocks += b; if (bmem) *bmem += b; - - RET(GFN_QUOTA_DUMP_SIZE); } /** @@ -1544,7 +1448,6 @@ static void quota_build_dump(struct gfs_sbd *sdp, struct gfs_trans *tr) { - ENTER(GFN_QUOTA_BUILD_DUMP) struct list_head *tmp, *head; struct gfs_quota_data *qd; struct gfs_quota_le *ql; @@ -1577,8 +1480,6 @@ spin_unlock(&sdp->sd_quota_lock); gfs_assert(sdp, x == atomic_read(&sdp->sd_quota_od_count),); - - RET(GFN_QUOTA_BUILD_DUMP); } /** @@ -1594,10 +1495,8 @@ quota_before_scan(struct gfs_sbd *sdp, unsigned int jid, struct gfs_log_header *head, unsigned int pass) { - ENTER(GFN_QUOTA_BEFORE_SCAN) if (pass == GFS_RECPASS_B1) clear_bit(SDF_FOUND_Q_DUMP, &sdp->sd_flags); - RET(GFN_QUOTA_BEFORE_SCAN); } /** @@ -1617,7 +1516,6 @@ struct gfs_glock *gl, uint64_t start, struct gfs_log_descriptor *desc, unsigned int pass) { - ENTER(GFN_QUOTA_SCAN_ELEMENTS) struct gfs_quota_tag tag; struct buffer_head *bh; unsigned int num_tags = desc->ld_data1; @@ -1626,9 +1524,9 @@ int error; if (pass != GFS_RECPASS_B1) - RETURN(GFN_QUOTA_SCAN_ELEMENTS, 0); + return 0; if (desc->ld_type != GFS_LOG_DESC_Q) - RETURN(GFN_QUOTA_SCAN_ELEMENTS, 0); + return 0; if (test_bit(SDF_FOUND_Q_DUMP, &sdp->sd_flags)) gfs_assert(sdp, !desc->ld_data2,); @@ -1638,12 +1536,12 @@ } if (!num_tags) - RETURN(GFN_QUOTA_SCAN_ELEMENTS, 0); + return 0; for (x = 0; x < desc->ld_length; x++) { error = gfs_dread(gl, start, DIO_START | DIO_WAIT, &bh); if (error) - RETURN(GFN_QUOTA_SCAN_ELEMENTS, error); + return error; while (offset + sizeof(struct gfs_quota_tag) <= sdp->sd_sb.sb_bsize) { @@ -1663,17 +1561,17 @@ error = gfs_increment_blkno(sdp, jdesc, gl, &start, TRUE); if (error) - RETURN(GFN_QUOTA_SCAN_ELEMENTS, error); + return error; offset = 0; } - RETURN(GFN_QUOTA_SCAN_ELEMENTS, 0); + return 0; out_drelse: brelse(bh); - RETURN(GFN_QUOTA_SCAN_ELEMENTS, error); + return error; } /** @@ -1687,16 +1585,12 @@ static void quota_after_scan(struct gfs_sbd *sdp, unsigned int jid, unsigned int pass) { - ENTER(GFN_QUOTA_AFTER_SCAN) - if (pass == GFS_RECPASS_B1) { gfs_assert(sdp, !sdp->sd_sb.sb_quota_di.no_formal_ino || test_bit(SDF_FOUND_Q_DUMP, &sdp->sd_flags),); printk("GFS: fsid=%s: Found quota changes for %d IDs\n", sdp->sd_fsname, atomic_read(&sdp->sd_quota_od_count)); } - - RET(GFN_QUOTA_AFTER_SCAN); } struct gfs_log_operations gfs_glock_lops = { --- cluster/gfs-kernel/src/gfs/lops.h 2004/06/24 08:53:28 1.1 +++ cluster/gfs-kernel/src/gfs/lops.h 2006/07/10 23:22:34 1.2 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/lvb.c 2005/01/12 23:04:18 1.2 +++ cluster/gfs-kernel/src/gfs/lvb.c 2006/07/10 23:22:34 1.3 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -42,7 +42,6 @@ void gfs_rgrp_lvb_in(struct gfs_rgrp_lvb *rb, char *lvb) { - ENTER(GFN_RGRP_LVB_IN) struct gfs_rgrp_lvb *str = (struct gfs_rgrp_lvb *)lvb; CPIN_32(rb, str, rb_magic); @@ -51,8 +50,6 @@ CPIN_32(rb, str, rb_freedi); CPIN_32(rb, str, rb_usedmeta); CPIN_32(rb, str, rb_freemeta); - - RET(GFN_RGRP_LVB_IN); } /** @@ -65,7 +62,6 @@ void gfs_rgrp_lvb_out(struct gfs_rgrp_lvb *rb, char *lvb) { - ENTER(GFN_RGRP_LVB_OUT) struct gfs_rgrp_lvb *str = (struct gfs_rgrp_lvb *)lvb; CPOUT_32(rb, str, rb_magic); @@ -74,8 +70,6 @@ CPOUT_32(rb, str, rb_freedi); CPOUT_32(rb, str, rb_usedmeta); CPOUT_32(rb, str, rb_freemeta); - - RET(GFN_RGRP_LVB_OUT); } /** @@ -89,16 +83,12 @@ void gfs_rgrp_lvb_print(struct gfs_rgrp_lvb *rb) { - ENTER(GFN_RGRP_LVB_PRINT) - pv(rb, rb_magic, "%u"); pv(rb, rb_free, "%u"); pv(rb, rb_useddi, "%u"); pv(rb, rb_freedi, "%u"); pv(rb, rb_usedmeta, "%u"); pv(rb, rb_freemeta, "%u"); - - RET(GFN_RGRP_LVB_PRINT); } /** @@ -111,7 +101,6 @@ void gfs_quota_lvb_in(struct gfs_quota_lvb *qb, char *lvb) { - ENTER(GFN_QUOTA_LVB_IN) struct gfs_quota_lvb *str = (struct gfs_quota_lvb *)lvb; CPIN_32(qb, str, qb_magic); @@ -119,8 +108,6 @@ CPIN_64(qb, str, qb_limit); CPIN_64(qb, str, qb_warn); CPIN_64(qb, str, qb_value); - - RET(GFN_QUOTA_LVB_IN); } /** @@ -133,7 +120,6 @@ void gfs_quota_lvb_out(struct gfs_quota_lvb *qb, char *lvb) { - ENTER(GFN_QUOTA_LVB_OUT) struct gfs_quota_lvb *str = (struct gfs_quota_lvb *)lvb; CPOUT_32(qb, str, qb_magic); @@ -141,8 +127,6 @@ CPOUT_64(qb, str, qb_limit); CPOUT_64(qb, str, qb_warn); CPOUT_64(qb, str, qb_value); - - RET(GFN_QUOTA_LVB_OUT); } /** @@ -156,13 +140,9 @@ void gfs_quota_lvb_print(struct gfs_quota_lvb *qb) { - ENTER(GFN_QUOTA_LVB_PRINT) - pv(qb, qb_magic, "%u"); pv(qb, qb_pad, "%u"); pv(qb, qb_limit, "%"PRIu64); pv(qb, qb_warn, "%"PRIu64); pv(qb, qb_value, "%"PRId64); - - RET(GFN_QUOTA_LVB_PRINT); } --- cluster/gfs-kernel/src/gfs/lvb.h 2004/10/07 19:40:55 1.3 +++ cluster/gfs-kernel/src/gfs/lvb.h 2006/07/10 23:22:34 1.4 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/main.c 2006/01/09 21:12:24 1.7 +++ cluster/gfs-kernel/src/gfs/main.c 2006/07/10 23:22:34 1.8 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -23,9 +23,8 @@ #include #include "gfs.h" -#include "diaper.h" #include "ops_fstype.h" -#include "proc.h" +#include "sys.h" /** * init_gfs_fs - Register GFS as a filesystem @@ -33,78 +32,56 @@ * Returns: 0 on success, error code on failure */ -int __init -init_gfs_fs(void) +int __init init_gfs_fs(void) { -#ifdef GFS_PROFILE - int p = FALSE; -#endif int error; - gfs_random_number = xtime.tv_nsec; - -#ifdef GFS_TRACE - error = gfs_trace_init(); - if (error) - return error; -#endif -#ifdef GFS_PROFILE - error = gfs_profile_init(); - if (error) - goto fail_debug; - p = TRUE; -#endif - - gfs_init_lmh(); +/* gfs2_init_lmh(); gfs2 should do this for us*/ error = gfs_sys_init(); if (error) - goto fail_debug; - - error = gfs_proc_init(); - if (error) - goto fail_sys; - - error = gfs_diaper_init(); - if (error) - goto fail_proc; + return error; - error = -ENOMEM; + gfs_random_number = xtime.tv_nsec; gfs_glock_cachep = kmem_cache_create("gfs_glock", sizeof(struct gfs_glock), 0, 0, NULL, NULL); + gfs_inode_cachep = NULL; + gfs_bufdata_cachep = NULL; + gfs_mhc_cachep = NULL; + error = -ENOMEM; if (!gfs_glock_cachep) - goto fail_diaper; + goto fail1; gfs_inode_cachep = kmem_cache_create("gfs_inode", sizeof(struct gfs_inode), 0, 0, NULL, NULL); if (!gfs_inode_cachep) - goto fail_diaper; + goto fail1; gfs_bufdata_cachep = kmem_cache_create("gfs_bufdata", sizeof(struct gfs_bufdata), 0, 0, NULL, NULL); if (!gfs_bufdata_cachep) - goto fail_diaper; + goto fail1; gfs_mhc_cachep = kmem_cache_create("gfs_meta_header_cache", sizeof(struct gfs_meta_header_cache), 0, 0, NULL, NULL); if (!gfs_mhc_cachep) - goto fail_diaper; + goto fail; error = register_filesystem(&gfs_fs_type); if (error) - goto fail_diaper; + goto fail; printk("GFS %s (built %s %s) installed\n", GFS_RELEASE_NAME, __DATE__, __TIME__); return 0; - fail_diaper: + fail1: if (gfs_mhc_cachep) kmem_cache_destroy(gfs_mhc_cachep); @@ -117,23 +94,9 @@ if (gfs_glock_cachep) kmem_cache_destroy(gfs_glock_cachep); - gfs_diaper_uninit(); - - fail_proc: - gfs_proc_uninit(); - - fail_sys: + fail: gfs_sys_uninit(); - fail_debug: -#ifdef GFS_PROFILE - if (p) - gfs_profile_uninit(); -#endif -#ifdef GFS_TRACE - gfs_trace_uninit(); -#endif - return error; } @@ -152,16 +115,7 @@ kmem_cache_destroy(gfs_inode_cachep); kmem_cache_destroy(gfs_glock_cachep); - gfs_diaper_uninit(); - gfs_proc_uninit(); gfs_sys_uninit(); - -#ifdef GFS_PROFILE - gfs_profile_uninit(); -#endif -#ifdef GFS_TRACE - gfs_trace_uninit(); -#endif } MODULE_DESCRIPTION("Global File System " GFS_RELEASE_NAME); --- cluster/gfs-kernel/src/gfs/mount.c 2005/03/11 21:46:48 1.11 +++ cluster/gfs-kernel/src/gfs/mount.c 2006/07/10 23:22:34 1.12 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -21,7 +21,7 @@ #include "gfs.h" #include "mount.h" -#include "proc.h" +#include "sys.h" /** * gfs_make_args - Parse mount arguments @@ -32,27 +32,30 @@ */ int -gfs_make_args(char *data_arg, struct gfs_args *args) +gfs_make_args(char *data_arg, struct gfs_args *args, int remount) { - ENTER(GFN_MAKE_ARGS) char *data = data_arg; char *options, *x, *y; int error = 0; /* If someone preloaded options, use those instead */ - spin_lock(&gfs_proc_margs_lock); - if (gfs_proc_margs) { - data = gfs_proc_margs; - gfs_proc_margs = NULL; - } - spin_unlock(&gfs_proc_margs_lock); - - /* Set some defaults */ - memset(args, 0, sizeof(struct gfs_args)); args->ar_num_glockd = GFS_GLOCKD_DEFAULT; + if (!remount) { + /* If someone preloaded options, use those instead */ + spin_lock(&gfs_sys_margs_lock); + if (gfs_sys_margs) { + data = gfs_sys_margs; + gfs_sys_margs = NULL; + } + spin_unlock(&gfs_sys_margs_lock); + + /* Set some defaults */ + args->ar_num_glockd = GFS_GLOCKD_DEFAULT; + } + /* Split the options into tokens with the "," character and process them */ @@ -92,6 +95,7 @@ } strncpy(args->ar_hostdata, y, GFS_LOCKNAME_LEN); args->ar_hostdata[GFS_LOCKNAME_LEN - 1] = 0; + printk("Bob says: hostdata=%s\n",args->ar_hostdata); } else if (!strcmp(x, "spectator")) @@ -134,6 +138,9 @@ else if (!strcmp(x, "acl")) args->ar_posix_acls = TRUE; + else if (!strcmp(x, "noacl")) + args->ar_posix_acls = FALSE; + else if (!strcmp(x, "suiddir")) args->ar_suiddir = TRUE; @@ -152,6 +159,6 @@ if (data != data_arg) kfree(data); - RETURN(GFN_MAKE_ARGS, error); + return error; } --- cluster/gfs-kernel/src/gfs/mount.h 2004/12/18 03:11:13 1.3 +++ cluster/gfs-kernel/src/gfs/mount.h 2006/07/10 23:22:34 1.4 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -14,6 +14,6 @@ #ifndef __MOUNT_DOT_H__ #define __MOUNT_DOT_H__ -int gfs_make_args(char *data, struct gfs_args *args); +int gfs_make_args(char *data, struct gfs_args *args, int remount); #endif /* __MOUNT_DOT_H__ */ --- cluster/gfs-kernel/src/gfs/ondisk.c 2004/06/24 08:53:28 1.1 +++ cluster/gfs-kernel/src/gfs/ondisk.c 2006/07/10 23:22:34 1.2 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/ops_address.c 2006/01/09 22:25:06 1.10 +++ cluster/gfs-kernel/src/gfs/ops_address.c 2006/07/10 23:22:34 1.11 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -45,7 +46,6 @@ get_block(struct inode *inode, sector_t lblock, struct buffer_head *bh_result, int create) { - ENTER(GFN_GET_BLOCK) struct gfs_inode *ip = get_v2ip(inode); int new = create; uint64_t dblock; @@ -53,16 +53,16 @@ error = gfs_block_map(ip, lblock, &new, &dblock, NULL); if (error) - RETURN(GFN_GET_BLOCK, error); + return error; if (!dblock) - RETURN(GFN_GET_BLOCK, 0); + return 0; map_bh(bh_result, inode->i_sb, dblock); if (new) set_buffer_new(bh_result); - RETURN(GFN_GET_BLOCK, 0); + return 0; } /** @@ -79,18 +79,17 @@ get_block_noalloc(struct inode *inode, sector_t lblock, struct buffer_head *bh_result, int create) { - ENTER(GFN_GET_BLOCK_NOALLOC) int error; error = get_block(inode, lblock, bh_result, FALSE); if (error) - RETURN(GFN_GET_BLOCK_NOALLOC, error); + return error; if (gfs_assert_withdraw(get_v2sdp(inode->i_sb), !create || buffer_mapped(bh_result))) - RETURN(GFN_GET_BLOCK_NOALLOC, -EIO); + return -EIO; - RETURN(GFN_GET_BLOCK_NOALLOC, 0); + return 0; } /** @@ -106,32 +105,25 @@ static int get_blocks(struct inode *inode, sector_t lblock, - unsigned long max_blocks, - struct buffer_head *bh_result, int create) + struct buffer_head *bh_result, int create) { - ENTER(GFN_GET_BLOCKS) struct gfs_inode *ip = get_v2ip(inode); int new = create; uint64_t dblock; - uint32_t extlen; int error; - error = gfs_block_map(ip, lblock, &new, &dblock, &extlen); + error = gfs_block_map(ip, lblock, &new, &dblock, NULL); if (error) - RETURN(GFN_GET_BLOCKS, error); + return error; if (!dblock) - RETURN(GFN_GET_BLOCKS, 0); + return 0; map_bh(bh_result, inode->i_sb, dblock); if (new) set_buffer_new(bh_result); - if (extlen > max_blocks) - extlen = max_blocks; - bh_result->b_size = extlen << inode->i_blkbits; - - RETURN(GFN_GET_BLOCKS, 0); + return 0; } /** @@ -147,21 +139,19 @@ static int get_blocks_noalloc(struct inode *inode, sector_t lblock, - unsigned long max_blocks, struct buffer_head *bh_result, int create) { - ENTER(GFN_GET_BLOCKS_NOALLOC) int error; - error = get_blocks(inode, lblock, max_blocks, bh_result, FALSE); + error = get_blocks(inode, lblock, bh_result, FALSE); if (error) - RETURN(GFN_GET_BLOCKS_NOALLOC, error); + return error; if (gfs_assert_withdraw(get_v2sdp(inode->i_sb), - !create || buffer_mapped(bh_result))) - RETURN(GFN_GET_BLOCKS_NOALLOC, -EIO); + !create || buffer_mapped(bh_result))) + return -EIO; - RETURN(GFN_GET_BLOCKS_NOALLOC, 0); + return 0; } /** @@ -177,7 +167,6 @@ static int gfs_writepage(struct page *page, struct writeback_control *wbc) { - ENTER(GFN_WRITEPAGE) struct gfs_inode *ip = get_v2ip(page->mapping->host); struct gfs_sbd *sdp = ip->i_sbd; int error; @@ -186,19 +175,19 @@ if (gfs_assert_withdraw(sdp, gfs_glock_is_held_excl(ip->i_gl))) { unlock_page(page); - RETURN(GFN_WRITEPAGE, -EIO); + return -EIO; } if (get_transaction) { redirty_page_for_writepage(wbc, page); unlock_page(page); - RETURN(GFN_WRITEPAGE, 0); + return 0; } error = block_write_full_page(page, get_block_noalloc, wbc); gfs_flush_meta_cache(ip); - RETURN(GFN_WRITEPAGE, error); + return error; } /** @@ -212,7 +201,6 @@ static int stuffed_readpage(struct gfs_inode *ip, struct page *page) { - ENTER(GFN_STUFFED_READPAGE) struct buffer_head *dibh; void *kaddr; int error; @@ -233,7 +221,7 @@ SetPageUptodate(page); } - RETURN(GFN_STUFFED_READPAGE, error); + return error; } /** @@ -246,7 +234,6 @@ static int readi_readpage(struct page *page) { - ENTER(GFN_READI_READPAGE) struct gfs_inode *ip = get_v2ip(page->mapping->host); void *kaddr; int ret; @@ -267,7 +254,7 @@ unlock_page(page); - RETURN(GFN_READI_READPAGE, ret); + return ret; } /** @@ -281,7 +268,6 @@ static int gfs_readpage(struct file *file, struct page *page) { - ENTER(GFN_READPAGE) struct gfs_inode *ip = get_v2ip(page->mapping->host); struct gfs_sbd *sdp = ip->i_sbd; int error; @@ -290,7 +276,7 @@ if (gfs_assert_warn(sdp, gfs_glock_is_locked_by_me(ip->i_gl))) { unlock_page(page); - RETURN(GFN_READPAGE, -ENOSYS); + return -ENOSYS; } if (!gfs_is_jdata(ip)) { @@ -305,7 +291,7 @@ if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) error = -EIO; - RETURN(GFN_READPAGE, error); + return error; } /** @@ -328,7 +314,6 @@ gfs_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to) { - ENTER(GFN_PREPARE_WRITE) struct gfs_inode *ip = get_v2ip(page->mapping->host); struct gfs_sbd *sdp = ip->i_sbd; int error = 0; @@ -336,7 +321,7 @@ atomic_inc(&sdp->sd_ops_address); if (gfs_assert_warn(sdp, gfs_glock_is_locked_by_me(ip->i_gl))) - RETURN(GFN_PREPARE_WRITE, -ENOSYS); + return -ENOSYS; if (gfs_is_stuffed(ip)) { uint64_t file_size = ((uint64_t)page->index << PAGE_CACHE_SHIFT) + to; @@ -350,7 +335,7 @@ } else error = block_prepare_write(page, from, to, get_block); - RETURN(GFN_PREPARE_WRITE, error); + return error; } /** @@ -367,7 +352,6 @@ gfs_commit_write(struct file *file, struct page *page, unsigned from, unsigned to) { - ENTER(GFN_COMMIT_WRITE) struct inode *inode = page->mapping->host; struct gfs_inode *ip = get_v2ip(inode); struct gfs_sbd *sdp = ip->i_sbd; @@ -404,12 +388,12 @@ goto fail; } - RETURN(GFN_COMMIT_WRITE, 0); + return 0; fail: ClearPageUptodate(page); - RETURN(GFN_COMMIT_WRITE, error); + return error; } /** @@ -423,7 +407,6 @@ static sector_t gfs_bmap(struct address_space *mapping, sector_t lblock) { - ENTER(GFN_BMAP) struct gfs_inode *ip = get_v2ip(mapping->host); struct gfs_holder i_gh; int dblock = 0; @@ -433,14 +416,14 @@ error = gfs_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh); if (error) - RETURN(GFN_BMAP, 0); + return 0; if (!gfs_is_stuffed(ip)) dblock = generic_block_bmap(mapping, lblock, get_block); gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_BMAP, dblock); + return dblock; } /** @@ -458,26 +441,24 @@ gfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t offset, unsigned long nr_segs) { - ENTER(GFN_DIRECT_IO) struct file *file = iocb->ki_filp; struct inode *inode = file->f_mapping->host; struct gfs_inode *ip = get_v2ip(inode); struct gfs_sbd *sdp = ip->i_sbd; - get_blocks_t *gb = get_blocks; + get_block_t *gb = get_blocks; atomic_inc(&sdp->sd_ops_address); if (gfs_assert_warn(sdp, gfs_glock_is_locked_by_me(ip->i_gl)) || gfs_assert_warn(sdp, !gfs_is_stuffed(ip))) - RETURN(GFN_DIRECT_IO, -EINVAL); + return -EINVAL; if (rw == WRITE && !get_transaction) gb = get_blocks_noalloc; - RETURN(GFN_DIRECT_IO, - blockdev_direct_IO(rw, iocb, inode, + return blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, - offset, nr_segs, gb, NULL)); + offset, nr_segs, gb, NULL); } struct address_space_operations gfs_file_aops = { --- cluster/gfs-kernel/src/gfs/ops_address.h 2004/06/24 08:53:28 1.1 +++ cluster/gfs-kernel/src/gfs/ops_address.h 2006/07/10 23:22:34 1.2 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/ops_dentry.c 2006/01/09 22:25:06 1.5 +++ cluster/gfs-kernel/src/gfs/ops_dentry.c 2006/07/10 23:22:34 1.6 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -38,7 +38,6 @@ static int gfs_drevalidate(struct dentry *dentry, struct nameidata *nd) { - ENTER(GFN_DREVALIDATE) struct dentry *parent = dget_parent(dentry); struct gfs_inode *dip = get_v2ip(parent->d_inode); struct gfs_sbd *sdp = dip->i_sbd; @@ -94,7 +93,7 @@ valid: unlock_kernel(); dput(parent); - RETURN(GFN_DREVALIDATE, 1); + return 1; invalid_gunlock: gfs_glock_dq_uninit(&d_gh); @@ -109,7 +108,7 @@ unlock_kernel(); dput(parent); - RETURN(GFN_DREVALIDATE, 0); + return 0; fail_gunlock: gfs_glock_dq_uninit(&d_gh); @@ -117,7 +116,7 @@ fail: unlock_kernel(); dput(parent); - RETURN(GFN_DREVALIDATE, 0); + return 0; } struct dentry_operations gfs_dops = { --- cluster/gfs-kernel/src/gfs/ops_dentry.h 2004/06/24 08:53:28 1.1 +++ cluster/gfs-kernel/src/gfs/ops_dentry.h 2006/07/10 23:22:34 1.2 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/ops_export.c 2006/02/09 19:07:04 1.6 +++ cluster/gfs-kernel/src/gfs/ops_export.c 2006/07/10 23:22:34 1.7 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -57,13 +57,12 @@ int (*acceptable)(void *context, struct dentry *dentry), void *context) { - ENTER(GFN_DECODE_FH) struct inode_cookie this, parent; atomic_inc(&get_v2sdp(sb)->sd_ops_export); if (fh_type != fh_len) - RETURN(GFN_DECODE_FH, NULL); + return NULL; memset(&parent, 0, sizeof(struct inode_cookie)); @@ -81,12 +80,11 @@ this.formal_ino |= (uint64_t)gfs32_to_cpu(fh[1]); break; default: - RETURN(GFN_DECODE_FH, NULL); + return NULL; } - RETURN(GFN_DECODE_FH, - gfs_export_ops.find_exported_dentry(sb, &this, &parent, - acceptable, context)); + return gfs_export_ops.find_exported_dentry(sb, &this, &parent, + acceptable, context); } /** @@ -104,7 +102,6 @@ gfs_encode_fh(struct dentry *dentry, __u32 *fh, int *len, int connectable) { - ENTER(GFN_ENCODE_FH) struct inode *inode = dentry->d_inode; struct gfs_inode *ip = get_v2ip(inode); int maxlen = *len; @@ -112,7 +109,7 @@ atomic_inc(&ip->i_sbd->sd_ops_export); if (maxlen < 3) - RETURN(GFN_ENCODE_FH, 255); + return 255; fh[0] = cpu_to_gfs32((uint32_t)(ip->i_num.no_formal_ino >> 32)); fh[1] = cpu_to_gfs32((uint32_t)(ip->i_num.no_formal_ino & 0xFFFFFFFF)); @@ -120,7 +117,7 @@ *len = 3; if (maxlen < 5 || !connectable) - RETURN(GFN_ENCODE_FH, 3); + return 3; spin_lock(&dentry->d_lock); @@ -133,7 +130,7 @@ if (maxlen < 6) { spin_unlock(&dentry->d_lock); - RETURN(GFN_ENCODE_FH, 5); + return 5; } fh[5] = cpu_to_gfs32(inode->i_generation); /* dinode's mh_incarn */ @@ -142,7 +139,7 @@ *len = 6; - RETURN(GFN_ENCODE_FH, 6); + return 6; } /** @@ -162,16 +159,15 @@ uint64_t offset, struct gfs_inum *inum, unsigned int type) { - ENTER(GFN_GET_NAME_FILLDIR) struct get_name_filldir *gnfd = (struct get_name_filldir *)opaque; if (inum->no_formal_ino != gnfd->formal_ino) - RETURN(GFN_GET_NAME_FILLDIR, 0); + return 0; memcpy(gnfd->name, name, length); gnfd->name[length] = 0; - RETURN(GFN_GET_NAME_FILLDIR, 1); + return 1; } /** @@ -188,7 +184,6 @@ int gfs_get_name(struct dentry *parent, char *name, struct dentry *child) { - ENTER(GFN_GET_NAME) struct inode *dir = parent->d_inode; struct inode *inode = child->d_inode; struct gfs_inode *dip, *ip; @@ -198,12 +193,12 @@ int error; if (!dir) - RETURN(GFN_GET_NAME, -EINVAL); + return -EINVAL; atomic_inc(&get_v2sdp(dir->i_sb)->sd_ops_export); if (!S_ISDIR(dir->i_mode) || !inode) - RETURN(GFN_GET_NAME, -EINVAL); + return -EINVAL; dip = get_v2ip(dir); ip = get_v2ip(inode); @@ -214,7 +209,7 @@ error = gfs_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &gh); if (error) - RETURN(GFN_GET_NAME, error); + return error; error = gfs_dir_read(dip, &offset, &gnfd, get_name_filldir); @@ -223,7 +218,7 @@ if (!error & !*name) error = -ENOENT; - RETURN(GFN_GET_NAME, error); + return error; } /** @@ -240,7 +235,6 @@ struct dentry * gfs_get_parent(struct dentry *child) { - ENTER(GFN_GET_PARENT) struct gfs_inode *dip = get_v2ip(child->d_inode); struct gfs_holder d_gh, i_gh; struct qstr dotdot = { .name = "..", .len = 2 }; @@ -269,19 +263,19 @@ gfs_inode_put(ip); if (!inode) - RETURN(GFN_GET_PARENT, ERR_PTR(-ENOMEM)); + return ERR_PTR(-ENOMEM); dentry = d_alloc_anon(inode); if (!dentry) { iput(inode); - RETURN(GFN_GET_PARENT, ERR_PTR(-ENOMEM)); + return ERR_PTR(-ENOMEM); } - RETURN(GFN_GET_PARENT, dentry); + return dentry; fail: gfs_holder_uninit(&d_gh); - RETURN(GFN_GET_PARENT, ERR_PTR(error)); + return ERR_PTR(error); } /** @@ -298,7 +292,6 @@ struct dentry * gfs_get_dentry(struct super_block *sb, void *inump) { - ENTER(GFN_GET_DENTRY) struct gfs_sbd *sdp = get_v2sdp(sb); struct inode_cookie *cookie = (struct inode_cookie *)inump; struct gfs_inum inum; @@ -318,7 +311,7 @@ cookie->formal_ino == sdp->sd_riinode->i_num.no_formal_ino || cookie->formal_ino == sdp->sd_qinode->i_num.no_formal_ino || cookie->formal_ino == sdp->sd_linode->i_num.no_formal_ino) - RETURN(GFN_GET_DENTRY, ERR_PTR(-EINVAL)); + return ERR_PTR(-EINVAL); inum.no_formal_ino = cookie->formal_ino; inum.no_addr = cookie->formal_ino; @@ -328,7 +321,7 @@ LM_ST_SHARED, LM_FLAG_ANY | GL_LOCAL_EXCL, &i_gh); if (error) - RETURN(GFN_GET_DENTRY, ERR_PTR(error)); + return ERR_PTR(error); error = gfs_inode_get(i_gh.gh_gl, &inum, NO_CREATE, &ip); if (error) @@ -383,21 +376,21 @@ gfs_inode_put(ip); if (!inode) - RETURN(GFN_GET_DENTRY, ERR_PTR(-ENOMEM)); + return ERR_PTR(-ENOMEM); /* inode->i_generation is GFS dinode's mh_incarn value */ if (cookie->gen_valid && cookie->gen != inode->i_generation) { iput(inode); - RETURN(GFN_GET_DENTRY, ERR_PTR(-ESTALE)); + return ERR_PTR(-ESTALE); } dentry = d_alloc_anon(inode); if (!dentry) { iput(inode); - RETURN(GFN_GET_DENTRY, ERR_PTR(-ENOMEM)); + return ERR_PTR(-ENOMEM); } - RETURN(GFN_GET_DENTRY, dentry); + return dentry; fail_relse: brelse(bh); @@ -410,7 +403,7 @@ fail: gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_GET_DENTRY, ERR_PTR(error)); + return ERR_PTR(error); } struct export_operations gfs_export_ops = { --- cluster/gfs-kernel/src/gfs/ops_export.h 2004/06/24 08:53:28 1.1 +++ cluster/gfs-kernel/src/gfs/ops_export.h 2006/07/10 23:22:34 1.2 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/ops_file.c 2006/06/17 06:38:23 1.23 +++ cluster/gfs-kernel/src/gfs/ops_file.c 2006/07/10 23:22:34 1.24 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -93,7 +93,6 @@ static loff_t gfs_llseek(struct file *file, loff_t offset, int origin) { - ENTER(GFN_LLSEEK) struct gfs_inode *ip = get_v2ip(file->f_mapping->host); struct gfs_holder i_gh; loff_t error; @@ -109,7 +108,7 @@ } else error = remote_llseek(file, offset, origin); - RETURN(GFN_LLSEEK, error); + return error; } #define vma2state(vma) \ @@ -132,7 +131,6 @@ walk_vm_hard(struct file *file, char *buf, size_t size, loff_t *offset, do_rw_t operation) { - ENTER(GFN_WALK_VM_HARD) struct gfs_holder *ghs; unsigned int num_gh = 0; ssize_t count; @@ -159,7 +157,7 @@ if (!ghs) { if (!dumping) up_read(&mm->mmap_sem); - RETURN(GFN_WALK_VM_HARD, -ENOMEM); + return -ENOMEM; } for (vma = find_vma(mm, start); vma; vma = vma->vm_next) { @@ -186,7 +184,7 @@ gfs_holder_uninit(&ghs[num_gh]); kfree(ghs); - RETURN(GFN_WALK_VM_HARD, count); + return count; } /** @@ -208,8 +206,6 @@ walk_vm(struct file *file, char *buf, size_t size, loff_t *offset, do_rw_t operation) { - ENTER(GFN_WALK_VM) - if (current->mm) { struct super_block *sb = file->f_dentry->d_inode->i_sb; struct mm_struct *mm = current->mm; @@ -235,13 +231,11 @@ { struct gfs_holder gh; - RETURN(GFN_WALK_VM, - operation(file, buf, size, offset, 0, &gh)); + return operation(file, buf, size, offset, 0, &gh); } do_locks: - RETURN(GFN_WALK_VM, - walk_vm_hard(file, buf, size, offset, operation)); + return walk_vm_hard(file, buf, size, offset, operation); } /** @@ -258,18 +252,17 @@ static ssize_t do_read_readi(struct file *file, char *buf, size_t size, loff_t *offset) { - ENTER(GFN_DO_READ_READI) struct gfs_inode *ip = get_v2ip(file->f_mapping->host); ssize_t count = 0; if (*offset < 0) - RETURN(GFN_DO_READ_READI, -EINVAL); + return -EINVAL; if (!access_ok(VERIFY_WRITE, buf, size)) - RETURN(GFN_DO_READ_READI, -EFAULT); + return -EFAULT; if (!(file->f_flags & O_LARGEFILE)) { if (*offset >= 0x7FFFFFFFull) - RETURN(GFN_DO_READ_READI, -EFBIG); + return -EFBIG; if (*offset + size > 0x7FFFFFFFull) size = 0x7FFFFFFFull - *offset; } @@ -279,7 +272,7 @@ if (count > 0) *offset += count; - RETURN(GFN_DO_READ_READI, count); + return count; } /** @@ -300,7 +293,6 @@ do_read_direct(struct file *file, char *buf, size_t size, loff_t *offset, unsigned int num_gh, struct gfs_holder *ghs) { - ENTER(GFN_DO_READ_DIRECT) struct inode *inode = file->f_mapping->host; struct gfs_inode *ip = get_v2ip(inode); unsigned int state = LM_ST_DEFERRED; @@ -345,7 +337,7 @@ out: gfs_holder_uninit(&ghs[num_gh]); - RETURN(GFN_DO_READ_DIRECT, (count) ? count : error); + return (count) ? count : error; } /** @@ -366,7 +358,6 @@ do_read_buf(struct file *file, char *buf, size_t size, loff_t *offset, unsigned int num_gh, struct gfs_holder *ghs) { - ENTER(GFN_DO_READ_BUF) struct gfs_inode *ip = get_v2ip(file->f_mapping->host); ssize_t count = 0; int error; @@ -388,7 +379,7 @@ out: gfs_holder_uninit(&ghs[num_gh]); - RETURN(GFN_DO_READ_BUF, (count) ? count : error); + return (count) ? count : error; } /** @@ -406,15 +397,12 @@ static ssize_t gfs_read(struct file *file, char *buf, size_t size, loff_t *offset) { - ENTER(GFN_READ) atomic_inc(&get_v2sdp(file->f_mapping->host->i_sb)->sd_ops_file); if (file->f_flags & O_DIRECT) - RETURN(GFN_READ, - walk_vm(file, buf, size, offset, do_read_direct)); + return walk_vm(file, buf, size, offset, do_read_direct); else - RETURN(GFN_READ, - walk_vm(file, buf, size, offset, do_read_buf)); + return walk_vm(file, buf, size, offset, do_read_buf); } /** @@ -433,19 +421,19 @@ static int grope_mapping(char *buf, size_t size) { - ENTER(GFN_GROPE_MAPPING) unsigned long start = (unsigned long)buf; unsigned long stop = start + size; char c; while (start < stop) { if (copy_from_user(&c, (char *)start, 1)) - RETURN(GFN_GROPE_MAPPING, -EFAULT); + return -EFAULT; + start += PAGE_CACHE_SIZE; start &= PAGE_CACHE_MASK; } - RETURN(GFN_GROPE_MAPPING, 0); + return 0; } /** @@ -463,7 +451,6 @@ static ssize_t do_write_direct_alloc(struct file *file, char *buf, size_t size, loff_t *offset) { - ENTER(GFN_DO_WRITE_DIRECT_ALLOC) struct inode *inode = file->f_mapping->host; struct gfs_inode *ip = get_v2ip(inode); struct gfs_sbd *sdp = ip->i_sbd; @@ -554,9 +541,9 @@ error = filemap_fdatawait(file->f_mapping); } if (error) - count = error; + return error; - RETURN(GFN_DO_WRITE_DIRECT_ALLOC, count); + return count; fail_end_trans: gfs_trans_end(sdp); @@ -570,7 +557,7 @@ fail: gfs_alloc_put(ip); - RETURN(GFN_DO_WRITE_DIRECT_ALLOC, error); + return error; } /** @@ -591,7 +578,6 @@ do_write_direct(struct file *file, char *buf, size_t size, loff_t *offset, unsigned int num_gh, struct gfs_holder *ghs) { - ENTER(GFN_DO_WRITE_DIRECT) struct gfs_inode *ip = get_v2ip(file->f_mapping->host); struct gfs_sbd *sdp = ip->i_sbd; struct gfs_file *fp = get_v2fp(file); @@ -691,13 +677,13 @@ error = 0; - out_gunlock: +out_gunlock: gfs_glock_dq_m(num_gh + 1, ghs); - out: +out: gfs_holder_uninit(&ghs[num_gh]); - RETURN(GFN_DO_WRITE_DIRECT, (count) ? count : error); + return (count) ? count : error; } /** @@ -715,7 +701,6 @@ static ssize_t do_do_write_buf(struct file *file, char *buf, size_t size, loff_t *offset) { - ENTER(GFN_DO_DO_WRITE_BUF) struct inode *inode = file->f_mapping->host; struct gfs_inode *ip = get_v2ip(inode); struct gfs_sbd *sdp = ip->i_sbd; @@ -732,7 +717,7 @@ error = gfs_write_alloc_required(ip, *offset, size, &alloc_required); if (error) - RETURN(GFN_DO_DO_WRITE_BUF, error); + return error; if (alloc_required) { al = gfs_alloc_get(ip); @@ -848,7 +833,7 @@ gfs_alloc_put(ip); } - RETURN(GFN_DO_DO_WRITE_BUF, count); + return count; fail_end_trans: gfs_trans_end(sdp); @@ -865,7 +850,7 @@ if (alloc_required) gfs_alloc_put(ip); - RETURN(GFN_DO_DO_WRITE_BUF, error); + return error; } /** @@ -887,7 +872,6 @@ char *buf, size_t size, loff_t *offset, unsigned int num_gh, struct gfs_holder *ghs) { - ENTER(GFN_DO_WRITE_BUF) struct gfs_inode *ip = get_v2ip(file->f_mapping->host); struct gfs_sbd *sdp = ip->i_sbd; size_t s; @@ -940,7 +924,7 @@ out: gfs_holder_uninit(&ghs[num_gh]); - RETURN(GFN_DO_WRITE_BUF, (count) ? count : error); + return (count) ? count : error; } /** @@ -958,25 +942,24 @@ static ssize_t gfs_write(struct file *file, const char *buf, size_t size, loff_t *offset) { - ENTER(GFN_WRITE) struct inode *inode = file->f_mapping->host; ssize_t count; atomic_inc(&get_v2sdp(inode->i_sb)->sd_ops_file); if (*offset < 0) - RETURN(GFN_WRITE, -EINVAL); + return -EINVAL; if (!access_ok(VERIFY_READ, buf, size)) - RETURN(GFN_WRITE, -EFAULT); + return -EFAULT; - down(&inode->i_mutex); + mutex_lock(&inode->i_mutex); if (file->f_flags & O_DIRECT) count = walk_vm(file, (char *)buf, size, offset, do_write_direct); else count = walk_vm(file, (char *)buf, size, offset, do_write_buf); - up(&inode->i_mutex); + mutex_unlock(&inode->i_mutex); - RETURN(GFN_WRITE, count); + return count; } /** @@ -997,7 +980,6 @@ uint64_t offset, struct gfs_inum *inum, unsigned int type) { - ENTER(GFN_FILLDIR_REG_FUNC) struct filldir_reg *fdr = (struct filldir_reg *)opaque; struct gfs_sbd *sdp = fdr->fdr_sbd; unsigned int vfs_type; @@ -1032,13 +1014,13 @@ if (gfs_consist(sdp)) printk("GFS: fsid=%s: type = %u\n", sdp->sd_fsname, type); - RETURN(GFN_FILLDIR_REG_FUNC, -EIO); + return -EIO; } error = fdr->fdr_filldir(fdr->fdr_opaque, name, length, offset, inum->no_formal_ino, vfs_type); if (error) - RETURN(GFN_FILLDIR_REG_FUNC, 1); + return 1; /* Prefetch locks */ if (fdr->fdr_prefetch && !(length == 1 && *name == '.')) { @@ -1050,7 +1032,7 @@ LM_ST_SHARED, LM_FLAG_TRY); } - RETURN(GFN_FILLDIR_REG_FUNC, 0); + return 0; } /** @@ -1065,7 +1047,6 @@ static int readdir_reg(struct file *file, void *dirent, filldir_t filldir) { - ENTER(GFN_READDIR_REG) struct gfs_inode *dip = get_v2ip(file->f_mapping->host); struct filldir_reg fdr; struct gfs_holder d_gh; @@ -1081,7 +1062,7 @@ error = gfs_glock_nq_atime(&d_gh); if (error) { gfs_holder_uninit(&d_gh); - RETURN(GFN_READDIR_REG, error); + return error; } error = gfs_dir_read(dip, &offset, &fdr, filldir_reg_func); @@ -1090,7 +1071,7 @@ file->f_pos = offset; - RETURN(GFN_READDIR_REG, error); + return error; } /** @@ -1113,14 +1094,13 @@ uint64_t offset, struct gfs_inum *inum, unsigned int type) { - ENTER(GFN_FILLDIR_BAD_FUNC) struct filldir_bad *fdb = (struct filldir_bad *)opaque; struct gfs_sbd *sdp = fdb->fdb_sbd; struct filldir_bad_entry *fbe; if (fdb->fdb_entry_off == fdb->fdb_entry_num || fdb->fdb_name_off + length > fdb->fdb_name_size) - RETURN(GFN_FILLDIR_BAD_FUNC, 1); + return 1; fbe = &fdb->fdb_entry[fdb->fdb_entry_off]; fbe->fbe_name = fdb->fdb_name + fdb->fdb_name_off; @@ -1143,7 +1123,7 @@ LM_ST_SHARED, LM_FLAG_TRY); } - RETURN(GFN_FILLDIR_BAD_FUNC, 0); + return 0; } /** @@ -1160,7 +1140,6 @@ static int readdir_bad(struct file *file, void *dirent, filldir_t filldir) { - ENTER(GFN_READDIR_BAD) struct gfs_inode *dip = get_v2ip(file->f_mapping->host); struct gfs_sbd *sdp = dip->i_sbd; struct filldir_reg fdr; @@ -1178,7 +1157,7 @@ fdb = kmalloc(size, GFP_KERNEL); if (!fdb) - RETURN(GFN_READDIR_BAD, -ENOMEM); + return -ENOMEM; memset(fdb, 0, size); fdb->fdb_sbd = sdp; @@ -1223,7 +1202,7 @@ out: kfree(fdb); - RETURN(GFN_READDIR_BAD, error); + return error; } /** @@ -1238,7 +1217,6 @@ static int gfs_readdir(struct file *file, void *dirent, filldir_t filldir) { - ENTER(GFN_READDIR) int error; atomic_inc(&get_v2sdp(file->f_mapping->host->i_sb)->sd_ops_file); @@ -1249,7 +1227,7 @@ else error = readdir_bad(file, dirent, filldir); - RETURN(GFN_READDIR, error); + return error; } /** @@ -1266,7 +1244,6 @@ gfs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { - ENTER(GFN_IOCTL) struct gfs_inode *ip = get_v2ip(inode); atomic_inc(&ip->i_sbd->sd_ops_file); @@ -1275,15 +1252,15 @@ case GFS_IOCTL_IDENTIFY: { unsigned int x = GFS_MAGIC; if (copy_to_user((unsigned int *)arg, &x, sizeof(unsigned int))) - RETURN(GFN_IOCTL, -EFAULT); - RETURN(GFN_IOCTL, 0); + return -EFAULT; + return 0; } case GFS_IOCTL_SUPER: - RETURN(GFN_IOCTL, gfs_ioctl_i(ip, (void *)arg)); + return gfs_ioctl_i(ip, (void *)arg); default: - RETURN(GFN_IOCTL, -ENOTTY); + return -ENOTTY; } } @@ -1298,7 +1275,6 @@ static int gfs_mmap(struct file *file, struct vm_area_struct *vma) { - ENTER(GFN_MMAP) struct gfs_inode *ip = get_v2ip(file->f_mapping->host); struct gfs_holder i_gh; int error; @@ -1309,7 +1285,7 @@ error = gfs_glock_nq_atime(&i_gh); if (error) { gfs_holder_uninit(&i_gh); - RETURN(GFN_MMAP, error); + return error; } if (gfs_is_jdata(ip)) { @@ -1329,7 +1305,7 @@ gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_MMAP, error); + return error; } /** @@ -1343,7 +1319,6 @@ static int gfs_open(struct inode *inode, struct file *file) { - ENTER(GFN_OPEN) struct gfs_inode *ip = get_v2ip(inode); struct gfs_holder i_gh; struct gfs_file *fp; @@ -1353,7 +1328,7 @@ fp = kmalloc(sizeof(struct gfs_file), GFP_KERNEL); if (!fp) - RETURN(GFN_OPEN, -ENOMEM); + return -ENOMEM; memset(fp, 0, sizeof(struct gfs_file)); init_MUTEX(&fp->f_fl_lock); @@ -1392,7 +1367,7 @@ gfs_glock_dq_uninit(&i_gh); } - RETURN(GFN_OPEN, 0); + return 0; fail_gunlock: gfs_glock_dq_uninit(&i_gh); @@ -1401,7 +1376,7 @@ set_v2fp(file, NULL); kfree(fp); - RETURN(GFN_OPEN, error); + return error; } /** @@ -1415,7 +1390,6 @@ static int gfs_close(struct inode *inode, struct file *file) { - ENTER(GFN_CLOSE) struct gfs_sbd *sdp = get_v2sdp(inode->i_sb); struct gfs_file *fp; @@ -1427,7 +1401,7 @@ if (!gfs_assert_warn(sdp, fp)) kfree(fp); - RETURN(GFN_CLOSE, 0); + return 0; } /** @@ -1444,7 +1418,6 @@ static int gfs_fsync(struct file *file, struct dentry *dentry, int datasync) { - ENTER(GFN_FSYNC) struct gfs_inode *ip = get_v2ip(dentry->d_inode); struct gfs_holder i_gh; int error; @@ -1453,7 +1426,7 @@ error = gfs_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh); if (error) - RETURN(GFN_FSYNC, error); + return error; if (gfs_is_jdata(ip)) gfs_log_flush_glock(ip->i_gl); @@ -1462,7 +1435,7 @@ gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_FSYNC, error); + return error; } /** @@ -1477,7 +1450,6 @@ static int gfs_lock(struct file *file, int cmd, struct file_lock *fl) { - ENTER(GFN_LOCK) struct gfs_inode *ip = get_v2ip(file->f_mapping->host); struct gfs_sbd *sdp = ip->i_sbd; struct lm_lockname name = @@ -1487,38 +1459,31 @@ atomic_inc(&sdp->sd_ops_file); if (!(fl->fl_flags & FL_POSIX)) - RETURN(GFN_LOCK, -ENOLCK); + return -ENOLCK; if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID) - RETURN(GFN_LOCK, -ENOLCK); + return -ENOLCK; if (sdp->sd_args.ar_localflocks) { if (IS_GETLK(cmd)) { - struct file_lock *tmp; - lock_kernel(); - tmp = posix_test_lock(file, fl); + int conflict; + struct file_lock tmp; + + conflict = posix_test_lock(file, fl, &tmp); fl->fl_type = F_UNLCK; - if (tmp) - memcpy(fl, tmp, sizeof(struct file_lock)); - unlock_kernel(); - RETURN(GFN_LOCK, 0); + if (conflict) + memcpy(fl, &tmp, sizeof(struct file_lock)); + return 0; } else { - int error; - lock_kernel(); - error = posix_lock_file_wait(file, fl); - unlock_kernel(); - RETURN(GFN_LOCK, error); + return posix_lock_file_wait(file, fl); } } if (IS_GETLK(cmd)) - RETURN(GFN_LOCK, - gfs_lm_plock_get(sdp, &name, file, fl)); + return gfs_lm_plock_get(sdp, &name, file, fl); else if (fl->fl_type == F_UNLCK) - RETURN(GFN_LOCK, - gfs_lm_punlock(sdp, &name, file, fl)); + return gfs_lm_punlock(sdp, &name, file, fl); else - RETURN(GFN_LOCK, - gfs_lm_plock(sdp, &name, file, cmd, fl)); + return gfs_lm_plock(sdp, &name, file, cmd, fl); } /** @@ -1536,7 +1501,6 @@ static ssize_t gfs_sendfile(struct file *in_file, loff_t *offset, size_t count, read_actor_t actor, void __user *target) { - ENTER(GFN_SENDFILE) struct gfs_inode *ip = get_v2ip(in_file->f_mapping->host); struct gfs_holder gh; ssize_t retval; @@ -1559,7 +1523,7 @@ out: gfs_holder_uninit(&gh); - RETURN(GFN_SENDFILE, retval); + return retval; } /** @@ -1574,7 +1538,6 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl) { - ENTER(GFN_DO_FLOCK) struct gfs_file *fp = get_v2fp(file); struct gfs_holder *fl_gh = &fp->f_fl_gh; struct gfs_inode *ip = fp->f_inode; @@ -1620,7 +1583,7 @@ out: up(&fp->f_fl_lock); - RETURN(GFN_DO_FLOCK, error); + return error; } /** @@ -1633,7 +1596,6 @@ static void do_unflock(struct file *file, struct file_lock *fl) { - ENTER(GFN_DO_UNFLOCK) struct gfs_file *fp = get_v2fp(file); struct gfs_holder *fl_gh = &fp->f_fl_gh; @@ -1642,8 +1604,6 @@ if (fl_gh->gh_gl) gfs_glock_dq_uninit(fl_gh); up(&fp->f_fl_lock); - - RET(GFN_DO_UNFLOCK); } /** @@ -1658,25 +1618,24 @@ static int gfs_flock(struct file *file, int cmd, struct file_lock *fl) { - ENTER(GFN_FLOCK) struct gfs_inode *ip = get_v2ip(file->f_mapping->host); struct gfs_sbd *sdp = ip->i_sbd; atomic_inc(&ip->i_sbd->sd_ops_file); if (!(fl->fl_flags & FL_FLOCK)) - RETURN(GFN_FLOCK, -ENOLCK); + return -ENOLCK; if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID) - RETURN(GFN_FLOCK, -ENOLCK); + return -ENOLCK; if (sdp->sd_args.ar_localflocks) - RETURN(GFN_FLOCK, flock_lock_file_wait(file, fl)); + return flock_lock_file_wait(file, fl); if (fl->fl_type == F_UNLCK) { do_unflock(file, fl); - RETURN(GFN_FLOCK, 0); + return 0; } else - RETURN(GFN_FLOCK, do_flock(file, cmd, fl)); + return do_flock(file, cmd, fl); } struct file_operations gfs_file_fops = { --- cluster/gfs-kernel/src/gfs/ops_file.h 2004/06/24 08:53:28 1.1 +++ cluster/gfs-kernel/src/gfs/ops_file.h 2006/07/10 23:22:34 1.2 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/ops_fstype.c 2006/06/17 06:38:23 1.24 +++ cluster/gfs-kernel/src/gfs/ops_fstype.c 2006/07/10 23:22:34 1.25 @@ -1,30 +1,25 @@ -/****************************************************************************** -******************************************************************************* -** -** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 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. -** -******************************************************************************* -******************************************************************************/ +/* + * 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 v.2. + * + */ #include #include #include #include -#include #include #include #include #include -#include +#include #include "gfs.h" #include "daemon.h" -#include "diaper.h" #include "glock.h" #include "glops.h" #include "inode.h" @@ -33,216 +28,32 @@ #include "ops_export.h" #include "ops_fstype.h" #include "ops_super.h" -#include "proc.h" +#include "sys.h" #include "quota.h" #include "recovery.h" #include "rgrp.h" #include "super.h" #include "unlinked.h" -static ssize_t id_show(struct gfs_sbd *sdp, char *buf) -{ - return sprintf(buf, "%s\n", sdp->sd_vfs->s_id); -} - -static ssize_t fsname_show(struct gfs_sbd *sdp, char *buf) -{ - return sprintf(buf, "%s\n", sdp->sd_fsname); -} - -struct gfs_attr { - struct attribute attr; - ssize_t (*show)(struct gfs_sbd *, char *); - ssize_t (*store)(struct gfs_sbd *, const char *, size_t); -}; - -#define GFS_ATTR(name, mode, show, store) \ -static struct gfs_attr gfs_attr_##name = __ATTR(name, mode, show, store) - -GFS_ATTR(id, 0444, id_show, NULL); -GFS_ATTR(fsname, 0444, fsname_show, NULL); - -static struct attribute *gfs_attrs[] = { - &gfs_attr_id.attr, - &gfs_attr_fsname.attr, - NULL, -}; - -static ssize_t gfs_attr_show(struct kobject *kobj, struct attribute *attr, - char *buf) -{ - struct gfs_sbd *sdp = container_of(kobj, struct gfs_sbd, sd_kobj); - struct gfs_attr *a = container_of(attr, struct gfs_attr, attr); - return a->show ? a->show(sdp, buf) : 0; -} - -static ssize_t gfs_attr_store(struct kobject *kobj, struct attribute *attr, - const char *buf, size_t len) -{ - struct gfs_sbd *sdp = container_of(kobj, struct gfs_sbd, sd_kobj); - struct gfs_attr *a = container_of(attr, struct gfs_attr, attr); - return a->store ? a->store(sdp, buf, len) : len; -} - -static struct sysfs_ops gfs_attr_ops = { - .show = gfs_attr_show, - .store = gfs_attr_store, -}; - -static struct kobj_type gfs_ktype = { - .default_attrs = gfs_attrs, - .sysfs_ops = &gfs_attr_ops, -}; - -static struct kset gfs_kset = { - .subsys = &fs_subsys, - .kobj = {.name = "gfs",}, - .ktype = &gfs_ktype, -}; - -int gfs_sys_fs_add(struct gfs_sbd *sdp) -{ - int error; - - sdp->sd_kobj.kset = &gfs_kset; - sdp->sd_kobj.ktype = &gfs_ktype; +#define DO 0 +#define UNDO 1 - error = kobject_set_name(&sdp->sd_kobj, "%s", sdp->sd_table_name); - if (error) - goto fail; - - error = kobject_register(&sdp->sd_kobj); - if (error) - goto fail; - - return 0; - fail: - return error; -} - -void gfs_sys_fs_del(struct gfs_sbd *sdp) -{ - kobject_unregister(&sdp->sd_kobj); -} - -int gfs_sys_init(void) -{ - return kset_register(&gfs_kset); -} - -void gfs_sys_uninit(void) -{ - kset_unregister(&gfs_kset); -} - -static int init_names(struct gfs_sbd *sdp, int silent) -{ - struct gfs_sb *sb = NULL; - char *proto, *table; - int error = 0; - - proto = sdp->sd_args.ar_lockproto; - table = sdp->sd_args.ar_locktable; - - /* Try to autodetect */ - - if (!proto[0] || !table[0]) { - struct buffer_head *bh; - bh = sb_getblk(sdp->sd_vfs, - GFS_SB_ADDR >> sdp->sd_fsb2bb_shift); - lock_buffer(bh); - clear_buffer_uptodate(bh); - clear_buffer_dirty(bh); - unlock_buffer(bh); - ll_rw_block(READ, 1, &bh); - wait_on_buffer(bh); - - if (!buffer_uptodate(bh)) { - brelse(bh); - return -EIO; - } - - sb = kmalloc(sizeof(struct gfs_sb), GFP_KERNEL); - if (!sb) { - brelse(bh); - return -ENOMEM; - } - gfs_sb_in(sb, bh->b_data); - brelse(bh); - - error = gfs_check_sb(sdp, sb, silent); - if (error) - goto out; - - if (!proto[0]) - proto = sb->sb_lockproto; - if (!table[0]) - table = sb->sb_locktable; - } - - if (!table[0]) - table = sdp->sd_vfs->s_id; - - snprintf(sdp->sd_proto_name, 256, "%s", proto); - snprintf(sdp->sd_table_name, 256, "%s", table); - - out: - kfree(sb); - - return error; -} - -/** - * gfs_read_super - Read in superblock - * @sb: The VFS superblock - * @data: Mount options - * @silent: Don't complain if it's not a GFS filesystem - * - * Returns: errno - * - * After cross-linking Linux VFS incore superblock and our GFS incore superblock - * (filesystem instance structures) to one another, we: - * -- Init some of our GFS incore superblock, including some temporary - * block-size values (enough to read on-disk superblock). - * -- Set up some things in Linux VFS superblock. - * -- Mount a lock module, init glock system (incl. glock reclaim daemons), - * and init some important inter-node locks (MOUNT, LIVE, SuperBlock). - * -- Read-in the GFS on-disk superblock (1st time, to get enough info - * to do filesystem upgrade and journal replay, incl. journal index). - * -- Upgrade on-disk filesystem format (rarely needed). - * -- Replay journal(s) (always; replay *all* journals if we're first-to-mount). - * -- Read-in on-disk superblock and journal index special file again (2nd time, - * assumed 100% valid now after journal replay). - * -- Read-in info on other special (hidden) files (root inode, resource index, - * quota inode, license inode). - * -- Start other daemons (journal/log recovery, log tail, quota updates, inode - * reclaim) for periodic maintenance. - * - */ +extern struct dentry_operations gfs_dops; -static int -fill_super(struct super_block *sb, void *data, int silent) +static struct gfs_sbd *init_sbd(struct super_block *sb) { - ENTER(GFN_FILL_SUPER) struct gfs_sbd *sdp; - struct gfs_holder mount_gh, sb_gh, ji_gh; - struct inode *inode; - int super = TRUE, jindex = TRUE; unsigned int x; - int error; sdp = vmalloc(sizeof(struct gfs_sbd)); - if (!sdp) { - printk("GFS: can't alloc struct gfs_sbd\n"); - error = -ENOMEM; - goto fail; - } + if (!sdp) + return NULL; memset(sdp, 0, sizeof(struct gfs_sbd)); set_v2sdp(sb, sdp); sdp->sd_vfs = sb; - gfs_diaper_register_sbd(sb->s_bdev, sdp); + gfs_tune_init(&sdp->sd_tune); /* Init rgrp variables */ @@ -294,25 +105,12 @@ spin_lock_init(&sdp->sd_ail_lock); INIT_LIST_HEAD(&sdp->sd_recovery_bufs); - gfs_tune_init(&sdp->sd_tune); - - error = gfs_make_args((char *)data, &sdp->sd_args); - if (error) { - printk("GFS: can't parse mount arguments\n"); - goto fail_vfree; - } - - if (sdp->sd_args.ar_spectator) { - sb->s_flags |= MS_RDONLY; - set_bit(SDF_ROFS, &sdp->sd_flags); - } - - /* Copy VFS mount flags */ + return sdp; +} - if (sb->s_flags & (MS_NOATIME | MS_NODIRATIME)) - set_bit(SDF_NOATIME, &sdp->sd_flags); - if (sb->s_flags & MS_RDONLY) - set_bit(SDF_ROFS, &sdp->sd_flags); +static void init_vfs(struct super_block *sb, unsigned noatime) +{ + struct gfs_sbd *sdp = sb->s_fs_info; /* Set up Linux Virtual (VFS) Super Block */ @@ -328,36 +126,74 @@ lists), tell VFS */ if (sdp->sd_args.ar_posix_acls) sb->s_flags |= MS_POSIXACL; +} - /* Set up the buffer cache and fill in some fake block size values - to allow us to read-in the on-disk superblock. */ +int init_names(struct gfs_sbd *sdp, int silent) +{ + struct gfs_sb *sb = NULL; + char *proto, *table; + int error = 0; - sdp->sd_sb.sb_bsize = sb_min_blocksize(sb, GFS_BASIC_BLOCK); - sdp->sd_sb.sb_bsize_shift = sb->s_blocksize_bits; - sdp->sd_fsb2bb_shift = sdp->sd_sb.sb_bsize_shift - GFS_BASIC_BLOCK_SHIFT; - sdp->sd_fsb2bb = 1 << sdp->sd_fsb2bb_shift; + proto = sdp->sd_args.ar_lockproto; + table = sdp->sd_args.ar_locktable; - if (sizeof(struct gfs_sb) > sdp->sd_sb.sb_bsize) { - printk("GFS: sizeof(struct gfs_sb) > sdp->sd_sb.sb_bsize\n" - "GFS: %u > %u\n", - (unsigned int)sizeof(struct gfs_sb), sdp->sd_sb.sb_bsize); - error = -EINVAL; - goto fail_vfree; + /* Try to autodetect */ + + if (!proto[0] || !table[0]) { + struct buffer_head *bh; + + bh = sb_getblk(sdp->sd_vfs, + GFS_SB_ADDR >> sdp->sd_fsb2bb_shift); + lock_buffer(bh); + clear_buffer_uptodate(bh); + clear_buffer_dirty(bh); + unlock_buffer(bh); + ll_rw_block(READ, 1, &bh); + wait_on_buffer(bh); + + if (!buffer_uptodate(bh)) { + brelse(bh); + return -EIO; + } + + sb = kmalloc(sizeof(struct gfs_sb), GFP_KERNEL); + if (!sb) { + brelse(bh); + return -ENOMEM; + } + gfs_sb_in(sb, bh->b_data); + brelse(bh); + + error = gfs_check_sb(sdp, sb, silent); + if (error) + goto out; + + if (!proto[0]) + proto = sb->sb_lockproto; + if (!table[0]) + table = sb->sb_locktable; } - error = init_names(sdp, silent); - if (error) - goto fail_vfree; + if (!table[0]) + table = sdp->sd_vfs->s_id; - error = gfs_sys_fs_add(sdp); - if (error) - goto fail_vfree; + snprintf(sdp->sd_proto_name, 256, "%s", proto); + snprintf(sdp->sd_table_name, 256, "%s", table); - /* Mount an inter-node lock module, check for local optimizations */ + out: + kfree(sb); - error = gfs_lm_mount(sdp, silent); - if (error) - goto fail_sysfs; + return error; +} + +static int init_locking(struct gfs_sbd *sdp, struct gfs_holder *mount_gh, + int undo) +{ + struct task_struct *p; + int error = 0; + + if (undo) + goto fail_live; if ((sdp->sd_lockstruct.ls_flags & LM_LSFLAG_LOCAL) && !sdp->sd_args.ar_ignore_local_fs) { @@ -373,37 +209,39 @@ /* Start up the scand thread */ - error = kernel_thread(gfs_scand, sdp, 0); - if (error < 0) { + p = kthread_run(gfs_scand, sdp, "gfs_scand"); + error = IS_ERR(p); + if (error) { printk("GFS: fsid=%s: can't start scand thread: %d\n", sdp->sd_fsname, error); - goto fail_lockproto; + return error; } - wait_for_completion(&sdp->sd_thread_completion); + sdp->sd_scand_process = p; /* Start up the glockd thread */ for (sdp->sd_glockd_num = 0; sdp->sd_glockd_num < sdp->sd_args.ar_num_glockd; sdp->sd_glockd_num++) { - error = kernel_thread(gfs_glockd, sdp, 0); - if (error < 0) { + p = kthread_run(gfs_glockd, sdp, "gfs_glockd"); + error = IS_ERR(p); + if (error) { printk("GFS: fsid=%s: can't start glockd thread: %d\n", sdp->sd_fsname, error); - goto fail_glockd; + goto fail; } - wait_for_completion(&sdp->sd_thread_completion); + sdp->sd_glockd_process[sdp->sd_glockd_num] = p; } /* Only one node may mount at a time */ error = gfs_glock_nq_num(sdp, GFS_MOUNT_LOCK, &gfs_nondisk_glops, LM_ST_EXCLUSIVE, LM_FLAG_NOEXP | GL_NOCACHE, - &mount_gh); + mount_gh); if (error) { printk("GFS: fsid=%s: can't acquire mount glock: %d\n", sdp->sd_fsname, error); - goto fail_glockd; + goto fail; } /* Show that cluster is alive */ @@ -414,10 +252,37 @@ if (error) { printk("GFS: fsid=%s: can't acquire live glock: %d\n", sdp->sd_fsname, error); - goto fail_gunlock_mount; + goto fail_mount; } sdp->sd_live_gh.gh_owner = NULL; + return 0; + +fail_live: + gfs_glock_dq_uninit(&sdp->sd_live_gh); + +fail_mount: + gfs_glock_dq_uninit(mount_gh); + +fail: + while (sdp->sd_glockd_num--) + kthread_stop(sdp->sd_glockd_process[sdp->sd_glockd_num]); + + kthread_stop(sdp->sd_scand_process); + + return error; +} + +static int init_sb(struct gfs_sbd *sdp, int silent, int undo) +{ + struct super_block *sb = sdp->sd_vfs; + struct gfs_holder sb_gh; + int error = 0; + int super = TRUE; + + if (undo) { + return 0; + } /* Read the SuperBlock from disk, get enough info to enable us to read-in the journal index and replay all journals. */ @@ -429,14 +294,14 @@ if (error) { printk("GFS: fsid=%s: can't acquire superblock glock: %d\n", sdp->sd_fsname, error); - goto fail_gunlock_live; + return error; } error = gfs_read_sb(sdp, sb_gh.gh_gl, silent); if (error) { printk("GFS: fsid=%s: can't read superblock: %d\n", sdp->sd_fsname, error); - goto fail_gunlock_sb; + goto out; } /* Set up the buffer cache and SB for real, now that we know block @@ -446,13 +311,13 @@ if (sdp->sd_sb.sb_bsize < bdev_hardsect_size(sb->s_bdev)) { printk("GFS: fsid=%s: FS block size (%u) is too small for device block size (%u)\n", sdp->sd_fsname, sdp->sd_sb.sb_bsize, bdev_hardsect_size(sb->s_bdev)); - goto fail_gunlock_sb; + goto out; } if (sdp->sd_sb.sb_bsize > PAGE_SIZE) { printk("GFS: fsid=%s: FS block size (%u) is too big for machine page size (%u)\n", sdp->sd_fsname, sdp->sd_sb.sb_bsize, (unsigned int)PAGE_SIZE); - goto fail_gunlock_sb; + goto out; } /* Get rid of buffers from the original block size */ @@ -460,15 +325,56 @@ sb_gh.gh_gl->gl_aspace->i_blkbits = sdp->sd_sb.sb_bsize_shift; sb_set_blocksize(sb, sdp->sd_sb.sb_bsize); - set_blocksize(gfs_diaper_2real(sb->s_bdev), sdp->sd_sb.sb_bsize); - /* Read-in journal index inode (but not the file contents, yet) */ + /* Read in the resource index inode */ - error = gfs_get_jiinode(sdp); + error = gfs_get_riinode(sdp); if (error) { - printk("GFS: fsid=%s: can't get journal index inode: %d\n", + printk("GFS: fsid=%s: can't get resource index inode: %d\n", + sdp->sd_fsname, error); + goto out; + } + + /* Get the root inode */ + error = gfs_get_rootinode(sdp); + if (error) { + printk("GFS: fsid=%s: can't read in root inode: %d\n", + sdp->sd_fsname, error); + goto out; + } + sb->s_root = d_alloc_root(gfs_iget(sdp->sd_rooti, TRUE)); + if (!sb->s_root) { + printk("GFS: can't get root dentry\n"); + error = -ENOMEM; + } + sb->s_root->d_op = &gfs_dops; + + /* Read in the quota inode */ + error = gfs_get_qinode(sdp); + if (error) { + printk("GFS: fsid=%s: can't get quota file inode: %d\n", sdp->sd_fsname, error); - goto fail_gunlock_sb; + goto out; + } + + /* We're through with the superblock lock */ +out: + gfs_glock_dq_uninit(&sb_gh); + super = FALSE; + return error; +} + +static int init_journal(struct gfs_sbd *sdp, int undo) +{ + struct gfs_holder ji_gh; + int error = 0; + unsigned int x; + int jindex = TRUE; + struct task_struct *p; + + if (undo) { + jindex = 0; + goto fail_recoverd; } init_MUTEX(&sdp->sd_jindex_lock); @@ -479,31 +385,24 @@ error = gfs_glock_get(sdp, GFS_TRANS_LOCK, &gfs_trans_glops, CREATE, &sdp->sd_trans_gl); if (error) - goto fail_ji_free; + goto fail; set_bit(GLF_STICKY, &sdp->sd_trans_gl->gl_flags); - /* Upgrade GFS on-disk format version numbers if we need to */ - - if (sdp->sd_args.ar_upgrade) { - error = gfs_do_upgrade(sdp, sb_gh.gh_gl); - if (error) - goto fail_trans_gl; - } - /* Load in the journal index special file */ error = gfs_jindex_hold(sdp, &ji_gh); if (error) { printk("GFS: fsid=%s: can't read journal index: %d\n", sdp->sd_fsname, error); - goto fail_trans_gl; + goto fail_jindex; } if (sdp->sd_args.ar_spectator) { sdp->sd_jdesc = sdp->sd_jindex[0]; sdp->sd_log_seg_free = sdp->sd_jdesc.ji_nsegment; sdp->sd_log_seg_ail2 = 0; - } else { + } + else { /* Discover this node's journal number (lock module tells us which one to use), and lock it */ error = -EINVAL; @@ -512,7 +411,7 @@ sdp->sd_fsname, sdp->sd_lockstruct.ls_jid); printk("GFS: fsid=%s: there are only %u journals (0 - %u)\n", sdp->sd_fsname, sdp->sd_journals, sdp->sd_journals - 1); - goto fail_gunlock_ji; + goto fail_jindex; } sdp->sd_jdesc = sdp->sd_jindex[sdp->sd_lockstruct.ls_jid]; sdp->sd_log_seg_free = sdp->sd_jdesc.ji_nsegment; @@ -525,7 +424,7 @@ if (error) { printk("GFS: fsid=%s: can't acquire the journal glock: %d\n", sdp->sd_fsname, error); - goto fail_gunlock_ji; + goto fail_jindex; } } @@ -540,21 +439,19 @@ if (error) { printk("GFS: fsid=%s: error recovering journal %u: %d\n", sdp->sd_fsname, x, error); - goto fail_gunlock_journal; + goto fail_journal_gh; } } gfs_lm_others_may_mount(sdp); } else if (!sdp->sd_args.ar_spectator) { /* We're not the first; replay only our own journal. */ - error = gfs_recover_journal(sdp, - sdp->sd_lockstruct.ls_jid, - &sdp->sd_jdesc, - TRUE); + error = gfs_recover_journal(sdp, sdp->sd_lockstruct.ls_jid, + &sdp->sd_jdesc, TRUE); if (error) { printk("GFS: fsid=%s: error recovering my journal: %d\n", sdp->sd_fsname, error); - goto fail_gunlock_journal; + goto fail_journal_gh; } } @@ -562,258 +459,242 @@ jindex = FALSE; /* Disown my Journal glock */ - sdp->sd_journal_gh.gh_owner = NULL; - /* Drop our buffer cache and reread all the things we read before - the journal replay, on the unlikely chance that the replay might - have affected (corrected/updated) the superblock contents - or journal index. */ - - error = gfs_read_sb(sdp, sb_gh.gh_gl, FALSE); - if (error) { - printk("GFS: fsid=%s: can't read superblock: %d\n", - sdp->sd_fsname, error); - goto fail_gunlock_journal; - } - - gfs_glock_force_drop(sdp->sd_jiinode->i_gl); - - error = gfs_jindex_hold(sdp, &ji_gh); - if (error) { - printk("GFS: fsid=%s: can't read journal index: %d\n", - sdp->sd_fsname, error); - goto fail_gunlock_journal; - } - gfs_glock_dq_uninit(&ji_gh); - /* Make the FS read/write */ if (!test_bit(SDF_ROFS, &sdp->sd_flags)) { error = gfs_make_fs_rw(sdp); if (error) { - printk("GFS: fsid=%s: can't make FS RW: %d\n", + printk("GFS: fsid=%s: can't make file system RW: %d\n", sdp->sd_fsname, error); - goto fail_gunlock_journal; + goto fail; } } /* Start up the journal recovery thread */ - error = kernel_thread(gfs_recoverd, sdp, 0); - if (error < 0) { + p = kthread_run(gfs_recoverd, sdp, "gfs_recoverd"); + error = IS_ERR(p); + if (error) { printk("GFS: fsid=%s: can't start recoverd thread: %d\n", sdp->sd_fsname, error); - goto fail_make_ro; + goto fail_journal_gh; } - wait_for_completion(&sdp->sd_thread_completion); + sdp->sd_recoverd_process = p; - /* Read in the resource index inode */ + return 0; - error = gfs_get_riinode(sdp); - if (error) { - printk("GFS: fsid=%s: can't get resource index inode: %d\n", - sdp->sd_fsname, error); - goto fail_recoverd; - } +fail_recoverd: + kthread_stop(sdp->sd_recoverd_process); + sdp->sd_recoverd_process = NULL; - /* Get the root inode */ +fail_journal_gh: + if (!sdp->sd_args.ar_spectator) + gfs_glock_dq_uninit(&sdp->sd_journal_gh); - error = gfs_get_rootinode(sdp); +fail_jindex: + if (jindex) + gfs_glock_dq_uninit(&ji_gh); +fail: + return error; +} + +static int init_threads(struct gfs_sbd *sdp, int undo) +{ + struct task_struct *p; + int error = 0; + + if (undo) + goto fail_logd; + + sdp->sd_jindex_refresh_time = jiffies; + + /* Start up the logd thread */ + p = kthread_run(gfs_logd, sdp, "gfs_logd"); + error = IS_ERR(p); if (error) { - printk("GFS: fsid=%s: can't read in root inode: %d\n", + printk("GFS: fsid=%s: can't start logd thread: %d\n", sdp->sd_fsname, error); - goto fail_ri_free; + goto fail; } + sdp->sd_logd_process = p; - /* Read in the quota inode */ + /* Start up the quotad thread */ - error = gfs_get_qinode(sdp); - if (error) { - printk("GFS: fsid=%s: can't get quota file inode: %d\n", + p = kthread_run(gfs_quotad, sdp, "gfs_quotad"); + if (error < 0) { + printk("GFS: fsid=%s: can't start quotad thread: %d\n", sdp->sd_fsname, error); - goto fail_root_free; + goto fail_quotad; } + sdp->sd_quotad_process = p; - /* Read in the license inode */ + /* Start up the inoded thread */ - error = gfs_get_linode(sdp); - if (error) { - printk("GFS: fsid=%s: can't get license file inode: %d\n", + error = kernel_thread(gfs_inoded, sdp, 0); + if (error < 0) { + printk("GFS: fsid=%s: can't start inoded thread: %d\n", sdp->sd_fsname, error); - goto fail_qi_free; + goto fail_inoded; } + sdp->sd_inoded_process = p; + return 0; - /* We're through with the superblock lock */ +fail_logd: + kthread_stop(sdp->sd_logd_process); +fail_inoded: + kthread_stop(sdp->sd_quotad_process); +fail_quotad: + kthread_stop(sdp->sd_logd_process); +fail: + return error; +} - gfs_glock_dq_uninit(&sb_gh); - super = FALSE; +/** + * fill_super - Read in superblock + * @sb: The VFS superblock + * @data: Mount options + * @silent: Don't complain if it's not a GFS filesystem + * + * Returns: errno + * + * After cross-linking Linux VFS incore superblock and our GFS incore + * superblock (filesystem instance structures) to one another, we: + * -- Init some of our GFS incore superblock, including some temporary + * block-size values (enough to read on-disk superblock). + * -- Set up some things in Linux VFS superblock. + * -- Mount a lock module, init glock system (incl. glock reclaim daemons), + * and init some important inter-node locks (MOUNT, LIVE, SuperBlock). + * -- Read-in the GFS on-disk superblock (1st time, to get enough info + * to do filesystem upgrade and journal replay, incl. journal index). + * -- Upgrade on-disk filesystem format (rarely needed). + * -- Replay journals (always; replay *all* journals if we're first-to-mount). + * -- Read-in on-disk superblock and journal index special file again + * (2nd time, assumed 100% valid now after journal replay). + * -- Read-in info on other special (hidden) files (root inode, resource index, + * quota inode, license inode). + * -- Start other daemons (journal/log recovery, log tail, quota updates, inode + * reclaim) for periodic maintenance. + * + */ - /* Get the root inode/dentry */ +static int fill_super(struct super_block *sb, void *data, int silent) +{ + struct gfs_sbd *sdp; + struct gfs_holder mount_gh; + int error; - inode = gfs_iget(sdp->sd_rooti, CREATE); - if (!inode) { - printk("GFS: fsid=%s: can't get root inode\n", sdp->sd_fsname); - error = -ENOMEM; - goto fail_li_free; + sdp = init_sbd(sb); + if (!sdp) { + printk(KERN_WARNING "GFS: can't alloc struct gfs_sbd\n"); + return -ENOMEM; } - sb->s_root = d_alloc_root(inode); - if (!sb->s_root) { - iput(inode); - printk("GFS: fsid=%s: can't get root dentry\n", sdp->sd_fsname); - error = -ENOMEM; - goto fail_li_free; + error = gfs_make_args((char *)data, &sdp->sd_args, FALSE); + if (error) { + printk("GFS: can't parse mount arguments\n"); + goto fail; } - /* Start up the logd thread */ + if (sdp->sd_args.ar_spectator) { + sb->s_flags |= MS_RDONLY; + set_bit(SDF_ROFS, &sdp->sd_flags); + } - sdp->sd_jindex_refresh_time = jiffies; + /* Copy VFS mount flags */ - error = kernel_thread(gfs_logd, sdp, 0); - if (error < 0) { - printk("GFS: fsid=%s: can't start logd thread: %d\n", - sdp->sd_fsname, error); - goto fail_dput; - } - wait_for_completion(&sdp->sd_thread_completion); + if (sb->s_flags & (MS_NOATIME | MS_NODIRATIME)) + set_bit(SDF_NOATIME, &sdp->sd_flags); + if (sb->s_flags & MS_RDONLY) + set_bit(SDF_ROFS, &sdp->sd_flags); - /* Start up the quotad thread */ + init_vfs(sb, SDF_NOATIME); - error = kernel_thread(gfs_quotad, sdp, 0); - if (error < 0) { - printk("GFS: fsid=%s: can't start quotad thread: %d\n", - sdp->sd_fsname, error); - goto fail_logd; - } - wait_for_completion(&sdp->sd_thread_completion); + /* Set up the buffer cache and fill in some fake block size values + to allow us to read-in the on-disk superblock. */ - /* Start up the inoded thread */ + sdp->sd_sb.sb_bsize = sb_min_blocksize(sb, GFS_BASIC_BLOCK); + sdp->sd_sb.sb_bsize_shift = sb->s_blocksize_bits; + sdp->sd_fsb2bb_shift = sdp->sd_sb.sb_bsize_shift - GFS_BASIC_BLOCK_SHIFT; + sdp->sd_fsb2bb = 1 << sdp->sd_fsb2bb_shift; - error = kernel_thread(gfs_inoded, sdp, 0); - if (error < 0) { - printk("GFS: fsid=%s: can't start inoded thread: %d\n", - sdp->sd_fsname, error); - goto fail_quotad; + if (sizeof(struct gfs_sb) > sdp->sd_sb.sb_bsize) { + printk("GFS: sizeof(struct gfs_sb) > sdp->sd_sb.sb_bsize\n" + "GFS: %u > %u\n", + (unsigned int)sizeof(struct gfs_sb), sdp->sd_sb.sb_bsize); + error = -EINVAL; + goto fail; } - wait_for_completion(&sdp->sd_thread_completion); - - /* Get a handle on the rename lock */ + error = init_names(sdp, silent); + if (error) + goto fail; - error = gfs_glock_get(sdp, GFS_RENAME_LOCK, &gfs_nondisk_glops, - CREATE, &sdp->sd_rename_gl); + error = gfs_sys_fs_add(sdp); if (error) - goto fail_inoded; + goto fail; - gfs_proc_fs_add(sdp); + /* Mount an inter-node lock module, check for local optimizations */ - gfs_glock_dq_uninit(&mount_gh); + error = gfs_lm_mount(sdp, silent); + if (error) + goto fail_sys; - RETURN(GFN_FILL_SUPER, 0); + error = init_locking(sdp, &mount_gh, DO); + if (error) + goto fail_lm; - fail_inoded: - down(&sdp->sd_thread_lock); - clear_bit(SDF_INODED_RUN, &sdp->sd_flags); - wake_up_process(sdp->sd_inoded_process); - up(&sdp->sd_thread_lock); - wait_for_completion(&sdp->sd_thread_completion); - - fail_quotad: - down(&sdp->sd_thread_lock); - clear_bit(SDF_QUOTAD_RUN, &sdp->sd_flags); - wake_up_process(sdp->sd_quotad_process); - up(&sdp->sd_thread_lock); - wait_for_completion(&sdp->sd_thread_completion); - - fail_logd: - down(&sdp->sd_thread_lock); - clear_bit(SDF_LOGD_RUN, &sdp->sd_flags); - wake_up_process(sdp->sd_logd_process); - up(&sdp->sd_thread_lock); - wait_for_completion(&sdp->sd_thread_completion); - - fail_dput: - dput(sb->s_root); - - fail_li_free: - gfs_inode_put(sdp->sd_linode); - - fail_qi_free: - gfs_inode_put(sdp->sd_qinode); - - fail_root_free: - gfs_inode_put(sdp->sd_rooti); - - fail_ri_free: - gfs_inode_put(sdp->sd_riinode); - gfs_clear_rgrpd(sdp); - - fail_recoverd: - down(&sdp->sd_thread_lock); - clear_bit(SDF_RECOVERD_RUN, &sdp->sd_flags); - wake_up_process(sdp->sd_recoverd_process); - up(&sdp->sd_thread_lock); - wait_for_completion(&sdp->sd_thread_completion); - - fail_make_ro: - gfs_glock_force_drop(sdp->sd_trans_gl); - clear_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags); - gfs_unlinked_cleanup(sdp); - gfs_quota_cleanup(sdp); + error = init_sb(sdp, silent, DO); + if (error) + goto fail_locking; - fail_gunlock_journal: - if (!sdp->sd_args.ar_spectator) - gfs_glock_dq_uninit(&sdp->sd_journal_gh); + /* Read-in journal index inode (but not the file contents, yet) */ - fail_gunlock_ji: - if (jindex) - gfs_glock_dq_uninit(&ji_gh); + error = gfs_get_jiinode(sdp); + if (error) { + printk("GFS: fsid=%s: can't get journal index inode: %d\n", + sdp->sd_fsname, error); + goto fail_sb; + } - fail_trans_gl: - gfs_glock_put(sdp->sd_trans_gl); + init_journal(sdp, DO); + /* Get a handle on the rename lock */ - fail_ji_free: - gfs_inode_put(sdp->sd_jiinode); - gfs_clear_journals(sdp); - - fail_gunlock_sb: - if (super) - gfs_glock_dq_uninit(&sb_gh); + error = gfs_glock_get(sdp, GFS_RENAME_LOCK, &gfs_nondisk_glops, + CREATE, &sdp->sd_rename_gl); + if (error) + goto fail_journal; - fail_gunlock_live: - gfs_glock_dq_uninit(&sdp->sd_live_gh); + error = init_threads(sdp, DO); + if (error) + goto fail_journal; - fail_gunlock_mount: gfs_glock_dq_uninit(&mount_gh); - fail_glockd: - clear_bit(SDF_GLOCKD_RUN, &sdp->sd_flags); - wake_up(&sdp->sd_reclaim_wchan); - while (sdp->sd_glockd_num--) - wait_for_completion(&sdp->sd_thread_completion); + return 0; + +fail_journal: + init_journal(sdp, UNDO); - down(&sdp->sd_thread_lock); - clear_bit(SDF_SCAND_RUN, &sdp->sd_flags); - wake_up_process(sdp->sd_scand_process); - up(&sdp->sd_thread_lock); - wait_for_completion(&sdp->sd_thread_completion); +fail_sb: + init_sb(sdp, 0, UNDO); - fail_lockproto: - gfs_gl_hash_clear(sdp, TRUE); +fail_locking: + init_locking(sdp, &mount_gh, UNDO); + +fail_lm: gfs_lm_unmount(sdp); - gfs_clear_dirty_j(sdp); while (invalidate_inodes(sb)) yield(); - fail_sysfs: +fail_sys: gfs_sys_fs_del(sdp); - fail_vfree: +fail: vfree(sdp); + sb->s_fs_info = NULL; - fail: - set_v2sdp(sb, NULL); - RETURN(GFN_FILL_SUPER, error); + return error; } /** @@ -826,9 +707,7 @@ int gfs_test_bdev_super(struct super_block *sb, void *data) { - ENTER(GFN_TEST_BDEV_SUPER) - RETURN(GFN_TEST_BDEV_SUPER, - (void *)sb->s_bdev == data); + return (void *)sb->s_bdev == data; } /** @@ -841,10 +720,9 @@ int gfs_set_bdev_super(struct super_block *sb, void *data) { - ENTER(GFN_SET_BDEV_SUPER) sb->s_bdev = data; sb->s_dev = sb->s_bdev->bd_dev; - RETURN(GFN_SET_BDEV_SUPER, 0); + return 0; } /** @@ -859,59 +737,10 @@ * Returns: the new superblock */ -struct super_block * -gfs_get_sb(struct file_system_type *fs_type, int flags, - const char *dev_name, void *data) -{ - ENTER(GFN_GET_SB) - struct block_device *real, *diaper; - struct super_block *sb; - int error = 0; - - real = open_bdev_excl(dev_name, flags, fs_type); - if (IS_ERR(real)) - RETURN(GFN_GET_SB, (struct super_block *)real); - - diaper = gfs_diaper_get(real, flags); - if (IS_ERR(diaper)) { - close_bdev_excl(real); - RETURN(GFN_GET_SB, (struct super_block *)diaper); - } - - down(&diaper->bd_mount_sem); - sb = sget(fs_type, gfs_test_bdev_super, gfs_set_bdev_super, diaper); - up(&diaper->bd_mount_sem); - if (IS_ERR(sb)) - goto out; - - if (sb->s_root) { - if ((flags ^ sb->s_flags) & MS_RDONLY) { - up_write(&sb->s_umount); - deactivate_super(sb); - sb = ERR_PTR(-EBUSY); - } - goto out; - } else { - char buf[BDEVNAME_SIZE]; - - sb->s_flags = flags; - strlcpy(sb->s_id, bdevname(real, buf), sizeof(sb->s_id)); - sb_set_blocksize(sb, block_size(real)); - error = fill_super(sb, data, (flags & MS_VERBOSE) ? 1 : 0); - if (error) { - up_write(&sb->s_umount); - deactivate_super(sb); - sb = ERR_PTR(error); - } else - sb->s_flags |= MS_ACTIVE; - } - - RETURN(GFN_GET_SB, sb); - - out: - gfs_diaper_put(diaper); - close_bdev_excl(real); - RETURN(GFN_GET_SB, sb); +static int gfs_get_sb(struct file_system_type *fs_type, int flags, + const char *dev_name, void *data, struct vfsmount *mnt) +{ + return get_sb_bdev(fs_type, flags, dev_name, data, fill_super, mnt); } /** @@ -925,18 +754,7 @@ void gfs_kill_sb(struct super_block *sb) { - ENTER(GFN_KILL_SB) - struct block_device *diaper = sb->s_bdev; - struct block_device *real = gfs_diaper_2real(diaper); - unsigned long bsize = block_size(real); - - generic_shutdown_super(sb); - set_blocksize(diaper, bsize); - set_blocksize(real, bsize); - gfs_diaper_put(diaper); - close_bdev_excl(real); - - RET(GFN_KILL_SB); + kill_block_super(sb); } struct file_system_type gfs_fs_type = { --- cluster/gfs-kernel/src/gfs/ops_fstype.h 2005/09/27 22:47:06 1.4 +++ cluster/gfs-kernel/src/gfs/ops_fstype.h 2006/07/10 23:22:34 1.5 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -19,6 +19,7 @@ void gfs_sys_fs_del(struct gfs_sbd *sdp); int gfs_test_bdev_super(struct super_block *sb, void *data); int gfs_set_bdev_super(struct super_block *sb, void *data); +int init_names(struct gfs_sbd *sdp, int silent); extern struct file_system_type gfs_fs_type; --- cluster/gfs-kernel/src/gfs/ops_inode.c 2006/01/09 22:25:06 1.10 +++ cluster/gfs-kernel/src/gfs/ops_inode.c 2006/07/10 23:22:34 1.11 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -55,7 +55,6 @@ gfs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd) { - ENTER(GFN_CREATE) struct gfs_inode *dip = get_v2ip(dir), *ip; struct gfs_sbd *sdp = dip->i_sbd; struct gfs_holder d_gh, i_gh; @@ -78,7 +77,7 @@ else if (error != -EEXIST || (nd->intent.open.flags & O_EXCL)) { gfs_holder_uninit(&d_gh); - RETURN(GFN_CREATE, error); + return error; } error = gfs_lookupi(&d_gh, &dentry->d_name, @@ -90,7 +89,7 @@ } } else { gfs_holder_uninit(&d_gh); - RETURN(GFN_CREATE, error); + return error; } } @@ -112,13 +111,13 @@ gfs_inode_put(ip); if (!inode) - RETURN(GFN_CREATE, -ENOMEM); + return -ENOMEM; d_instantiate(dentry, inode); if (new) mark_inode_dirty(inode); - RETURN(GFN_CREATE, 0); + return 0; } /** @@ -133,13 +132,12 @@ static struct dentry * lookup_cdpn_sub_at(struct gfs_sbd *sdp, struct dentry *dentry) { - ENTER(GFN_LOOKUP_CDPN_SUB_AT) struct dentry *parent, *new = NULL; char *buf; buf = kmalloc(2 * __NEW_UTS_LEN + 2, GFP_KERNEL); if (!buf) - RETURN(GFN_LOOKUP_CDPN_SUB_AT, ERR_PTR(-ENOMEM)); + return ERR_PTR(-ENOMEM); parent = dget_parent(dentry); @@ -178,7 +176,7 @@ dput(parent); kfree(buf); - RETURN(GFN_LOOKUP_CDPN_SUB_AT, new); + return new; } /** @@ -193,13 +191,12 @@ static struct dentry * lookup_cdpn_sub_brace(struct gfs_sbd *sdp, struct dentry *dentry) { - ENTER(GFN_LOOKUP_CDPN_SUB_BRACE) struct dentry *parent, *new = NULL; char *buf; buf = kmalloc(2 * __NEW_UTS_LEN + 2, GFP_KERNEL); if (!buf) - RETURN(GFN_LOOKUP_CDPN_SUB_BRACE, ERR_PTR(-ENOMEM)); + return ERR_PTR(-ENOMEM); parent = dget_parent(dentry); @@ -238,7 +235,7 @@ dput(parent); kfree(buf); - RETURN(GFN_LOOKUP_CDPN_SUB_BRACE, new); + return new; } /** @@ -255,7 +252,6 @@ static struct dentry * gfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) { - ENTER(GFN_LOOKUP) struct gfs_inode *dip = get_v2ip(dir), *ip; struct gfs_holder d_gh, i_gh; struct inode *inode = NULL; @@ -269,12 +265,12 @@ struct dentry *new_dentry; new_dentry = lookup_cdpn_sub_at(dip->i_sbd, dentry); if (new_dentry) - RETURN(GFN_LOOKUP, new_dentry); + return new_dentry; } else if (*dentry->d_name.name == '{' && dentry->d_name.len > 2) { struct dentry *new_dentry; new_dentry = lookup_cdpn_sub_brace(dip->i_sbd, dentry); if (new_dentry) - RETURN(GFN_LOOKUP, new_dentry); + return new_dentry; } dentry->d_op = &gfs_dops; @@ -284,7 +280,7 @@ error = gfs_lookupi(&d_gh, &dentry->d_name, FALSE, &i_gh); if (error) { gfs_holder_uninit(&d_gh); - RETURN(GFN_LOOKUP, ERR_PTR(error)); + return ERR_PTR(error); } if (i_gh.gh_gl) { @@ -297,15 +293,15 @@ gfs_inode_put(ip); if (!inode) - RETURN(GFN_LOOKUP, ERR_PTR(-ENOMEM)); + return ERR_PTR(-ENOMEM); } else gfs_holder_uninit(&d_gh); if (inode) - RETURN(GFN_LOOKUP, d_splice_alias(inode, dentry)); + return d_splice_alias(inode, dentry); d_add(dentry, inode); - RETURN(GFN_LOOKUP, NULL); + return NULL; } /** @@ -323,7 +319,6 @@ static int gfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) { - ENTER(GFN_LINK) struct gfs_inode *dip = get_v2ip(dir); struct gfs_sbd *sdp = dip->i_sbd; struct inode *inode = old_dentry->d_inode; @@ -336,7 +331,7 @@ atomic_inc(&sdp->sd_ops_inode); if (ip->i_di.di_type == GFS_FILE_DIR) - RETURN(GFN_LINK, -EPERM); + return -EPERM; gfs_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, &ghs[0]); gfs_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &ghs[1]); @@ -447,7 +442,7 @@ d_instantiate(dentry, inode); mark_inode_dirty(inode); - RETURN(GFN_LINK, 0); + return 0; fail_end_trans: gfs_trans_end(sdp); @@ -471,7 +466,7 @@ gfs_holder_uninit(&ghs[0]); gfs_holder_uninit(&ghs[1]); - RETURN(GFN_LINK, error); + return error; } /** @@ -487,7 +482,6 @@ static int gfs_unlink(struct inode *dir, struct dentry *dentry) { - ENTER(GFN_UNLINK) struct gfs_inode *dip = get_v2ip(dir); struct gfs_sbd *sdp = dip->i_sbd; struct gfs_inode *ip = get_v2ip(dentry->d_inode); @@ -528,7 +522,7 @@ gfs_holder_uninit(&ghs[0]); gfs_holder_uninit(&ghs[1]); - RETURN(GFN_UNLINK, 0); + return 0; fail_end_trans: gfs_trans_end(sdp); @@ -540,7 +534,7 @@ gfs_holder_uninit(&ghs[0]); gfs_holder_uninit(&ghs[1]); - RETURN(GFN_UNLINK, error); + return error; } /** @@ -555,7 +549,6 @@ static int gfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) { - ENTER(GFN_SYMLINK) struct gfs_inode *dip = get_v2ip(dir), *ip; struct gfs_sbd *sdp = dip->i_sbd; struct gfs_holder d_gh, i_gh; @@ -571,7 +564,7 @@ /* Must be stuffed with a null terminator for gfs_follow_link() */ size = strlen(symname); if (size > sdp->sd_sb.sb_bsize - sizeof(struct gfs_dinode) - 1) - RETURN(GFN_SYMLINK, -ENAMETOOLONG); + return -ENAMETOOLONG; gfs_holder_init(dip->i_gl, 0, 0, &d_gh); @@ -580,7 +573,7 @@ &i_gh); if (error) { gfs_holder_uninit(&d_gh); - RETURN(GFN_SYMLINK, error); + return error; } ip = get_gl2ip(i_gh.gh_gl); @@ -609,12 +602,12 @@ gfs_inode_put(ip); if (!inode) - RETURN(GFN_SYMLINK, -ENOMEM); + return -ENOMEM; d_instantiate(dentry, inode); mark_inode_dirty(inode); - RETURN(GFN_SYMLINK, 0); + return 0; } /** @@ -629,7 +622,6 @@ static int gfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) { - ENTER(GFN_MKDIR) struct gfs_inode *dip = get_v2ip(dir), *ip; struct gfs_sbd *sdp = dip->i_sbd; struct gfs_holder d_gh, i_gh; @@ -648,7 +640,7 @@ &i_gh); if (error) { gfs_holder_uninit(&d_gh); - RETURN(GFN_MKDIR, error); + return error; } ip = get_gl2ip(i_gh.gh_gl); @@ -704,12 +696,12 @@ gfs_inode_put(ip); if (!inode) - RETURN(GFN_MKDIR, -ENOMEM); + return -ENOMEM; d_instantiate(dentry, inode); mark_inode_dirty(inode); - RETURN(GFN_MKDIR, 0); + return 0; } /** @@ -725,7 +717,6 @@ static int gfs_rmdir(struct inode *dir, struct dentry *dentry) { - ENTER(GFN_RMDIR) struct gfs_inode *dip = get_v2ip(dir); struct gfs_sbd *sdp = dip->i_sbd; struct gfs_inode *ip = get_v2ip(dentry->d_inode); @@ -778,7 +769,7 @@ gfs_holder_uninit(&ghs[0]); gfs_holder_uninit(&ghs[1]); - RETURN(GFN_RMDIR, 0); + return 0; fail_end_trans: gfs_trans_end(sdp); @@ -790,7 +781,7 @@ gfs_holder_uninit(&ghs[0]); gfs_holder_uninit(&ghs[1]); - RETURN(GFN_RMDIR, error); + return error; } /** @@ -805,7 +796,6 @@ static int gfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) { - ENTER(GFN_MKNOD) struct gfs_inode *dip = get_v2ip(dir), *ip; struct gfs_sbd *sdp = dip->i_sbd; struct gfs_holder d_gh, i_gh; @@ -839,7 +829,7 @@ default: printk("GFS: fsid=%s: mknod() with invalid type (%d)\n", sdp->sd_fsname, mode); - RETURN(GFN_MKNOD, -EINVAL); + return -EINVAL; }; gfs_holder_init(dip->i_gl, 0, 0, &d_gh); @@ -849,7 +839,7 @@ &i_gh); if (error) { gfs_holder_uninit(&d_gh); - RETURN(GFN_MKNOD, error); + return error; } ip = get_gl2ip(i_gh.gh_gl); @@ -878,12 +868,12 @@ gfs_inode_put(ip); if (!inode) - RETURN(GFN_MKNOD, -ENOMEM); + return -ENOMEM; d_instantiate(dentry, inode); mark_inode_dirty(inode); - RETURN(GFN_MKNOD, 0); + return 0; } /** @@ -900,7 +890,6 @@ gfs_rename(struct inode *odir, struct dentry *odentry, struct inode *ndir, struct dentry *ndentry) { - ENTER(GFN_RENAME) struct gfs_inode *odip = get_v2ip(odir); struct gfs_inode *ndip = get_v2ip(ndir); struct gfs_inode *ip = get_v2ip(odentry->d_inode); @@ -922,7 +911,7 @@ if (ndentry->d_inode) { nip = get_v2ip(ndentry->d_inode); if (ip == nip) - RETURN(GFN_RENAME, 0); + return 0; } /* Make sure we aren't trying to move a dirctory into it's subdir */ @@ -934,7 +923,7 @@ LM_ST_EXCLUSIVE, 0, &r_gh); if (error) - RETURN(GFN_RENAME, error); + return error; error = gfs_ok_to_move(ip, ndip); if (error) @@ -1119,7 +1108,7 @@ if (dir_rename) gfs_glock_dq_uninit(&r_gh); - RETURN(GFN_RENAME, 0); + return 0; fail_end_trans: gfs_trans_end(sdp); @@ -1147,7 +1136,7 @@ if (dir_rename) gfs_glock_dq_uninit(&r_gh); - RETURN(GFN_RENAME, error); + return error; } /** @@ -1162,7 +1151,6 @@ static int gfs_readlink(struct dentry *dentry, char *user_buf, int user_size) { - ENTER(GFN_READLINK) struct gfs_inode *ip = get_v2ip(dentry->d_inode); char array[GFS_FAST_NAME_SIZE], *buf = array; unsigned int len = GFS_FAST_NAME_SIZE; @@ -1172,7 +1160,7 @@ error = gfs_readlinki(ip, &buf, &len); if (error) - RETURN(GFN_READLINK, error); + return error; if (user_size > len - 1) user_size = len - 1; @@ -1185,7 +1173,7 @@ if (buf != array) kfree(buf); - RETURN(GFN_READLINK, error); + return error; } /** @@ -1202,7 +1190,6 @@ static void * gfs_follow_link(struct dentry *dentry, struct nameidata *nd) { - ENTER(GFN_FOLLOW_LINK) struct gfs_inode *ip = get_v2ip(dentry->d_inode); char array[GFS_FAST_NAME_SIZE], *buf = array; unsigned int len = GFS_FAST_NAME_SIZE; @@ -1217,7 +1204,7 @@ kfree(buf); } - RETURN(GFN_FOLLOW_LINK, ERR_PTR(error)); + return ERR_PTR(error); } /** @@ -1234,9 +1221,7 @@ static int gfs_permission_i(struct inode *inode, int mask, struct nameidata *nd) { - ENTER(GFN_PERMISSION_I) - RETURN(GFN_PERMISSION_I, - generic_permission(inode, mask, gfs_check_acl)); + return generic_permission(inode, mask, gfs_check_acl); } /** @@ -1251,7 +1236,6 @@ static int gfs_permission(struct inode *inode, int mask, struct nameidata *nd) { - ENTER(GFN_PERMISSION) struct gfs_inode *ip = get_v2ip(inode); struct gfs_holder i_gh; int error; @@ -1262,13 +1246,13 @@ LM_ST_SHARED, LM_FLAG_ANY, &i_gh); if (error) - RETURN(GFN_PERMISSION, error); + return error; error = gfs_permission_i(inode, mask, nd); gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_PERMISSION, error); + return error; } /** @@ -1285,7 +1269,6 @@ static int gfs_setattr(struct dentry *dentry, struct iattr *attr) { - ENTER(GFN_SETATTR) struct inode *inode = dentry->d_inode; struct gfs_inode *ip = get_v2ip(inode); struct gfs_sbd *sdp = ip->i_sbd; @@ -1296,7 +1279,7 @@ error = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh); if (error) - RETURN(GFN_SETATTR, error); + return error; if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) { error = -EPERM; @@ -1402,7 +1385,7 @@ mark_inode_dirty(inode); - RETURN(GFN_SETATTR, error); + return error; fail_end_trans: gfs_trans_end(sdp); @@ -1416,7 +1399,7 @@ fail: gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_SETATTR, error); + return error; } /** @@ -1431,7 +1414,6 @@ static int gfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) { - ENTER(GFN_GETATTR) struct inode *inode = dentry->d_inode; struct gfs_inode *ip = get_v2ip(inode); struct gfs_holder gh; @@ -1445,7 +1427,7 @@ gfs_glock_dq_uninit(&gh); } - RETURN(GFN_GETATTR, error); + return error; } /** @@ -1464,7 +1446,6 @@ const void *data, size_t size, int flags) { - ENTER(GFN_SETXATTR) struct gfs_ea_request er; atomic_inc(&get_v2sdp(dentry->d_inode->i_sb)->sd_ops_inode); @@ -1472,14 +1453,13 @@ memset(&er, 0, sizeof(struct gfs_ea_request)); er.er_type = gfs_ea_name2type(name, &er.er_name); if (er.er_type == GFS_EATYPE_UNUSED) - RETURN(GFN_SETXATTR, -EOPNOTSUPP); + return -EOPNOTSUPP; er.er_data = (char *)data; er.er_name_len = strlen(er.er_name); er.er_data_len = size; er.er_flags = flags; - RETURN(GFN_SETXATTR, - gfs_ea_set(get_v2ip(dentry->d_inode), &er)); + return gfs_ea_set(get_v2ip(dentry->d_inode), &er); } /** @@ -1496,7 +1476,6 @@ gfs_getxattr(struct dentry *dentry, const char *name, void *data, size_t size) { - ENTER(GFN_GETXATTR) struct gfs_ea_request er; atomic_inc(&get_v2sdp(dentry->d_inode->i_sb)->sd_ops_inode); @@ -1504,13 +1483,12 @@ memset(&er, 0, sizeof(struct gfs_ea_request)); er.er_type = gfs_ea_name2type(name, &er.er_name); if (er.er_type == GFS_EATYPE_UNUSED) - RETURN(GFN_GETXATTR, -EOPNOTSUPP); + return -EOPNOTSUPP; er.er_data = data; er.er_name_len = strlen(er.er_name); er.er_data_len = size; - RETURN(GFN_GETXATTR, - gfs_ea_get(get_v2ip(dentry->d_inode), &er)); + return gfs_ea_get(get_v2ip(dentry->d_inode), &er); } /** @@ -1525,7 +1503,6 @@ ssize_t gfs_listxattr(struct dentry *dentry, char *buffer, size_t size) { - ENTER(GFN_LISTXATTR) struct gfs_ea_request er; atomic_inc(&get_v2sdp(dentry->d_inode->i_sb)->sd_ops_inode); @@ -1534,8 +1511,7 @@ er.er_data = (size) ? buffer : NULL; er.er_data_len = size; - RETURN(GFN_LISTXATTR, - gfs_ea_list(get_v2ip(dentry->d_inode), &er)); + return gfs_ea_list(get_v2ip(dentry->d_inode), &er); } /** @@ -1549,7 +1525,6 @@ int gfs_removexattr(struct dentry *dentry, const char *name) { - ENTER(GFN_REMOVEXATTR) struct gfs_ea_request er; atomic_inc(&get_v2sdp(dentry->d_inode->i_sb)->sd_ops_inode); @@ -1557,11 +1532,10 @@ memset(&er, 0, sizeof(struct gfs_ea_request)); er.er_type = gfs_ea_name2type(name, &er.er_name); if (er.er_type == GFS_EATYPE_UNUSED) - RETURN(GFN_REMOVEXATTR, -EOPNOTSUPP); + return -EOPNOTSUPP; er.er_name_len = strlen(er.er_name); - RETURN(GFN_REMOVEXATTR, - gfs_ea_remove(get_v2ip(dentry->d_inode), &er)); + return gfs_ea_remove(get_v2ip(dentry->d_inode), &er); } struct inode_operations gfs_file_iops = { --- cluster/gfs-kernel/src/gfs/ops_inode.h 2004/06/24 08:53:28 1.1 +++ cluster/gfs-kernel/src/gfs/ops_inode.h 2006/07/10 23:22:34 1.2 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/ops_super.c 2006/02/15 19:35:42 1.20 +++ cluster/gfs-kernel/src/gfs/ops_super.c 2006/07/10 23:22:34 1.21 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -32,11 +32,12 @@ #include "ops_fstype.h" #include "ops_super.h" #include "page.h" -#include "proc.h" +#include "sys.h" #include "quota.h" #include "recovery.h" #include "rgrp.h" #include "super.h" +#include "mount.h" /** * gfs_write_inode - Make sure the inode is stable on the disk @@ -49,7 +50,6 @@ static int gfs_write_inode(struct inode *inode, int sync) { - ENTER(GFN_WRITE_INODE) struct gfs_inode *ip = get_v2ip(inode); atomic_inc(&ip->i_sbd->sd_ops_super); @@ -57,7 +57,7 @@ if (ip && sync) gfs_log_flush_glock(ip->i_gl); - RETURN(GFN_WRITE_INODE, 0); + return 0; } /** @@ -72,7 +72,6 @@ static void gfs_put_inode(struct inode *inode) { - ENTER(GFN_PUT_INODE) struct gfs_sbd *sdp = get_v2sdp(inode->i_sb); struct gfs_inode *ip = get_v2ip(inode); @@ -83,8 +82,6 @@ S_ISREG(inode->i_mode) && !sdp->sd_args.ar_localcaching) gfs_sync_page_i(inode, DIO_START | DIO_WAIT); - - RET(GFN_PUT_INODE); } /** @@ -96,17 +93,14 @@ static void gfs_put_super(struct super_block *sb) { - ENTER(GFN_PUT_SUPER) struct gfs_sbd *sdp = get_v2sdp(sb); int error; if (!sdp) - RET(GFN_PUT_SUPER); + return; atomic_inc(&sdp->sd_ops_super); - gfs_proc_fs_del(sdp); - /* Unfreeze the filesystem, if we need to */ down(&sdp->sd_freeze_lock); @@ -156,6 +150,10 @@ wait_for_completion(&sdp->sd_thread_completion); if (!test_bit(SDF_ROFS, &sdp->sd_flags)) { + gfs_log_flush(sdp); + gfs_quota_sync(sdp); + gfs_quota_sync(sdp); + error = gfs_make_fs_ro(sdp); if (error) gfs_io_error(sdp); @@ -169,8 +167,6 @@ gfs_inode_put(sdp->sd_jiinode); gfs_inode_put(sdp->sd_rooti); gfs_inode_put(sdp->sd_qinode); - gfs_inode_put(sdp->sd_linode); - gfs_glock_put(sdp->sd_trans_gl); gfs_glock_put(sdp->sd_rename_gl); @@ -202,8 +198,6 @@ vfree(sdp); set_v2sdp(sb, NULL); - - RET(GFN_PUT_SUPER); } /** @@ -217,11 +211,9 @@ static void gfs_write_super(struct super_block *sb) { - ENTER(GFN_WRITE_SUPER) struct gfs_sbd *sdp = get_v2sdp(sb); atomic_inc(&sdp->sd_ops_super); gfs_log_flush(sdp); - RET(GFN_WRITE_SUPER); } /** @@ -233,7 +225,6 @@ static void gfs_write_super_lockfs(struct super_block *sb) { - ENTER(GFN_WRITE_SUPER_LOCKFS) struct gfs_sbd *sdp = get_v2sdp(sb); int error; @@ -261,8 +252,6 @@ set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(HZ); } - - RET(GFN_WRITE_SUPER_LOCKFS); } /** @@ -274,13 +263,11 @@ static void gfs_unlockfs(struct super_block *sb) { - ENTER(GFN_UNLOCKFS) struct gfs_sbd *sdp = get_v2sdp(sb); atomic_inc(&sdp->sd_ops_super); - gfs_unfreeze_fs(sdp); - RET(GFN_UNLOCKFS); + gfs_unfreeze_fs(sdp); } /** @@ -291,10 +278,9 @@ * Returns: 0 on success or error code */ -static int -gfs_statfs(struct super_block *sb, struct kstatfs *buf) +static int gfs_statfs(struct dentry *dentry, struct kstatfs *buf) { - ENTER(GFN_STATFS) + struct super_block *sb = dentry->d_inode->i_sb; struct gfs_sbd *sdp = get_v2sdp(sb); struct gfs_stat_gfs sg; int error; @@ -303,7 +289,7 @@ error = gfs_stat_gfs(sdp, &sg, TRUE); if (error) - RETURN(GFN_STATFS, error); + return error; memset(buf, 0, sizeof(struct kstatfs)); @@ -317,7 +303,7 @@ buf->f_ffree = sg.sg_free_dinode + sg.sg_free_meta + sg.sg_free; buf->f_namelen = GFS_FNAMESIZE; - RETURN(GFN_STATFS, 0); + return 0; } /** @@ -332,12 +318,30 @@ static int gfs_remount_fs(struct super_block *sb, int *flags, char *data) { - ENTER(GFN_REMOUNT_FS) struct gfs_sbd *sdp = get_v2sdp(sb); int error = 0; + struct gfs_args *args; atomic_inc(&sdp->sd_ops_super); + args = kmalloc(sizeof(struct gfs_args), GFP_KERNEL); + if (!args) + return -ENOMEM; + + error = gfs_make_args(data, args, FALSE); + if (error) { + printk("GFS: can't parse remount arguments\n"); + goto out; + } + if (args->ar_posix_acls) { + sdp->sd_args.ar_posix_acls = TRUE; + sb->s_flags |= MS_POSIXACL; + } + else { + sdp->sd_args.ar_posix_acls = FALSE; + sb->s_flags &= ~MS_POSIXACL; + } + if (*flags & (MS_NOATIME | MS_NODIRATIME)) set_bit(SDF_NOATIME, &sdp->sd_flags); else @@ -358,7 +362,9 @@ /* Don't let the VFS update atimes. GFS handles this itself. */ *flags |= MS_NOATIME | MS_NODIRATIME; - RETURN(GFN_REMOUNT_FS, error); +out: + kfree(args); + return error; } /** @@ -374,7 +380,6 @@ static void gfs_clear_inode(struct inode *inode) { - ENTER(GFN_CLEAR_INODE) struct gfs_inode *ip = get_v2ip(inode); atomic_inc(&get_v2sdp(inode->i_sb)->sd_ops_super); @@ -388,8 +393,6 @@ gfs_glock_schedule_for_reclaim(ip->i_gl); gfs_inode_put(ip); } - - RET(GFN_CLEAR_INODE); } /** @@ -403,7 +406,6 @@ static int gfs_show_options(struct seq_file *s, struct vfsmount *mnt) { - ENTER(GFN_SHOW_OPTIONS) struct gfs_sbd *sdp = get_v2sdp(mnt->mnt_sb); struct gfs_args *args = &sdp->sd_args; @@ -442,7 +444,7 @@ if (args->ar_suiddir) seq_printf(s, ",suiddir"); - RETURN(GFN_SHOW_OPTIONS, 0); + return 0; } struct super_operations gfs_super_ops = { --- cluster/gfs-kernel/src/gfs/ops_super.h 2004/06/24 08:53:28 1.1 +++ cluster/gfs-kernel/src/gfs/ops_super.h 2006/07/10 23:22:34 1.2 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/ops_vm.c 2006/01/09 22:25:06 1.6 +++ cluster/gfs-kernel/src/gfs/ops_vm.c 2006/07/10 23:22:34 1.7 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -40,7 +40,6 @@ static void pfault_be_greedy(struct gfs_inode *ip) { - ENTER(GFN_PFAULT_BE_GREEDY) unsigned int time; spin_lock(&ip->i_spin); @@ -51,8 +50,6 @@ gfs_inode_hold(ip); if (gfs_glock_be_greedy(ip->i_gl, time)) gfs_inode_put(ip); - - RET(GFN_PFAULT_BE_GREEDY); } /** @@ -68,7 +65,6 @@ gfs_private_nopage(struct vm_area_struct *area, unsigned long address, int *type) { - ENTER(GFN_PRIVATE_NOPAGE) struct gfs_inode *ip = get_v2ip(area->vm_file->f_mapping->host); struct gfs_holder i_gh; struct page *result; @@ -78,7 +74,7 @@ error = gfs_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &i_gh); if (error) - RETURN(GFN_PRIVATE_NOPAGE, NULL); + return NULL; set_bit(GIF_PAGED, &ip->i_flags); @@ -89,7 +85,7 @@ gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_PRIVATE_NOPAGE, result); + return result; } /** @@ -103,7 +99,6 @@ static int alloc_page_backing(struct gfs_inode *ip, unsigned long index) { - ENTER(GFN_ALLOC_PAGE_BACKING) struct gfs_sbd *sdp = ip->i_sbd; uint64_t lblock = index << (PAGE_CACHE_SHIFT - sdp->sd_sb.sb_bsize_shift); unsigned int blocks = PAGE_CACHE_SIZE >> sdp->sd_sb.sb_bsize_shift; @@ -171,7 +166,7 @@ out: gfs_alloc_put(ip); - RETURN(GFN_ALLOC_PAGE_BACKING, error); + return error; } /** @@ -187,7 +182,6 @@ gfs_sharewrite_nopage(struct vm_area_struct *area, unsigned long address, int *type) { - ENTER(GFN_SHAREWRITE_NOPAGE) struct gfs_inode *ip = get_v2ip(area->vm_file->f_mapping->host); struct gfs_holder i_gh; struct page *result = NULL; @@ -199,7 +193,7 @@ error = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh); if (error) - RETURN(GFN_SHAREWRITE_NOPAGE, NULL); + return NULL; if (gfs_is_jdata(ip)) goto out; @@ -231,7 +225,7 @@ out: gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_SHAREWRITE_NOPAGE, result); + return result; } struct vm_operations_struct gfs_vm_ops_private = { --- cluster/gfs-kernel/src/gfs/ops_vm.h 2004/06/24 08:53:28 1.1 +++ cluster/gfs-kernel/src/gfs/ops_vm.h 2006/07/10 23:22:34 1.2 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/page.c 2006/01/09 22:25:06 1.8 +++ cluster/gfs-kernel/src/gfs/page.c 2006/07/10 23:22:34 1.9 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -35,17 +35,16 @@ void gfs_inval_pte(struct gfs_glock *gl) { - ENTER(GFN_INVAL_PTE) struct gfs_inode *ip; struct inode *inode; ip = get_gl2ip(gl); if (!ip || ip->i_di.di_type != GFS_FILE_REG) - RET(GFN_INVAL_PTE); + return; if (!test_bit(GIF_PAGED, &ip->i_flags)) - RET(GFN_INVAL_PTE); + return; inode = gfs_iget(ip, NO_CREATE); if (inode) { @@ -57,8 +56,6 @@ } clear_bit(GIF_SW_PAGED, &ip->i_flags); - - RET(GFN_INVAL_PTE); } /** @@ -70,14 +67,13 @@ void gfs_inval_page(struct gfs_glock *gl) { - ENTER(GFN_INVAL_PAGE) struct gfs_inode *ip; struct inode *inode; ip = get_gl2ip(gl); if (!ip || ip->i_di.di_type != GFS_FILE_REG) - RET(GFN_INVAL_PAGE); + return; inode = gfs_iget(ip, NO_CREATE); if (inode) { @@ -90,8 +86,6 @@ } clear_bit(GIF_PAGED, &ip->i_flags); - - RET(GFN_INVAL_PAGE); } /** @@ -104,7 +98,6 @@ void gfs_sync_page_i(struct inode *inode, int flags) { - ENTER(GFN_SYNC_PAGE_I) struct address_space *mapping = inode->i_mapping; int error = 0; @@ -116,8 +109,6 @@ /* Find a better way to report this to the user. */ if (error) gfs_io_error_inode(get_v2ip(inode)); - - RET(GFN_SYNC_PAGE_I); } /** @@ -132,22 +123,19 @@ void gfs_sync_page(struct gfs_glock *gl, int flags) { - ENTER(GFN_SYNC_PAGE) struct gfs_inode *ip; struct inode *inode; ip = get_gl2ip(gl); if (!ip || ip->i_di.di_type != GFS_FILE_REG) - RET(GFN_SYNC_PAGE); + return; inode = gfs_iget(ip, NO_CREATE); if (inode) { gfs_sync_page_i(inode, flags); iput(inode); } - - RET(GFN_SYNC_PAGE); } /** @@ -164,7 +152,6 @@ gfs_unstuffer_page(struct gfs_inode *ip, struct buffer_head *dibh, uint64_t block, void *private) { - ENTER(GFN_UNSTUFFER_PAGE) struct inode *inode = ip->i_vnode; struct page *page = (struct page *)private; struct buffer_head *bh; @@ -173,7 +160,7 @@ if (!page || page->index) { page = grab_cache_page(inode->i_mapping, 0); if (!page) - RETURN(GFN_UNSTUFFER_PAGE, -ENOMEM); + return -ENOMEM; release = TRUE; } @@ -212,7 +199,7 @@ page_cache_release(page); } - RETURN(GFN_UNSTUFFER_PAGE, 0); + return 0; } /** @@ -226,7 +213,6 @@ int gfs_truncator_page(struct gfs_inode *ip, uint64_t size) { - ENTER(GFN_TRUNCATOR_PAGE) struct inode *inode = ip->i_vnode; struct page *page; struct buffer_head *bh; @@ -243,7 +229,7 @@ lbn, ¬_new, &dbn, NULL); if (error || !dbn) - RETURN(GFN_TRUNCATOR_PAGE, error); + return error; index = size >> PAGE_CACHE_SHIFT; offset = size & (PAGE_CACHE_SIZE - 1); @@ -255,7 +241,7 @@ (filler_t *)inode->i_mapping->a_ops->readpage, NULL); if (IS_ERR(page)) - RETURN(GFN_TRUNCATOR_PAGE, PTR_ERR(page)); + return PTR_ERR(page); lock_page(page); @@ -289,5 +275,5 @@ unlock_page(page); page_cache_release(page); - RETURN(GFN_TRUNCATOR_PAGE, error); + return error; } --- cluster/gfs-kernel/src/gfs/page.h 2004/06/24 08:53:28 1.1 +++ cluster/gfs-kernel/src/gfs/page.h 2006/07/10 23:22:34 1.2 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/quota.c 2005/01/13 00:01:16 1.9 +++ cluster/gfs-kernel/src/gfs/quota.c 2006/07/10 23:22:34 1.10 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -46,7 +46,6 @@ gfs_quota_get(struct gfs_sbd *sdp, int user, uint32_t id, int create, struct gfs_quota_data **qdp) { - ENTER(GFN_QUOTA_GET) struct gfs_quota_data *qd = NULL, *new_qd = NULL; struct list_head *tmp, *head; int error; @@ -85,12 +84,12 @@ atomic_dec(&sdp->sd_quota_count); } *qdp = qd; - RETURN(GFN_QUOTA_GET, 0); + return 0; } new_qd = kmalloc(sizeof(struct gfs_quota_data), GFP_KERNEL); if (!new_qd) - RETURN(GFN_QUOTA_GET, -ENOMEM); + return -ENOMEM; memset(new_qd, 0, sizeof(struct gfs_quota_data)); new_qd->qd_count = 1; @@ -106,7 +105,7 @@ &new_qd->qd_gl); if (error) { kfree(new_qd); - RETURN(GFN_QUOTA_GET, error); + return error; } error = gfs_lvb_hold(new_qd->qd_gl); @@ -115,7 +114,7 @@ if (error) { kfree(new_qd); - RETURN(GFN_QUOTA_GET, error); + return error; } atomic_inc(&sdp->sd_quota_count); @@ -132,12 +131,10 @@ void gfs_quota_hold(struct gfs_sbd *sdp, struct gfs_quota_data *qd) { - ENTER(GFN_QUOTA_HOLD) spin_lock(&sdp->sd_quota_lock); gfs_assert(sdp, qd->qd_count,); qd->qd_count++; spin_unlock(&sdp->sd_quota_lock); - RET(GFN_QUOTA_HOLD); } /** @@ -152,12 +149,10 @@ void gfs_quota_put(struct gfs_sbd *sdp, struct gfs_quota_data *qd) { - ENTER(GFN_QUOTA_PUT) spin_lock(&sdp->sd_quota_lock); gfs_assert(sdp, qd->qd_count,); qd->qd_count--; spin_unlock(&sdp->sd_quota_lock); - RET(GFN_QUOTA_PUT); } /** @@ -173,12 +168,11 @@ static struct gfs_quota_data * quota_find(struct gfs_sbd *sdp) { - ENTER(GFN_QUOTA_FIND) struct list_head *tmp, *head; struct gfs_quota_data *qd = NULL; if (test_bit(SDF_ROFS, &sdp->sd_flags)) - RETURN(GFN_QUOTA_FIND, NULL); + return NULL; gfs_log_lock(sdp); spin_lock(&sdp->sd_quota_lock); @@ -213,7 +207,7 @@ spin_unlock(&sdp->sd_quota_lock); gfs_log_unlock(sdp); - RETURN(GFN_QUOTA_FIND, qd); + return qd; } /** @@ -227,11 +221,10 @@ static int quota_trylock(struct gfs_sbd *sdp, struct gfs_quota_data *qd) { - ENTER(GFN_QUOTA_TRYLOCK) int ret = FALSE; if (test_bit(SDF_ROFS, &sdp->sd_flags)) - RETURN(GFN_QUOTA_TRYLOCK, FALSE); + return FALSE; gfs_log_lock(sdp); spin_lock(&sdp->sd_quota_lock); @@ -253,7 +246,7 @@ spin_unlock(&sdp->sd_quota_lock); gfs_log_unlock(sdp); - RETURN(GFN_QUOTA_TRYLOCK, ret); + return ret; } /** @@ -266,7 +259,6 @@ static void quota_unlock(struct gfs_sbd *sdp, struct gfs_quota_data *qd) { - ENTER(GFN_QUOTA_UNLOCK) spin_lock(&sdp->sd_quota_lock); gfs_assert_warn(sdp, test_bit(QDF_LOCK, &qd->qd_flags)); @@ -276,8 +268,6 @@ qd->qd_count--; spin_unlock(&sdp->sd_quota_lock); - - RET(GFN_QUOTA_UNLOCK); } /** @@ -291,7 +281,6 @@ int gfs_quota_merge(struct gfs_sbd *sdp, struct gfs_quota_tag *tag) { - ENTER(GFN_QUOTA_MERGE) struct gfs_quota_data *qd; int error; @@ -299,7 +288,7 @@ tag->qt_flags & GFS_QTF_USER, tag->qt_id, CREATE, &qd); if (error) - RETURN(GFN_QUOTA_MERGE, error); + return error; gfs_assert(sdp, qd->qd_change_ic == qd->qd_change_od,); @@ -326,7 +315,7 @@ gfs_quota_put(sdp, qd); - RETURN(GFN_QUOTA_MERGE, 0); + return 0; } /** @@ -338,7 +327,6 @@ void gfs_quota_scan(struct gfs_sbd *sdp) { - ENTER(GFN_QUOTA_SCAN) struct list_head *head, *tmp, *next; struct gfs_quota_data *qd; LIST_HEAD(dead); @@ -369,8 +357,6 @@ kfree(qd); atomic_dec(&sdp->sd_quota_count); } - - RET(GFN_QUOTA_SCAN); } /** @@ -382,7 +368,6 @@ void gfs_quota_cleanup(struct gfs_sbd *sdp) { - ENTER(GFN_QUOTA_CLEANUP) struct gfs_quota_data *qd; restart: @@ -442,8 +427,6 @@ gfs_assert(sdp, !atomic_read(&sdp->sd_quota_od_count),); gfs_log_unlock(sdp); - - RET(GFN_QUOTA_CLEANUP); } /** @@ -457,7 +440,6 @@ static int sort_qd(const void *a, const void *b) { - ENTER(GFN_SORT_QD) struct gfs_quota_data *qd_a = *(struct gfs_quota_data **)a; struct gfs_quota_data *qd_b = *(struct gfs_quota_data **)b; int ret = 0; @@ -475,7 +457,7 @@ ret = 1; } - RETURN(GFN_SORT_QD, ret); + return ret; } /** @@ -491,7 +473,6 @@ do_quota_sync(struct gfs_sbd *sdp, struct gfs_quota_data **qda, unsigned int num_qd) { - ENTER(GFN_DO_QUOTA_SYNC) struct gfs_inode *ip = sdp->sd_qinode; struct gfs_alloc *al = NULL; struct gfs_holder i_gh, *ghs; @@ -509,7 +490,7 @@ ghs = kmalloc(num_qd * sizeof(struct gfs_holder), GFP_KERNEL); if (!ghs) - RETURN(GFN_DO_QUOTA_SYNC, -ENOMEM); + return -ENOMEM; gfs_sort(qda, num_qd, sizeof (struct gfs_quota_data *), sort_qd); for (qx = 0; qx < num_qd; qx++) { @@ -638,7 +619,7 @@ gfs_log_flush_glock(ip->i_gl); - RETURN(GFN_DO_QUOTA_SYNC, 0); + return 0; fail_end_trans: gfs_trans_end(sdp); @@ -664,7 +645,7 @@ kfree(ghs); - RETURN(GFN_DO_QUOTA_SYNC, error); + return error; } /** @@ -681,7 +662,6 @@ glock_q(struct gfs_sbd *sdp, struct gfs_quota_data *qd, int force_refresh, struct gfs_holder *q_gh) { - ENTER(GFN_GLOCK_Q) struct gfs_holder i_gh; struct gfs_quota q; char buf[sizeof(struct gfs_quota)]; @@ -690,7 +670,7 @@ restart: error = gfs_glock_nq_init(qd->qd_gl, LM_ST_SHARED, 0, q_gh); if (error) - RETURN(GFN_GLOCK_Q, error); + return error; gfs_quota_lvb_in(&qd->qd_qb, qd->qd_gl->gl_lvb); @@ -701,7 +681,7 @@ LM_ST_EXCLUSIVE, GL_NOCACHE, q_gh); if (error) - RETURN(GFN_GLOCK_Q, error); + return error; error = gfs_glock_nq_init(sdp->sd_qinode->i_gl, LM_ST_SHARED, 0, @@ -736,7 +716,7 @@ goto restart; } - RETURN(GFN_GLOCK_Q, 0); + return 0; fail_gunlock: gfs_glock_dq_uninit(&i_gh); @@ -744,7 +724,7 @@ fail: gfs_glock_dq_uninit(q_gh); - RETURN(GFN_GLOCK_Q, error); + return error; } /** @@ -762,7 +742,6 @@ int gfs_quota_hold_m(struct gfs_inode *ip, uint32_t uid, uint32_t gid) { - ENTER(GFN_QUOTA_HOLD_M) struct gfs_sbd *sdp = ip->i_sbd; struct gfs_alloc *al = ip->i_alloc; unsigned int x = 0; @@ -770,10 +749,10 @@ if (gfs_assert_warn(sdp, !al->al_qd_num && !test_bit(GIF_QD_LOCKED, &ip->i_flags))) - RETURN(GFN_QUOTA_HOLD_M, -EIO); + return -EIO; if (!gfs_tune_get(sdp, gt_quota_account)) - RETURN(GFN_QUOTA_HOLD_M, 0); + return 0; error = gfs_quota_get(sdp, TRUE, ip->i_di.di_uid, CREATE, &al->al_qd[x]); @@ -805,7 +784,7 @@ al->al_qd_num = x; - RETURN(GFN_QUOTA_HOLD_M, 0); + return 0; fail: if (x) { @@ -813,7 +792,7 @@ gfs_quota_unhold_m(ip); } - RETURN(GFN_QUOTA_HOLD_M, error); + return error; } /** @@ -825,7 +804,6 @@ void gfs_quota_unhold_m(struct gfs_inode *ip) { - ENTER(GFN_QUOTA_UNHOLD_M) struct gfs_sbd *sdp = ip->i_sbd; struct gfs_alloc *al = ip->i_alloc; unsigned int x; @@ -837,8 +815,6 @@ al->al_qd[x] = NULL; } al->al_qd_num = 0; - - RET(GFN_QUOTA_UNHOLD_M); } /** @@ -856,7 +832,6 @@ int gfs_quota_lock_m(struct gfs_inode *ip, uint32_t uid, uint32_t gid) { - ENTER(GFN_QUOTA_LOCK_M) struct gfs_sbd *sdp = ip->i_sbd; struct gfs_alloc *al = ip->i_alloc; unsigned int x; @@ -865,9 +840,9 @@ gfs_quota_hold_m(ip, uid, gid); if (!gfs_tune_get(sdp, gt_quota_enforce)) - RETURN(GFN_QUOTA_LOCK_M, 0); + return 0; if (capable(CAP_SYS_RESOURCE)) - RETURN(GFN_QUOTA_LOCK_M, 0); + return 0; gfs_sort(al->al_qd, al->al_qd_num, sizeof(struct gfs_quota_data *), sort_qd); @@ -880,13 +855,13 @@ set_bit(GIF_QD_LOCKED, &ip->i_flags); - RETURN(GFN_QUOTA_LOCK_M, 0); + return 0; fail: while (x--) gfs_glock_dq_uninit(&al->al_qd_ghs[x]); - RETURN(GFN_QUOTA_LOCK_M, error); + return error; } /** @@ -898,7 +873,6 @@ void gfs_quota_unlock_m(struct gfs_inode *ip) { - ENTER(GFN_QUOTA_UNLOCK_M) struct gfs_sbd *sdp = ip->i_sbd; struct gfs_alloc *al = ip->i_alloc; struct gfs_quota_data *qd, *qda[4]; @@ -957,8 +931,6 @@ out: gfs_quota_unhold_m(ip); - - RET(GFN_QUOTA_UNLOCK_M); } /** @@ -973,14 +945,13 @@ static int print_quota_message(struct gfs_sbd *sdp, struct gfs_quota_data *qd, char *type) { - ENTER(GFN_PRINT_QUOTA_MESSAGE) struct tty_struct *tty; char *line; int len; line = kmalloc(256, GFP_KERNEL); if (!line) - RETURN(GFN_PRINT_QUOTA_MESSAGE, -ENOMEM); + return -ENOMEM; len = snprintf(line, 256, "GFS: fsid=%s: quota %s for %s %u\r\n", sdp->sd_fsname, type, @@ -995,7 +966,7 @@ kfree(line); - RETURN(GFN_PRINT_QUOTA_MESSAGE, 0); + return 0; } /** @@ -1009,7 +980,6 @@ int gfs_quota_check(struct gfs_inode *ip, uint32_t uid, uint32_t gid) { - ENTER(GFN_QUOTA_CHECK) struct gfs_sbd *sdp = ip->i_sbd; struct gfs_alloc *al = ip->i_alloc; struct gfs_quota_data *qd; @@ -1018,7 +988,10 @@ int error = 0; if (!al) - RETURN(GFN_QUOTA_CHECK, 0); + return 0; + + if (!gfs_tune_get(sdp, gt_quota_enforce)) + return 0; for (x = 0; x < al->al_qd_num; x++) { qd = al->al_qd[x]; @@ -1046,7 +1019,7 @@ } } - RETURN(GFN_QUOTA_CHECK, error); + return error; } /** @@ -1059,7 +1032,6 @@ int gfs_quota_sync(struct gfs_sbd *sdp) { - ENTER(GFN_QUOTA_SYNC) struct gfs_quota_data **qda; unsigned int max_qd = gfs_tune_get(sdp, gt_quota_simul_sync); unsigned int num_qd; @@ -1070,7 +1042,7 @@ qda = kmalloc(max_qd * sizeof(struct gfs_quota_data *), GFP_KERNEL); if (!qda) - RETURN(GFN_QUOTA_SYNC, -ENOMEM); + return -ENOMEM; memset(qda, 0, max_qd * sizeof(struct gfs_quota_data *)); do { @@ -1100,7 +1072,7 @@ kfree(qda); - RETURN(GFN_QUOTA_SYNC, error); + return error; } /** @@ -1115,14 +1087,13 @@ int gfs_quota_refresh(struct gfs_sbd *sdp, int user, uint32_t id) { - ENTER(GFN_QUOTA_REFRESH) struct gfs_quota_data *qd; struct gfs_holder q_gh; int error; error = gfs_quota_get(sdp, user, id, CREATE, &qd); if (error) - RETURN(GFN_QUOTA_REFRESH, error); + return error; error = glock_q(sdp, qd, TRUE, &q_gh); if (!error) @@ -1130,7 +1101,7 @@ gfs_quota_put(sdp, qd); - RETURN(GFN_QUOTA_REFRESH, error); + return error; } /** @@ -1147,18 +1118,17 @@ gfs_quota_read(struct gfs_sbd *sdp, int user, uint32_t id, struct gfs_quota *q) { - ENTER(GFN_QUOTA_READ) struct gfs_quota_data *qd; struct gfs_holder q_gh; int error; if (((user) ? (id != current->fsuid) : (!in_group_p(id))) && !capable(CAP_SYS_ADMIN)) - RETURN(GFN_QUOTA_READ, -EACCES); + return -EACCES; error = gfs_quota_get(sdp, user, id, CREATE, &qd); if (error) - RETURN(GFN_QUOTA_READ, error); + return error; error = glock_q(sdp, qd, FALSE, &q_gh); if (error) @@ -1178,5 +1148,5 @@ out: gfs_quota_put(sdp, qd); - RETURN(GFN_QUOTA_READ, error); + return error; } --- cluster/gfs-kernel/src/gfs/quota.h 2005/01/04 10:07:12 1.2 +++ cluster/gfs-kernel/src/gfs/quota.h 2006/07/10 23:22:34 1.3 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/recovery.c 2006/02/15 19:22:58 1.8 +++ cluster/gfs-kernel/src/gfs/recovery.c 2006/07/10 23:22:34 1.9 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -46,7 +46,6 @@ void gfs_add_dirty_j(struct gfs_sbd *sdp, unsigned int jid) { - ENTER(GFN_ADD_DIRTY_J) struct dirty_j *dj; dj = gmalloc(sizeof(struct dirty_j)); @@ -57,8 +56,6 @@ spin_lock(&sdp->sd_dirty_j_lock); list_add(&dj->dj_list, &sdp->sd_dirty_j); spin_unlock(&sdp->sd_dirty_j_lock); - - RET(GFN_ADD_DIRTY_J); } /** @@ -71,7 +68,6 @@ static struct dirty_j * get_dirty_j(struct gfs_sbd *sdp) { - ENTER(GFN_GET_DIRTY_J) struct dirty_j *dj = NULL; spin_lock(&sdp->sd_dirty_j_lock); @@ -81,7 +77,7 @@ } spin_unlock(&sdp->sd_dirty_j_lock); - RETURN(GFN_GET_DIRTY_J, dj); + return dj; } /** @@ -93,17 +89,13 @@ void gfs_clear_dirty_j(struct gfs_sbd *sdp) { - ENTER(GFN_CLEAR_DIRTY_J) struct dirty_j *dj; - for (;;) { dj = get_dirty_j(sdp); if (!dj) break; kfree(dj); } - - RET(GFN_CLEAR_DIRTY_J); } /** @@ -124,14 +116,13 @@ get_log_header(struct gfs_sbd *sdp, struct gfs_jindex *jdesc, struct gfs_glock *gl, uint32_t seg, struct gfs_log_header *lh) { - ENTER(GFN_GET_LOG_HEADER) struct buffer_head *bh; struct gfs_log_header lh2; int error; error = gfs_dread(gl, seg2bn(seg), DIO_START | DIO_WAIT, &bh); if (error) - RETURN(GFN_GET_LOG_HEADER, error); + return error; gfs_log_header_in(lh, bh->b_data); gfs_log_header_in(&lh2, @@ -145,7 +136,7 @@ lh->lh_header.mh_type != GFS_METATYPE_LH) error = 1; - RETURN(GFN_GET_LOG_HEADER, error); + return error; } /** @@ -168,14 +159,13 @@ struct gfs_glock *gl, uint32_t *seg, struct gfs_log_header *lh, int forward) { - ENTER(GFN_FIND_GOOD_LH) int error; uint32_t orig_seg = *seg; for (;;) { error = get_log_header(sdp, jdesc, gl, *seg, lh); if (error <= 0) - RETURN(GFN_FIND_GOOD_LH, error); + return error; if (forward) { if (++*seg == jdesc->ji_nsegment) @@ -187,7 +177,7 @@ if (*seg == orig_seg) { gfs_consist(sdp); - RETURN(GFN_FIND_GOOD_LH, -EIO); + return -EIO; } } } @@ -209,7 +199,6 @@ verify_jhead(struct gfs_sbd *sdp, struct gfs_jindex *jdesc, struct gfs_glock *gl, struct gfs_log_header *head) { - ENTER(GFN_VERIFY_JHEAD) struct gfs_log_header lh; uint32_t seg; int error; @@ -222,7 +211,7 @@ error = get_log_header(sdp, jdesc, gl, seg, &lh); if (error < 0) - RETURN(GFN_VERIFY_JHEAD, error); + return error; if (error == 1) continue; @@ -235,7 +224,7 @@ memcpy(head, &lh, sizeof(struct gfs_log_header)); } - RETURN(GFN_VERIFY_JHEAD, 0); + return 0; } /** @@ -255,7 +244,6 @@ gfs_find_jhead(struct gfs_sbd *sdp, struct gfs_jindex *jdesc, struct gfs_glock *gl, struct gfs_log_header *head) { - ENTER(GFN_FIND_JHEAD) struct gfs_log_header lh1, lh_m; uint32_t seg1, seg2, seg_m; int error; @@ -289,7 +277,7 @@ seg2 = seg_m; } - RETURN(GFN_FIND_JHEAD, error); + return error; } /** @@ -310,7 +298,6 @@ gfs_increment_blkno(struct gfs_sbd *sdp, struct gfs_jindex *jdesc, struct gfs_glock *gl, uint64_t *addr, int skip_headers) { - ENTER(GFN_INCREMENT_BLKNO) struct gfs_log_header header; int error; @@ -330,27 +317,27 @@ if (skip_headers && !do_mod(*addr, sdp->sd_sb.sb_seg_size)) { error = get_log_header(sdp, jdesc, gl, bn2seg(*addr), &header); if (error < 0) - RETURN(GFN_INCREMENT_BLKNO, error); + return error; if (error) { /* Corrupt headers here are bad */ if (gfs_consist(sdp)) printk("GFS: fsid=%s: *addr = %"PRIu64"\n", sdp->sd_fsname, *addr); - RETURN(GFN_INCREMENT_BLKNO, -EIO); + return -EIO; } if (header.lh_first == *addr) { if (gfs_consist(sdp)) printk("GFS: fsid=%s: *addr = %"PRIu64"\n", sdp->sd_fsname, *addr); gfs_log_header_print(&header); - RETURN(GFN_INCREMENT_BLKNO, -EIO); + return -EIO; } (*addr)++; /* Can't wrap here */ } - RETURN(GFN_INCREMENT_BLKNO, 0); + return 0; } /** @@ -373,7 +360,6 @@ struct gfs_glock *gl, uint64_t start, uint64_t end, unsigned int pass) { - ENTER(GFN_FOREACH_DESCRIPTOR) struct gfs_log_header header; struct gfs_log_descriptor desc; struct buffer_head *bh; @@ -382,25 +368,25 @@ while (start != end) { if (do_mod(start, sdp->sd_sb.sb_seg_size)) { gfs_consist(sdp); - RETURN(GFN_FOREACH_DESCRIPTOR, -EIO); + return -EIO; } error = get_log_header(sdp, jdesc, gl, bn2seg(start), &header); if (error < 0) - RETURN(GFN_FOREACH_DESCRIPTOR, error); + return error; if (error) { /* Corrupt headers here are bad */ if (gfs_consist(sdp)) printk("GFS: fsid=%s: start = %"PRIu64"\n", sdp->sd_fsname, start); - RETURN(GFN_FOREACH_DESCRIPTOR, -EIO); + return -EIO; } if (header.lh_first != start) { if (gfs_consist(sdp)) printk("GFS: fsid=%s: start = %"PRIu64"\n", sdp->sd_fsname, start); gfs_log_header_print(&header); - RETURN(GFN_FOREACH_DESCRIPTOR, -EIO); + return -EIO; } start++; @@ -408,11 +394,11 @@ for (;;) { error = gfs_dread(gl, start, DIO_START | DIO_WAIT, &bh); if (error) - RETURN(GFN_FOREACH_DESCRIPTOR, error); + return error; if (gfs_metatype_check(sdp, bh, GFS_METATYPE_LD)) { brelse(bh); - RETURN(GFN_FOREACH_DESCRIPTOR, -EIO); + return -EIO; } gfs_desc_in(&desc, bh->b_data); @@ -422,13 +408,13 @@ error = LO_SCAN_ELEMENTS(sdp, jdesc, gl, start, &desc, pass); if (error) - RETURN(GFN_FOREACH_DESCRIPTOR, error); + return error; while (desc.ld_length--) { error = gfs_increment_blkno(sdp, jdesc, gl, &start, TRUE); if (error) - RETURN(GFN_FOREACH_DESCRIPTOR, error); + return error; } } else { while (desc.ld_length--) { @@ -436,7 +422,7 @@ &start, !!desc.ld_length); if (error) - RETURN(GFN_FOREACH_DESCRIPTOR, error); + return error; } break; @@ -444,7 +430,7 @@ } } - RETURN(GFN_FOREACH_DESCRIPTOR, error); + return error; } /** @@ -461,7 +447,6 @@ clean_journal(struct gfs_sbd *sdp, struct gfs_jindex *jdesc, struct gfs_glock *gl, struct gfs_log_header *head) { - ENTER(GFN_CLEAN_JOURNAL) struct gfs_log_header lh; struct gfs_log_descriptor desc; struct buffer_head *bh; @@ -477,7 +462,7 @@ error = get_log_header(sdp, jdesc, gl, seg, &lh); if (error < 0) - RETURN(GFN_CLEAN_JOURNAL, error); + return error; /* Rewrite corrupt header blocks */ @@ -494,7 +479,7 @@ error = gfs_dwrite(sdp, bh, DIO_DIRTY | DIO_START | DIO_WAIT); brelse(bh); if (error) - RETURN(GFN_CLEAN_JOURNAL, error); + return error; } /* Stop when we get to the end of the log. */ @@ -531,7 +516,7 @@ error = gfs_dwrite(sdp, bh, DIO_DIRTY | DIO_START | DIO_WAIT); brelse(bh); if (error) - RETURN(GFN_CLEAN_JOURNAL, error); + return error; /* Build a log header that says the journal is clean */ @@ -559,7 +544,7 @@ error = gfs_dwrite(sdp, bh, DIO_DIRTY | DIO_START | DIO_WAIT); brelse(bh); - RETURN(GFN_CLEAN_JOURNAL, error); + return error; } /** @@ -580,7 +565,6 @@ unsigned int jid, struct gfs_jindex *jdesc, int wait) { - ENTER(GFN_RECOVER_JOURNAL) struct gfs_log_header head; struct gfs_holder j_gh, t_gh; unsigned long t; @@ -683,7 +667,7 @@ printk("GFS: fsid=%s: jid=%u: Done\n", sdp->sd_fsname, jid); - RETURN(GFN_RECOVER_JOURNAL, 0); + return 0; fail_gunlock_tr: gfs_replay_wait(sdp); @@ -698,7 +682,7 @@ fail: gfs_lm_recovery_done(sdp, jid, LM_RD_GAVEUP); - RETURN(GFN_RECOVER_JOURNAL, error); + return error; } /** @@ -710,7 +694,6 @@ void gfs_check_journals(struct gfs_sbd *sdp) { - ENTER(GFN_CHECK_JOURNALS) struct dirty_j *dj; for (;;) { @@ -738,8 +721,6 @@ kfree(dj); } - - RET(GFN_CHECK_JOURNALS); } /** @@ -752,7 +733,6 @@ int gfs_recover_dump(struct gfs_sbd *sdp) { - ENTER(GFN_RECOVER_DUMP) struct gfs_log_header head; int error; @@ -763,10 +743,10 @@ if (!(head.lh_flags & GFS_LOG_HEAD_UNMOUNT)) { gfs_consist(sdp); - RETURN(GFN_RECOVER_DUMP, -EIO); + return -EIO; } if (!head.lh_last_dump) - RETURN(GFN_RECOVER_DUMP, error); + return error; printk("GFS: fsid=%s: Scanning for log elements...\n", sdp->sd_fsname); @@ -789,10 +769,10 @@ printk("GFS: fsid=%s: Done\n", sdp->sd_fsname); - RETURN(GFN_RECOVER_DUMP, 0); + return 0; fail: printk("GFS: fsid=%s: Failed\n", sdp->sd_fsname); - RETURN(GFN_RECOVER_DUMP, error); + return error; } --- cluster/gfs-kernel/src/gfs/recovery.h 2004/06/24 08:53:28 1.1 +++ cluster/gfs-kernel/src/gfs/recovery.h 2006/07/10 23:22:34 1.2 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/rgrp.c 2006/01/09 22:25:06 1.18 +++ cluster/gfs-kernel/src/gfs/rgrp.c 2006/07/10 23:22:34 1.19 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -39,14 +39,13 @@ static unsigned int mhc_hash(struct buffer_head *bh) { - ENTER(GFN_MCH_HASH) uint64_t blkno; unsigned int h; blkno = bh->b_blocknr; h = gfs_hash(&blkno, sizeof(uint64_t)) & GFS_MHC_HASH_MASK; - RETURN(GFN_MCH_HASH, h); + return h; } /** @@ -61,14 +60,13 @@ static void mhc_trim(struct gfs_sbd *sdp, unsigned int max) { - ENTER(GFN_MHC_TRIM) struct gfs_meta_header_cache *mc; for (;;) { spin_lock(&sdp->sd_mhc_lock); if (list_empty(&sdp->sd_mhc_single)) { spin_unlock(&sdp->sd_mhc_lock); - RET(GFN_MHC_TRIM); + return; } else { mc = list_entry(sdp->sd_mhc_single.prev, struct gfs_meta_header_cache, @@ -82,7 +80,7 @@ atomic_dec(&sdp->sd_mhc_count); if (atomic_read(&sdp->sd_mhc_count) <= max) - RET(GFN_MHC_TRIM); + return; } } } @@ -105,7 +103,6 @@ gfs_mhc_add(struct gfs_rgrpd *rgd, struct buffer_head **bh, unsigned int num) { - ENTER(GFN_MHC_ADD) struct gfs_sbd *sdp = rgd->rd_sbd; unsigned int x; @@ -115,11 +112,11 @@ uint64_t gen; if (gfs_meta_check(sdp, bh[x])) - RET(GFN_MHC_ADD); + return; mc = kmem_cache_alloc(gfs_mhc_cachep, GFP_KERNEL); if (!mc) - RET(GFN_MHC_ADD); + return; memset(mc, 0, sizeof(struct gfs_meta_header_cache)); mc->mc_block = bh[x]->b_blocknr; @@ -145,8 +142,6 @@ /* If we've got too many cached, throw some older ones away */ if (atomic_read(&sdp->sd_mhc_count) > x) mhc_trim(sdp, x); - - RET(GFN_MHC_ADD); } /** @@ -166,7 +161,6 @@ int gfs_mhc_fish(struct gfs_sbd *sdp, struct buffer_head *bh) { - ENTER(GFN_MHC_FISH) struct list_head *tmp, *head; struct gfs_meta_header_cache *mc; @@ -193,12 +187,12 @@ kmem_cache_free(gfs_mhc_cachep, mc); atomic_dec(&sdp->sd_mhc_count); - RETURN(GFN_MHC_FISH, TRUE); + return TRUE; } spin_unlock(&sdp->sd_mhc_lock); - RETURN(GFN_MHC_FISH, FALSE); + return FALSE; } /** @@ -212,7 +206,6 @@ void gfs_mhc_zap(struct gfs_rgrpd *rgd) { - ENTER(GFN_MHC_ZAP) struct gfs_sbd *sdp = rgd->rd_sbd; struct gfs_meta_header_cache *mc; @@ -235,8 +228,6 @@ } spin_unlock(&sdp->sd_mhc_lock); - - RET(GFN_MHC_ZAP); } /** @@ -249,13 +240,12 @@ static unsigned int depend_hash(uint64_t formal_ino) { - ENTER(GFN_DEPEND_HASH) unsigned int h; h = gfs_hash(&formal_ino, sizeof(uint64_t)); h &= GFS_DEPEND_HASH_MASK; - RETURN(GFN_DEPEND_HASH, h); + return h; } /** @@ -270,7 +260,6 @@ static void depend_sync_one(struct gfs_sbd *sdp, struct gfs_depend *gd) { - ENTER(GFN_DEPEND_SYNC_ONE) struct gfs_glock *gl; spin_lock(&sdp->sd_depend_lock); @@ -291,8 +280,6 @@ kfree(gd); atomic_dec(&sdp->sd_depend_count); - - RET(GFN_DEPEND_SYNC_ONE); } /** @@ -306,11 +293,10 @@ static void depend_sync_old(struct gfs_rgrpd *rgd) { - ENTER(GFN_DEPEND_SYNC_OLD) struct gfs_sbd *sdp = rgd->rd_sbd; struct gfs_depend *gd; - for (;;) { + while (!list_empty(&rgd->rd_depend)) { /* Oldest entries are in prev direction */ gd = list_entry(rgd->rd_depend.prev, struct gfs_depend, @@ -319,7 +305,7 @@ if (time_before(jiffies, gd->gd_time + gfs_tune_get(sdp, gt_depend_secs) * HZ)) - RET(GFN_DEPEND_SYNC_OLD); + return; depend_sync_one(sdp, gd); } @@ -342,7 +328,6 @@ void gfs_depend_add(struct gfs_rgrpd *rgd, uint64_t formal_ino) { - ENTER(GFN_DEPEND_ADD) struct gfs_sbd *sdp = rgd->rd_sbd; struct list_head *head, *tmp; struct gfs_depend *gd; @@ -361,7 +346,7 @@ spin_unlock(&sdp->sd_depend_lock); list_move(&gd->gd_list_rgd, &rgd->rd_depend); gd->gd_time = jiffies; - RET(GFN_DEPEND_ADD); + return; } } @@ -382,8 +367,6 @@ atomic_inc(&sdp->sd_depend_count); depend_sync_old(rgd); - - RET(GFN_DEPEND_ADD); } /** @@ -400,7 +383,6 @@ void gfs_depend_sync(struct gfs_rgrpd *rgd) { - ENTER(GFN_DEPEND_SYNC) struct gfs_sbd *sdp = rgd->rd_sbd; struct gfs_depend *gd; @@ -410,8 +392,6 @@ gd_list_rgd); depend_sync_one(sdp, gd); } - - RET(GFN_DEPEND_SYNC); } /** @@ -425,7 +405,6 @@ static void rgrp_verify(struct gfs_rgrpd *rgd) { - ENTER(GFN_RGRP_VERIFY) struct gfs_sbd *sdp = rgd->rd_sbd; struct gfs_bitmap *bits = NULL; uint32_t length = rgd->rd_ri.ri_length; @@ -448,7 +427,7 @@ if (gfs_consist_rgrpd(rgd)) printk("GFS: fsid=%s: free data mismatch: %u != %u\n", sdp->sd_fsname, count[0], rgd->rd_rg.rg_free); - RET(GFN_RGRP_VERIFY); + return; } tmp = rgd->rd_ri.ri_data - @@ -459,14 +438,14 @@ if (gfs_consist_rgrpd(rgd)) printk("GFS: fsid=%s: used data mismatch: %u != %u\n", sdp->sd_fsname, count[1], tmp); - RET(GFN_RGRP_VERIFY); + return; } if (count[2] != rgd->rd_rg.rg_freemeta) { if (gfs_consist_rgrpd(rgd)) printk("GFS: fsid=%s: free metadata mismatch: %u != %u\n", sdp->sd_fsname, count[2], rgd->rd_rg.rg_freemeta); - RET(GFN_RGRP_VERIFY); + return; } tmp = rgd->rd_rg.rg_usedmeta + @@ -475,10 +454,8 @@ if (gfs_consist_rgrpd(rgd)) printk("GFS: fsid=%s: used metadata mismatch: %u != %u\n", sdp->sd_fsname, count[3], tmp); - RET(GFN_RGRP_VERIFY); + return; } - - RET(GFN_RGRP_VERIFY); } /** @@ -495,7 +472,6 @@ struct gfs_rgrpd * gfs_blk2rgrpd(struct gfs_sbd *sdp, uint64_t blk) { - ENTER(GFN_BLK2RGPRD) struct list_head *tmp, *head; struct gfs_rgrpd *rgd = NULL; struct gfs_rindex *ri; @@ -511,13 +487,13 @@ if (ri->ri_data1 <= blk && blk < ri->ri_data1 + ri->ri_data) { list_move(&rgd->rd_list_mru, &sdp->sd_rg_mru_list); spin_unlock(&sdp->sd_rg_mru_lock); - RETURN(GFN_BLK2RGPRD, rgd); + return rgd; } } spin_unlock(&sdp->sd_rg_mru_lock); - RETURN(GFN_BLK2RGPRD, NULL); + return NULL; } /** @@ -530,10 +506,8 @@ struct gfs_rgrpd * gfs_rgrpd_get_first(struct gfs_sbd *sdp) { - ENTER(GFN_RGRPD_GET_FIRST) gfs_assert(sdp, !list_empty(&sdp->sd_rglist),); - RETURN(GFN_RGRPD_GET_FIRST, - list_entry(sdp->sd_rglist.next, struct gfs_rgrpd, rd_list)); + return list_entry(sdp->sd_rglist.next, struct gfs_rgrpd, rd_list); } /** @@ -546,11 +520,9 @@ struct gfs_rgrpd * gfs_rgrpd_get_next(struct gfs_rgrpd *rgd) { - ENTER(GFN_RGRPD_GET_NEXT) if (rgd->rd_list.next == &rgd->rd_sbd->sd_rglist) - RETURN(GFN_RGRPD_GET_NEXT, NULL); - RETURN(GFN_RGRPD_GET_NEXT, - list_entry(rgd->rd_list.next, struct gfs_rgrpd, rd_list)); + return NULL; + return list_entry(rgd->rd_list.next, struct gfs_rgrpd, rd_list); } /** @@ -562,7 +534,6 @@ void clear_rgrpdi(struct gfs_sbd *sdp) { - ENTER(GFN_CLEAR_RGRPDI) struct gfs_rgrpd *rgd; struct gfs_glock *gl; @@ -601,8 +572,6 @@ kfree(rgd); } - - RET(GFN_CLEAR_RGRPDI); } /** @@ -614,11 +583,9 @@ void gfs_clear_rgrpd(struct gfs_sbd *sdp) { - ENTER(GFN_CLEAR_RGRPD) down(&sdp->sd_rindex_lock); clear_rgrpdi(sdp); up(&sdp->sd_rindex_lock); - RET(GFN_CLEAR_RGRPD); } /** @@ -633,7 +600,6 @@ static int compute_bitstructs(struct gfs_rgrpd *rgd) { - ENTER(GFN_COMPUTE_BITSTRUCTS) struct gfs_sbd *sdp = rgd->rd_sbd; struct gfs_bitmap *bits; uint32_t length = rgd->rd_ri.ri_length; /* # blocks in hdr & bitmap */ @@ -642,7 +608,7 @@ rgd->rd_bits = kmalloc(length * sizeof(struct gfs_bitmap), GFP_KERNEL); if (!rgd->rd_bits) - RETURN(GFN_COMPUTE_BITSTRUCTS, -ENOMEM); + return -ENOMEM; memset(rgd->rd_bits, 0, length * sizeof(struct gfs_bitmap)); bytes_left = rgd->rd_ri.ri_bitbytes; @@ -681,7 +647,7 @@ if (bytes_left) { gfs_consist_rgrpd(rgd); - RETURN(GFN_COMPUTE_BITSTRUCTS, -EIO); + return -EIO; } if ((rgd->rd_bits[length - 1].bi_start + rgd->rd_bits[length - 1].bi_len) * GFS_NBBY != @@ -694,17 +660,17 @@ rgd->rd_bits[length - 1].bi_len, rgd->rd_bits[length - 1].bi_offset); } - RETURN(GFN_COMPUTE_BITSTRUCTS, -EIO); + return -EIO; } rgd->rd_bh = kmalloc(length * sizeof(struct buffer_head *), GFP_KERNEL); if (!rgd->rd_bh) { kfree(rgd->rd_bits); - RETURN(GFN_COMPUTE_BITSTRUCTS, -ENOMEM); + return -ENOMEM; } memset(rgd->rd_bh, 0, length * sizeof(struct buffer_head *)); - RETURN(GFN_COMPUTE_BITSTRUCTS, 0); + return 0; } /** @@ -717,7 +683,6 @@ static int gfs_ri_update(struct gfs_inode *ip) { - ENTER(GFN_RI_UPDATE) struct gfs_sbd *sdp = ip->i_sbd; struct gfs_rgrpd *rgd; char buf[sizeof(struct gfs_rindex)]; @@ -725,7 +690,7 @@ if (do_mod(ip->i_di.di_size, sizeof(struct gfs_rindex))) { gfs_consist_inode(ip); - RETURN(GFN_RI_UPDATE, -EIO); + return -EIO; } clear_rgrpdi(sdp); @@ -777,12 +742,12 @@ sdp->sd_riinode_vn = ip->i_gl->gl_vn; - RETURN(GFN_RI_UPDATE, 0); + return 0; fail: clear_rgrpdi(sdp); - RETURN(GFN_RI_UPDATE, error); + return error; } /** @@ -806,14 +771,13 @@ int gfs_rindex_hold(struct gfs_sbd *sdp, struct gfs_holder *ri_gh) { - ENTER(GFN_RINDEX_HOLD) struct gfs_inode *ip = sdp->sd_riinode; struct gfs_glock *gl = ip->i_gl; int error; error = gfs_glock_nq_init(gl, LM_ST_SHARED, 0, ri_gh); if (error) - RETURN(GFN_RINDEX_HOLD, error); + return error; /* Read new copy from disk if we don't have the latest */ if (sdp->sd_riinode_vn != gl->gl_vn) { @@ -826,7 +790,7 @@ up(&sdp->sd_rindex_lock); } - RETURN(GFN_RINDEX_HOLD, error); + return error; } /** @@ -842,7 +806,6 @@ int gfs_rgrp_read(struct gfs_rgrpd *rgd) { - ENTER(GFN_RGRP_READ) struct gfs_sbd *sdp = rgd->rd_sbd; struct gfs_glock *gl = rgd->rd_gl; unsigned int x, length = rgd->rd_ri.ri_length; @@ -875,7 +838,7 @@ rgd->rd_rg_vn = gl->gl_vn; } - RETURN(GFN_RGRP_READ, 0); + return 0; fail: for (x = 0; x < length; x++) { @@ -883,7 +846,7 @@ rgd->rd_bh[x] = NULL; } - RETURN(GFN_RGRP_READ, error); + return error; } /** @@ -895,15 +858,12 @@ void gfs_rgrp_relse(struct gfs_rgrpd *rgd) { - ENTER(GFN_RGRP_RELSE) int x, length = rgd->rd_ri.ri_length; for (x = 0; x < length; x++) { brelse(rgd->rd_bh[x]); rgd->rd_bh[x] = NULL; } - - RET(GFN_RGRP_RELSE); } /** @@ -915,7 +875,6 @@ void gfs_rgrp_lvb_fill(struct gfs_rgrpd *rgd) { - ENTER(GFN_RGRP_LVB_FILL) struct gfs_rgrp *rg = &rgd->rd_rg; struct gfs_rgrp_lvb *rb = (struct gfs_rgrp_lvb *)rgd->rd_gl->gl_lvb; @@ -925,8 +884,6 @@ rb->rb_freedi = cpu_to_gfs32(rg->rg_freedi); rb->rb_usedmeta = cpu_to_gfs32(rg->rg_usedmeta); rb->rb_freemeta = cpu_to_gfs32(rg->rg_freemeta); - - RET(GFN_RGRP_LVB_FILL); } /** @@ -939,7 +896,6 @@ int gfs_rgrp_lvb_init(struct gfs_rgrpd *rgd) { - ENTER(GFN_RGRP_LVB_INIT) struct gfs_glock *gl = rgd->rd_gl; struct gfs_holder rgd_gh; int error; @@ -950,7 +906,7 @@ gfs_glock_dq_uninit(&rgd_gh); } - RETURN(GFN_RGRP_LVB_INIT, error); + return error; } /** @@ -968,7 +924,6 @@ struct gfs_alloc * gfs_alloc_get(struct gfs_inode *ip) { - ENTER(GFN_ALLOC_GET) struct gfs_alloc *al = ip->i_alloc; gfs_assert_warn(ip->i_sbd, !al); @@ -978,7 +933,7 @@ ip->i_alloc = al; - RETURN(GFN_ALLOC_GET, al); + return al; } /** @@ -990,16 +945,13 @@ void gfs_alloc_put(struct gfs_inode *ip) { - ENTER(GFN_ALLOC_PUT) struct gfs_alloc *al = ip->i_alloc; if (gfs_assert_warn(ip->i_sbd, al)) - RET(GFN_ALLOC_PUT); + return; ip->i_alloc = NULL; kfree(al); - - RET(GFN_ALLOC_PUT); } /** @@ -1018,7 +970,6 @@ static int try_rgrp_fit(struct gfs_rgrpd *rgd, struct gfs_alloc *al) { - ENTER(GFN_TRY_RGRP_FIT) uint32_t freeblks = rgd->rd_rg.rg_free; uint32_t freemeta = rgd->rd_rg.rg_freemeta; uint32_t metares = al->al_requested_meta; @@ -1027,7 +978,7 @@ /* First take care of the data blocks required */ if (freeblks < al->al_requested_data) - RETURN(GFN_TRY_RGRP_FIT, 0); + return 0; freeblks -= al->al_requested_data; @@ -1039,7 +990,7 @@ while (freemeta < metares) { if (freeblks < GFS_META_CLUMP) - RETURN(GFN_TRY_RGRP_FIT, 0); + return 0; freeblks -= GFS_META_CLUMP; freemeta += GFS_META_CLUMP; @@ -1051,7 +1002,7 @@ al->al_reserved_meta = metares; al->al_reserved_data = datares; - RETURN(GFN_TRY_RGRP_FIT, 1); + return 1; } /** @@ -1065,7 +1016,6 @@ static struct gfs_rgrpd * recent_rgrp_first(struct gfs_sbd *sdp, uint64_t rglast) { - ENTER(GFN_RECENT_RGRP_FIRST) struct list_head *tmp, *head; struct gfs_rgrpd *rgd = NULL; @@ -1091,7 +1041,7 @@ out: spin_unlock(&sdp->sd_rg_recent_lock); - RETURN(GFN_RECENT_RGRP_FIRST, rgd); + return rgd; } /** @@ -1105,7 +1055,6 @@ static struct gfs_rgrpd * recent_rgrp_next(struct gfs_rgrpd *cur_rgd, int remove) { - ENTER(GFN_RECENT_RGRP_NEXT) struct gfs_sbd *sdp = cur_rgd->rd_sbd; struct list_head *tmp, *head; struct gfs_rgrpd *rgd; @@ -1137,7 +1086,7 @@ out: spin_unlock(&sdp->sd_rg_recent_lock); - RETURN(GFN_RECENT_RGRP_NEXT, rgd); + return rgd; } /** @@ -1154,7 +1103,6 @@ static void recent_rgrp_add(struct gfs_rgrpd *new_rgd) { - ENTER(GFN_RECENT_RGRP_ADD) struct gfs_sbd *sdp = new_rgd->rd_sbd; struct list_head *tmp, *head; struct gfs_rgrpd *rgd = NULL; @@ -1178,8 +1126,6 @@ out: spin_unlock(&sdp->sd_rg_recent_lock); - - RET(GFN_RECENT_RGRP_ADD); } /** @@ -1192,7 +1138,6 @@ static struct gfs_rgrpd * forward_rgrp_get(struct gfs_sbd *sdp) { - ENTER(GFN_FORWARD_RGRP_GET) struct gfs_rgrpd *rgd; unsigned int journals = gfs_num_journals(sdp); unsigned int rg = 0, x; @@ -1216,7 +1161,7 @@ spin_unlock(&sdp->sd_rg_forward_lock); - RETURN(GFN_FORWARD_RGRP_GET, rgd); + return rgd; } /** @@ -1229,11 +1174,9 @@ static void forward_rgrp_set(struct gfs_sbd *sdp, struct gfs_rgrpd *rgd) { - ENTER(GFN_FORWARD_RGRP_SET) spin_lock(&sdp->sd_rg_forward_lock); sdp->sd_rg_forward = rgd; spin_unlock(&sdp->sd_rg_forward_lock); - RET(GFN_FORWARD_RGRP_SET); } /** @@ -1249,7 +1192,6 @@ static int get_local_rgrp(struct gfs_inode *ip) { - ENTER(GFN_GET_LOCAL_RGRP) struct gfs_sbd *sdp = ip->i_sbd; struct gfs_rgrpd *rgd, *begin = NULL; struct gfs_alloc *al = ip->i_alloc; @@ -1286,7 +1228,7 @@ break; default: - RETURN(GFN_GET_LOCAL_RGRP, error); + return error; } } @@ -1310,7 +1252,7 @@ break; default: - RETURN(GFN_GET_LOCAL_RGRP, error); + return error; } rgd = gfs_rgrpd_get_next(rgd); @@ -1319,7 +1261,7 @@ if (rgd == begin) { if (++loops >= 2 || !skipped) - RETURN(GFN_GET_LOCAL_RGRP, -ENOSPC); + return -ENOSPC; flags = 0; } } @@ -1335,7 +1277,7 @@ forward_rgrp_set(sdp, rgd); } - RETURN(GFN_GET_LOCAL_RGRP, 0); + return 0; } /** @@ -1355,7 +1297,6 @@ gfs_inplace_reserve_i(struct gfs_inode *ip, char *file, unsigned int line) { - ENTER(GFN_INPLACE_RESERVE_I) struct gfs_sbd *sdp = ip->i_sbd; struct gfs_alloc *al = ip->i_alloc; int error; @@ -1364,16 +1305,16 @@ al->al_requested_di || al->al_requested_data || al->al_requested_meta)) - RETURN(GFN_INPLACE_RESERVE_I, -EINVAL); + return -EINVAL; error = gfs_rindex_hold(sdp, &al->al_ri_gh); if (error) - RETURN(GFN_INPLACE_RESERVE_I, error); + return error; error = get_local_rgrp(ip); if (error) { gfs_glock_dq_uninit(&al->al_ri_gh); - RETURN(GFN_INPLACE_RESERVE_I, error); + return error; } gfs_depend_sync(al->al_rgd); @@ -1381,7 +1322,7 @@ al->al_file = file; al->al_line = line; - RETURN(GFN_INPLACE_RESERVE_I, 0); + return 0; } /** @@ -1394,7 +1335,6 @@ void gfs_inplace_release(struct gfs_inode *ip) { - ENTER(GFN_INPLACE_RELEASE) struct gfs_sbd *sdp = ip->i_sbd; struct gfs_alloc *al = ip->i_alloc; @@ -1417,8 +1357,6 @@ al->al_rgd = NULL; gfs_glock_dq_uninit(&al->al_rgd_gh); gfs_glock_dq_uninit(&al->al_ri_gh); - - RET(GFN_INPLACE_RELEASE); } /** @@ -1432,7 +1370,6 @@ unsigned char gfs_get_block_type(struct gfs_rgrpd *rgd, uint64_t block) { - ENTER(GFN_GET_BLOCK_TYPE) struct gfs_bitmap *bits = NULL; uint32_t length, rgrp_block, buf_block; unsigned int buf; @@ -1454,7 +1391,7 @@ rgd->rd_bh[buf]->b_data + bits->bi_offset, bits->bi_len, buf_block); - RETURN(GFN_GET_BLOCK_TYPE, type); + return type; } /** @@ -1483,7 +1420,6 @@ uint32_t goal, unsigned char old_state, unsigned char new_state) { - ENTER(GFN_BLKALLOC_INTERNAL) struct gfs_bitmap *bits = NULL; uint32_t length = rgd->rd_ri.ri_length; uint32_t blk = 0; @@ -1529,7 +1465,7 @@ bits->bi_len, blk, new_state); /* Return allocated block #, rgrp scope (32-bit) */ - RETURN(GFN_BLKALLOC_INTERNAL, bits->bi_start * GFS_NBBY + blk); + return bits->bi_start * GFS_NBBY + blk; } /** @@ -1555,7 +1491,6 @@ blkfree_internal(struct gfs_sbd *sdp, uint64_t bstart, uint32_t blen, unsigned char new_state) { - ENTER(GFN_BLKFREE_INTERNAL) struct gfs_rgrpd *rgd; struct gfs_bitmap *bits = NULL; uint32_t length, rgrp_blk, buf_blk; @@ -1567,7 +1502,7 @@ if (gfs_consist(sdp)) printk("GFS: fsid=%s: block = %"PRIu64"\n", sdp->sd_fsname, bstart); - RETURN(GFN_BLKFREE_INTERNAL, NULL); + return NULL; } length = rgd->rd_ri.ri_length; @@ -1595,7 +1530,7 @@ bits->bi_len, buf_blk, new_state); } - RETURN(GFN_BLKFREE_INTERNAL, rgd); + return rgd; } /** @@ -1613,7 +1548,6 @@ static int clump_alloc(struct gfs_rgrpd *rgd, uint32_t *first) { - ENTER(GFN_CLUMP_ALLOC) struct gfs_sbd *sdp = rgd->rd_sbd; struct gfs_meta_header mh; struct buffer_head **bh; @@ -1680,7 +1614,7 @@ } kfree(bh); - RETURN(GFN_CLUMP_ALLOC, error); + return error; } /** @@ -1693,7 +1627,6 @@ void gfs_blkalloc(struct gfs_inode *ip, uint64_t *block) { - ENTER(GFN_BLKALLOC) struct gfs_sbd *sdp = ip->i_sbd; struct gfs_alloc *al = ip->i_alloc; struct gfs_rgrpd *rgd = al->al_rgd; @@ -1724,8 +1657,6 @@ al->al_alloced_data++; gfs_trans_add_quota(sdp, +1, ip->i_di.di_uid, ip->i_di.di_gid); - - RET(GFN_BLKALLOC); } /** @@ -1739,7 +1670,6 @@ int gfs_metaalloc(struct gfs_inode *ip, uint64_t *block) { - ENTER(GFN_METAALLOC) struct gfs_sbd *sdp = ip->i_sbd; struct gfs_alloc *al = ip->i_alloc; struct gfs_rgrpd *rgd = al->al_rgd; @@ -1752,7 +1682,7 @@ if (!rgd->rd_rg.rg_freemeta) { error = clump_alloc(rgd, &goal); if (error) - RETURN(GFN_METAALLOC, error); + return error; al->al_alloced_data += GFS_META_CLUMP; } else @@ -1781,7 +1711,7 @@ gfs_trans_add_quota(sdp, +1, ip->i_di.di_uid, ip->i_di.di_gid); - RETURN(GFN_METAALLOC, 0); + return 0; } /** @@ -1796,7 +1726,6 @@ int gfs_dialloc(struct gfs_inode *dip, uint64_t *block) { - ENTER(GFN_DIALLOC) struct gfs_alloc *al = dip->i_alloc; struct gfs_rgrpd *rgd = al->al_rgd; uint32_t goal, blk; @@ -1809,7 +1738,7 @@ /* no free meta blocks, allocate a bunch more */ error = clump_alloc(rgd, &goal); if (error) - RETURN(GFN_DIALLOC, error); + return error; al->al_alloced_data += GFS_META_CLUMP; } @@ -1836,7 +1765,7 @@ al->al_alloced_di++; al->al_alloced_meta++; - RETURN(GFN_DIALLOC, error); + return error; } /** @@ -1853,13 +1782,12 @@ void gfs_blkfree(struct gfs_inode *ip, uint64_t bstart, uint32_t blen) { - ENTER(GFN_BLKFREE) struct gfs_sbd *sdp = ip->i_sbd; struct gfs_rgrpd *rgd; rgd = blkfree_internal(sdp, bstart, blen, GFS_BLKST_FREE); if (!rgd) - RET(GFN_BLKFREE); + return; rgd->rd_rg.rg_free += blen; @@ -1869,8 +1797,6 @@ gfs_trans_add_quota(sdp, -(int64_t)blen, ip->i_di.di_uid, ip->i_di.di_gid); - - RET(GFN_BLKFREE); } /** @@ -1890,13 +1816,12 @@ void gfs_metafree(struct gfs_inode *ip, uint64_t bstart, uint32_t blen) { - ENTER(GFN_METAFREE) struct gfs_sbd *sdp = ip->i_sbd; struct gfs_rgrpd *rgd; rgd = blkfree_internal(sdp, bstart, blen, GFS_BLKST_FREEMETA); if (!rgd) - RET(GFN_METAFREE); + return; if (rgd->rd_rg.rg_usedmeta < blen) gfs_consist_rgrpd(rgd); @@ -1910,8 +1835,6 @@ ip->i_di.di_uid, ip->i_di.di_gid); gfs_wipe_buffers(ip, rgd, bstart, blen); - - RET(GFN_METAFREE); } /** @@ -1927,13 +1850,12 @@ void gfs_difree_uninit(struct gfs_rgrpd *rgd, uint64_t addr) { - ENTER(GFN_DIFREE_UNINIT) struct gfs_rgrpd *tmp_rgd; tmp_rgd = blkfree_internal(rgd->rd_sbd, addr, 1, GFS_BLKST_FREEMETA); if (!tmp_rgd) - RET(GFN_DIFREE_UNINIT); + return; gfs_assert_withdraw(rgd->rd_sbd, rgd == tmp_rgd); if (!rgd->rd_rg.rg_useddi) @@ -1943,8 +1865,6 @@ gfs_trans_add_bh(rgd->rd_gl, rgd->rd_bh[0]); gfs_rgrp_out(&rgd->rd_rg, rgd->rd_bh[0]->b_data); - - RET(GFN_DIFREE_UNINIT); } /** @@ -1962,11 +1882,9 @@ void gfs_difree(struct gfs_rgrpd *rgd, struct gfs_inode *ip) { - ENTER(GFN_DIFREE) gfs_difree_uninit(rgd, ip->i_num.no_addr); gfs_trans_add_quota(ip->i_sbd, -1, ip->i_di.di_uid, ip->i_di.di_gid); gfs_wipe_buffers(ip, rgd, ip->i_num.no_addr, 1); - RET(GFN_DIFREE); } /** @@ -1984,26 +1902,25 @@ void gfs_rlist_add(struct gfs_sbd *sdp, struct gfs_rgrp_list *rlist, uint64_t block) { - ENTER(GFN_RLIST_ADD) struct gfs_rgrpd *rgd; struct gfs_rgrpd **tmp; unsigned int new_space; unsigned int x; if (gfs_assert_warn(sdp, !rlist->rl_ghs)) - RET(GFN_RLIST_ADD); + return; rgd = gfs_blk2rgrpd(sdp, block); if (!rgd) { if (gfs_consist(sdp)) printk("GFS: fsid=%s: block = %"PRIu64"\n", sdp->sd_fsname, block); - RET(GFN_RLIST_ADD); + return; } for (x = 0; x < rlist->rl_rgrps; x++) if (rlist->rl_rgd[x] == rgd) - RET(GFN_RLIST_ADD); + return; if (rlist->rl_rgrps == rlist->rl_space) { new_space = rlist->rl_space + 10; @@ -2021,8 +1938,6 @@ } rlist->rl_rgd[rlist->rl_rgrps++] = rgd; - - RET(GFN_RLIST_ADD); } /** @@ -2039,7 +1954,6 @@ void gfs_rlist_alloc(struct gfs_rgrp_list *rlist, unsigned int state, int flags) { - ENTER(GFN_RLIST_ALLOC) unsigned int x; rlist->rl_ghs = gmalloc(rlist->rl_rgrps * sizeof(struct gfs_holder)); @@ -2047,8 +1961,6 @@ gfs_holder_init(rlist->rl_rgd[x]->rd_gl, state, flags, &rlist->rl_ghs[x]); - - RET(GFN_RLIST_ALLOC); } /** @@ -2060,7 +1972,6 @@ void gfs_rlist_free(struct gfs_rgrp_list *rlist) { - ENTER(GFN_RLIST_FREE) unsigned int x; if (rlist->rl_rgd) @@ -2071,8 +1982,6 @@ gfs_holder_uninit(&rlist->rl_ghs[x]); kfree(rlist->rl_ghs); } - - RET(GFN_RLIST_FREE); } /** @@ -2092,7 +2001,6 @@ uint64_t *inodes, uint64_t *metadata) { - ENTER(GFN_RECLAIM_METADATA) struct gfs_holder ji_gh, ri_gh, rgd_gh, t_gh; struct gfs_rgrpd *rgd; struct gfs_rgrp *rg; @@ -2111,7 +2019,7 @@ error = gfs_jindex_hold(sdp, &ji_gh); if (error) - RETURN(GFN_RECLAIM_METADATA, error); + goto fail; error = gfs_rindex_hold(sdp, &ri_gh); if (error) @@ -2211,7 +2119,7 @@ gfs_glock_dq_uninit(&ji_gh); - RETURN(GFN_RECLAIM_METADATA, 0); + return 0; fail_end_trans: gfs_trans_end(sdp); @@ -2228,5 +2136,6 @@ fail_jindex_relse: gfs_glock_dq_uninit(&ji_gh); - RETURN(GFN_RECLAIM_METADATA, error); + fail: + return error; } --- cluster/gfs-kernel/src/gfs/rgrp.h 2005/01/04 10:07:12 1.3 +++ cluster/gfs-kernel/src/gfs/rgrp.h 2006/07/10 23:22:34 1.4 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/super.c 2006/02/15 19:35:42 1.17 +++ cluster/gfs-kernel/src/gfs/super.c 2006/07/10 23:22:34 1.18 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -42,8 +42,6 @@ void gfs_tune_init(struct gfs_tune *gt) { - ENTER(GFN_TUNE_INIT) - spin_lock_init(>->gt_spin); gt->gt_ilimit1 = 100; @@ -85,8 +83,6 @@ gt->gt_greedy_quantum = HZ / 40; gt->gt_greedy_max = HZ / 4; gt->gt_rgrp_try_threshold = 100; - - RET(GFN_TUNE_INIT); } /** @@ -103,21 +99,20 @@ int gfs_check_sb(struct gfs_sbd *sdp, struct gfs_sb *sb, int silent) { - ENTER(GFN_CHECK_SB) unsigned int x; if (sb->sb_header.mh_magic != GFS_MAGIC || sb->sb_header.mh_type != GFS_METATYPE_SB) { if (!silent) printk("GFS: not a GFS filesystem\n"); - RETURN(GFN_CHECK_SB, -EINVAL); + return -EINVAL; } /* If format numbers match exactly, we're done. */ if (sb->sb_fs_format == GFS_FORMAT_FS && sb->sb_multihost_format == GFS_FORMAT_MULTI) - RETURN(GFN_CHECK_SB, 0); + return 0; if (sb->sb_fs_format != GFS_FORMAT_FS) { for (x = 0; gfs_old_fs_formats[x]; x++) @@ -129,7 +124,7 @@ GFS_FORMAT_FS, GFS_FORMAT_MULTI, sb->sb_fs_format, sb->sb_multihost_format); printk("GFS: I don't know how to upgrade this FS\n"); - RETURN(GFN_CHECK_SB, -EINVAL); + return -EINVAL; } } @@ -143,7 +138,7 @@ GFS_FORMAT_FS, GFS_FORMAT_MULTI, sb->sb_fs_format, sb->sb_multihost_format); printk("GFS: I don't know how to upgrade this FS\n"); - RETURN(GFN_CHECK_SB, -EINVAL); + return -EINVAL; } } @@ -153,10 +148,10 @@ sb->sb_fs_format, sb->sb_multihost_format); printk("GFS: Use the \"upgrade\" mount option to upgrade the FS\n"); printk("GFS: See the manual for more details\n"); - RETURN(GFN_CHECK_SB, -EINVAL); + return -EINVAL; } - RETURN(GFN_CHECK_SB, 0); + return 0; } /** @@ -170,7 +165,6 @@ int gfs_read_sb(struct gfs_sbd *sdp, struct gfs_glock *gl, int silent) { - ENTER(GFN_READ_SB) struct buffer_head *bh; uint32_t hash_blocks, ind_blocks, leaf_blocks; uint32_t tmp_blocks; @@ -183,7 +177,7 @@ if (!silent) printk("GFS: fsid=%s: can't read superblock\n", sdp->sd_fsname); - RETURN(GFN_READ_SB, error); + return error; } gfs_assert(sdp, sizeof(struct gfs_sb) <= bh->b_size,); @@ -192,7 +186,7 @@ error = gfs_check_sb(sdp, &sdp->sd_sb, silent); if (error) - RETURN(GFN_READ_SB, error); + return error; sdp->sd_fsb2bb_shift = sdp->sd_sb.sb_bsize_shift - GFS_BASIC_BLOCK_SHIFT; @@ -255,7 +249,7 @@ sdp->sd_max_jheight = x; gfs_assert(sdp, sdp->sd_max_jheight <= GFS_MAX_META_HEIGHT,); - RETURN(GFN_READ_SB, 0); + return 0; } /** @@ -267,7 +261,6 @@ int gfs_do_upgrade(struct gfs_sbd *sdp, struct gfs_glock *sb_gl) { - ENTER(GFN_DO_UPGRADE) struct gfs_holder ji_gh, t_gh, j_gh; struct gfs_log_header lh; struct buffer_head *bh; @@ -281,7 +274,7 @@ printk("GFS: fsid=%s: no upgrade necessary\n", sdp->sd_fsname); sdp->sd_args.ar_upgrade = FALSE; - RETURN(GFN_DO_UPGRADE, 0); + return 0; } error = gfs_jindex_hold(sdp, &ji_gh); @@ -373,7 +366,7 @@ sdp->sd_args.ar_upgrade = FALSE; } - RETURN(GFN_DO_UPGRADE, error); + return error; fail_gunlock_tr: gfs_glock_dq_uninit(&t_gh); @@ -389,7 +382,7 @@ printk("GFS: fsid=%s: can't upgrade: %d\n", sdp->sd_fsname, error); - RETURN(GFN_DO_UPGRADE, error); + return error; } /** @@ -401,15 +394,11 @@ static void clear_journalsi(struct gfs_sbd *sdp) { - ENTER(GFN_CLEAR_JOURNALSI) - if (sdp->sd_jindex) { kfree(sdp->sd_jindex); sdp->sd_jindex = NULL; } sdp->sd_journals = 0; - - RET(GFN_CLEAR_JOURNALSI); } /** @@ -421,11 +410,9 @@ void gfs_clear_journals(struct gfs_sbd *sdp) { - ENTER(GFN_CLEAR_JOURNALS) down(&sdp->sd_jindex_lock); clear_journalsi(sdp); up(&sdp->sd_jindex_lock); - RET(GFN_CLEAR_JOURNALS); } /** @@ -438,7 +425,6 @@ static int gfs_ji_update(struct gfs_inode *ip) { - ENTER(GFN_JI_UPDATE) struct gfs_sbd *sdp = ip->i_sbd; char buf[sizeof(struct gfs_jindex)]; unsigned int j; @@ -446,14 +432,14 @@ if (do_mod(ip->i_di.di_size, sizeof(struct gfs_jindex))) { gfs_consist_inode(ip); - RETURN(GFN_JI_UPDATE, -EIO); + return -EIO; } clear_journalsi(sdp); sdp->sd_jindex = kmalloc(ip->i_di.di_size, GFP_KERNEL); if (!sdp->sd_jindex) - RETURN(GFN_JI_UPDATE, -ENOMEM); + return -ENOMEM; memset(sdp->sd_jindex, 0, ip->i_di.di_size); for (j = 0;; j++) { @@ -474,11 +460,11 @@ sdp->sd_journals = j; sdp->sd_jiinode_vn = ip->i_gl->gl_vn; - RETURN(GFN_JI_UPDATE, 0); + return 0; fail: clear_journalsi(sdp); - RETURN(GFN_JI_UPDATE, error); + return error; } /** @@ -501,14 +487,13 @@ int gfs_jindex_hold(struct gfs_sbd *sdp, struct gfs_holder *ji_gh) { - ENTER(GFN_JINDEX_HOLD) struct gfs_inode *ip = sdp->sd_jiinode; struct gfs_glock *gl = ip->i_gl; int error; error = gfs_glock_nq_init(gl, LM_ST_SHARED, 0, ji_gh); if (error) - RETURN(GFN_JINDEX_HOLD, error); + return error; /* Read new copy from disk if we don't have the latest */ if (sdp->sd_jiinode_vn != gl->gl_vn) { @@ -521,7 +506,7 @@ if (error) gfs_glock_dq_uninit(ji_gh); - RETURN(GFN_JINDEX_HOLD, error); + return error; } /** @@ -537,7 +522,6 @@ int gfs_get_jiinode(struct gfs_sbd *sdp) { - ENTER(GFN_GET_JIINODE) struct gfs_holder ji_gh; int error; @@ -547,7 +531,7 @@ LM_ST_SHARED, GL_LOCAL_EXCL, &ji_gh); if (error) - RETURN(GFN_GET_JIINODE, error); + return error; error = gfs_inode_get(ji_gh.gh_gl, &sdp->sd_sb.sb_jindex_di, CREATE, &sdp->sd_jiinode); @@ -558,7 +542,7 @@ gfs_glock_dq_uninit(&ji_gh); - RETURN(GFN_GET_JIINODE, error); + return error; } /** @@ -574,7 +558,6 @@ int gfs_get_riinode(struct gfs_sbd *sdp) { - ENTER(GFN_GET_RIINODE) struct gfs_holder ri_gh; int error; @@ -584,7 +567,7 @@ LM_ST_SHARED, GL_LOCAL_EXCL, &ri_gh); if (error) - RETURN(GFN_GET_RIINODE, error); + return error; error = gfs_inode_get(ri_gh.gh_gl, &sdp->sd_sb.sb_rindex_di, CREATE, &sdp->sd_riinode); @@ -595,7 +578,7 @@ gfs_glock_dq_uninit(&ri_gh); - RETURN(GFN_GET_RIINODE, error); + return error; } /** @@ -608,7 +591,6 @@ int gfs_get_rootinode(struct gfs_sbd *sdp) { - ENTER(GFN_GET_ROOTINODE) struct gfs_holder i_gh; int error; @@ -618,14 +600,14 @@ LM_ST_SHARED, GL_LOCAL_EXCL, &i_gh); if (error) - RETURN(GFN_GET_ROOTINODE, error); + return error; error = gfs_inode_get(i_gh.gh_gl, &sdp->sd_sb.sb_root_di, CREATE, &sdp->sd_rooti); gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_GET_ROOTINODE, error); + return error; } /** @@ -641,7 +623,6 @@ int gfs_get_qinode(struct gfs_sbd *sdp) { - ENTER(GFN_GET_QINODE) struct gfs_holder i_gh; int error; @@ -649,7 +630,7 @@ if (!sdp->sd_sb.sb_quota_di.no_formal_ino) { error = gfs_alloc_qinode(sdp); if (error) - RETURN(GFN_GET_QINODE, error); + return error; } error = gfs_glock_nq_num(sdp, @@ -658,14 +639,14 @@ LM_ST_SHARED, GL_LOCAL_EXCL, &i_gh); if (error) - RETURN(GFN_GET_QINODE, error); + return error; error = gfs_inode_get(i_gh.gh_gl, &sdp->sd_sb.sb_quota_di, CREATE, &sdp->sd_qinode); gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_GET_QINODE, error); + return error; } /** @@ -681,7 +662,6 @@ int gfs_get_linode(struct gfs_sbd *sdp) { - ENTER(GFN_GET_LINODE) struct gfs_holder i_gh; int error; @@ -689,7 +669,7 @@ if (!sdp->sd_sb.sb_license_di.no_formal_ino) { error = gfs_alloc_linode(sdp); if (error) - RETURN(GFN_GET_LINODE, error); + return error; } error = gfs_glock_nq_num(sdp, @@ -698,14 +678,14 @@ LM_ST_SHARED, GL_LOCAL_EXCL, &i_gh); if (error) - RETURN(GFN_GET_LINODE, error); + return error; error = gfs_inode_get(i_gh.gh_gl, &sdp->sd_sb.sb_license_di, CREATE, &sdp->sd_linode); gfs_glock_dq_uninit(&i_gh); - RETURN(GFN_GET_LINODE, error); + return error; } /** @@ -718,7 +698,6 @@ int gfs_make_fs_rw(struct gfs_sbd *sdp) { - ENTER(GFN_MAKE_FS_RW) struct gfs_glock *j_gl = sdp->sd_journal_gh.gh_gl; struct gfs_holder t_gh; struct gfs_log_header head; @@ -729,7 +708,7 @@ GL_LOCAL_EXCL | GL_EXACT, &t_gh); if (error) - RETURN(GFN_MAKE_FS_RW, error); + return error; j_gl->gl_ops->go_inval(j_gl, DIO_METADATA | DIO_DATA); @@ -759,13 +738,13 @@ gfs_glock_dq_uninit(&t_gh); - RETURN(GFN_MAKE_FS_RW, 0); + return 0; fail: t_gh.gh_flags |= GL_NOCACHE; gfs_glock_dq_uninit(&t_gh); - RETURN(GFN_MAKE_FS_RW, error); + return error; } /** @@ -778,7 +757,6 @@ int gfs_make_fs_ro(struct gfs_sbd *sdp) { - ENTER(GFN_MAKE_FS_RO) struct gfs_holder t_gh; int error; @@ -788,11 +766,11 @@ &t_gh); if (error && !test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) - RETURN(GFN_MAKE_FS_RO, error); + return error; + gfs_log_flush(sdp); gfs_quota_sync(sdp); gfs_quota_scan(sdp); - gfs_log_flush(sdp); gfs_sync_meta(sdp); gfs_log_dump(sdp, TRUE); @@ -807,7 +785,7 @@ gfs_unlinked_cleanup(sdp); gfs_quota_cleanup(sdp); - RETURN(GFN_MAKE_FS_RO, error); + return error; } /** @@ -821,11 +799,10 @@ static int stat_gfs_fill(struct gfs_rgrpd *rgd, struct gfs_stat_gfs *sg) { - ENTER(GFN_STAT_GFS_FILL) struct gfs_rgrp_lvb *rb = (struct gfs_rgrp_lvb *)rgd->rd_gl->gl_lvb; if (gfs32_to_cpu(rb->rb_magic) != GFS_MAGIC) - RETURN(GFN_STAT_GFS_FILL, -ESTALE); + return -ESTALE; sg->sg_total_blocks += rgd->rd_ri.ri_data; sg->sg_free += gfs32_to_cpu(rb->rb_free); @@ -834,7 +811,7 @@ sg->sg_used_meta += gfs32_to_cpu(rb->rb_usedmeta); sg->sg_free_meta += gfs32_to_cpu(rb->rb_freemeta); - RETURN(GFN_STAT_GFS_FILL, 0); + return 0; } /** @@ -854,7 +831,6 @@ static int stat_gfs_async(struct gfs_sbd *sdp, struct gfs_stat_gfs *sg, int interruptible) { - ENTER(GFN_STAT_GFS_ASYNC) struct gfs_rgrpd *rgd_next = gfs_rgrpd_get_first(sdp); struct gfs_holder *gha, *gh; unsigned int slots = gfs_tune_get(sdp, gt_statfs_slots); @@ -866,7 +842,7 @@ gha = kmalloc(slots * sizeof(struct gfs_holder), GFP_KERNEL); if (!gha) - RETURN(GFN_STAT_GFS_ASYNC, -ENOMEM); + return -ENOMEM; memset(gha, 0, slots * sizeof(struct gfs_holder)); for (;;) { @@ -910,7 +886,7 @@ kfree(gha); - RETURN(GFN_STAT_GFS_ASYNC, error); + return error; } /** @@ -925,26 +901,27 @@ static int stat_gfs_sync(struct gfs_sbd *sdp, struct gfs_stat_gfs *sg, int interruptible) { - ENTER(GFN_STAT_GFS_SYNC) struct gfs_holder rgd_gh; struct gfs_rgrpd *rgd; - int error; + int error,i=1; memset(sg, 0, sizeof(struct gfs_stat_gfs)); for (rgd = gfs_rgrpd_get_first(sdp); rgd; rgd = gfs_rgrpd_get_next(rgd)) { + printk("Bob says: stat_gfs_sync i=%d addr=",i++); + printk("%llu\n",rgd->rd_ri.ri_addr); for (;;) { error = gfs_glock_nq_init(rgd->rd_gl, LM_ST_SHARED, GL_LOCAL_EXCL | GL_SKIP, &rgd_gh); if (error) - RETURN(GFN_STAT_GFS_SYNC, error); + return error; error = stat_gfs_fill(rgd, sg); - + gfs_glock_dq_uninit(&rgd_gh); if (!error) @@ -952,14 +929,14 @@ error = gfs_rgrp_lvb_init(rgd); if (error) - RETURN(GFN_STAT_GFS_SYNC, error); + return error; } if (interruptible && signal_pending(current)) - RETURN(GFN_STAT_GFS_SYNC, -ERESTARTSYS); + return -ERESTARTSYS; } - RETURN(GFN_STAT_GFS_SYNC, 0); + return 0; } /** @@ -974,13 +951,12 @@ int gfs_stat_gfs(struct gfs_sbd *sdp, struct gfs_stat_gfs *sg, int interruptible) { - ENTER(GFN_STAT_GFS) struct gfs_holder ri_gh; int error; error = gfs_rindex_hold(sdp, &ri_gh); if (error) - RETURN(GFN_STAT_GFS, error); + return error; error = stat_gfs_async(sdp, sg, interruptible); if (error == -ESTALE) @@ -988,7 +964,7 @@ gfs_glock_dq_uninit(&ri_gh); - RETURN(GFN_STAT_GFS, error); + return error; } /** @@ -1004,7 +980,6 @@ gfs_lock_fs_check_clean(struct gfs_sbd *sdp, unsigned int state, struct gfs_holder *t_gh) { - ENTER(GFN_LOCK_FS_CHECK_CLEAN) struct gfs_holder ji_gh, cl_gh; struct gfs_log_header lh; unsigned int x; @@ -1012,7 +987,7 @@ error = gfs_jindex_hold(sdp, &ji_gh); if (error) - RETURN(GFN_LOCK_FS_CHECK_CLEAN, error); + return error; error = gfs_glock_nq_num(sdp, GFS_CRAP_LOCK, &gfs_meta_glops, @@ -1042,7 +1017,7 @@ gfs_glock_dq_uninit(&cl_gh); gfs_glock_dq_uninit(&ji_gh); - RETURN(GFN_LOCK_FS_CHECK_CLEAN, 0); + return 0; fail_gunlock_trans: gfs_glock_dq_uninit(t_gh); @@ -1053,7 +1028,7 @@ fail: gfs_glock_dq_uninit(&ji_gh); - RETURN(GFN_LOCK_FS_CHECK_CLEAN, error); + return error; } /** @@ -1070,7 +1045,6 @@ int gfs_freeze_fs(struct gfs_sbd *sdp) { - ENTER(GFN_FREEZE_FS) int error = 0; down(&sdp->sd_freeze_lock); @@ -1086,7 +1060,7 @@ up(&sdp->sd_freeze_lock); - RETURN(GFN_FREEZE_FS, error); + return error; } /** @@ -1102,14 +1076,10 @@ void gfs_unfreeze_fs(struct gfs_sbd *sdp) { - ENTER(GFN_UNFREEZE_FS) - down(&sdp->sd_freeze_lock); if (sdp->sd_freeze_count && !--sdp->sd_freeze_count) gfs_glock_dq_uninit(&sdp->sd_freeze_gh); up(&sdp->sd_freeze_lock); - - RET(GFN_UNFREEZE_FS); } --- cluster/gfs-kernel/src/gfs/super.h 2005/01/04 10:07:12 1.2 +++ cluster/gfs-kernel/src/gfs/super.h 2006/07/10 23:22:34 1.3 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/trans.c 2006/01/09 22:25:06 1.10 +++ cluster/gfs-kernel/src/gfs/trans.c 2006/07/10 23:22:34 1.11 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -39,7 +39,6 @@ void gfs_trans_print(struct gfs_sbd *sdp, struct gfs_trans *tr, unsigned int where) { - ENTER(GFN_TRANS_PRINT) struct gfs_log_element *le; struct list_head *tmp, *head; unsigned int mblks = 0, eblks = 0; @@ -60,8 +59,6 @@ } printk("End Trans\n"); - - RET(GFN_TRANS_PRINT); } /** @@ -87,14 +84,13 @@ unsigned int meta_blocks, unsigned int extra_blocks, char *file, unsigned int line) { - ENTER(GFN_TRANS_BEGIN_I) struct gfs_trans *tr; unsigned int blocks; int error; tr = kmalloc(sizeof(struct gfs_trans), GFP_KERNEL); if (!tr) - RETURN(GFN_TRANS_BEGIN_I, -ENOMEM); + return -ENOMEM; memset(tr, 0, sizeof(struct gfs_trans)); INIT_LIST_HEAD(&tr->tr_elements); @@ -140,7 +136,7 @@ gfs_assert(sdp, !get_transaction,); set_transaction(tr); - RETURN(GFN_TRANS_BEGIN_I, 0); + return 0; fail_gunlock: gfs_glock_dq(tr->tr_t_gh); @@ -151,7 +147,7 @@ fail: kfree(tr); - RETURN(GFN_TRANS_BEGIN_I, error); + return error; } /** @@ -166,7 +162,6 @@ void gfs_trans_end(struct gfs_sbd *sdp) { - ENTER(GFN_TRANS_END) struct gfs_trans *tr; struct gfs_holder *t_gh; struct list_head *tmp, *head; @@ -189,7 +184,7 @@ gfs_glock_dq(t_gh); gfs_holder_put(t_gh); - RET(GFN_TRANS_END); + return; } /* Do trans_end log-operation for each log element */ @@ -207,8 +202,6 @@ if (sdp->sd_vfs->s_flags & MS_SYNCHRONOUS) gfs_log_flush(sdp); - - RET(GFN_TRANS_END); } /** @@ -238,8 +231,6 @@ void gfs_trans_add_gl(struct gfs_glock *gl) { - ENTER(GFN_TRANS_ADD_GL) - if (!gl->gl_new_le.le_trans) { gfs_assert_withdraw(gl->gl_sbd, gfs_glock_is_locked_by_me(gl) && @@ -254,8 +245,6 @@ LO_ADD(gl->gl_sbd, &gl->gl_new_le); gl->gl_new_le.le_trans->tr_num_gl++; } - - RET(GFN_TRANS_ADD_GL); } /** @@ -284,7 +273,6 @@ void gfs_trans_add_bh(struct gfs_glock *gl, struct buffer_head *bh) { - ENTER(GFN_TRANS_ADD_BH) struct gfs_sbd *sdp = gl->gl_sbd; struct gfs_bufdata *bd; @@ -297,7 +285,7 @@ /* If buffer has already been attached to trans, we're done */ if (bd->bd_new_le.le_trans) - RET(GFN_TRANS_ADD_BH); + return; gfs_meta_check(sdp, bh); @@ -312,8 +300,6 @@ /* Attach buffer to trans */ LO_ADD(sdp, &bd->bd_new_le); bd->bd_new_le.le_trans->tr_num_buf++; - - RET(GFN_TRANS_ADD_BH); } /** @@ -330,7 +316,6 @@ gfs_trans_add_unlinked(struct gfs_sbd *sdp, unsigned int type, struct gfs_inum *inum) { - ENTER(GFN_TRANS_ADD_UNLINKED) struct gfs_unlinked *ul; /* Find in fileystem's unlinked list, or create */ @@ -352,7 +337,7 @@ break; } - RETURN(GFN_TRANS_ADD_UNLINKED, ul); + return ul; } /** @@ -368,7 +353,6 @@ gfs_trans_add_quota(struct gfs_sbd *sdp, int64_t change, uint32_t uid, uint32_t gid) { - ENTER(GFN_TRANS_ADD_QUOTA) struct gfs_trans *tr; struct list_head *tmp, *head, *next; struct gfs_log_element *le; @@ -377,15 +361,15 @@ int error; if (!gfs_tune_get(sdp, gt_quota_account)) - RET(GFN_TRANS_ADD_QUOTA); + return; if (gfs_assert_warn(sdp, change)) - RET(GFN_TRANS_ADD_QUOTA); + return; found_uid = (uid == NO_QUOTA_CHANGE); found_gid = (gid == NO_QUOTA_CHANGE); if (gfs_assert_warn(sdp, !found_uid || !found_gid)) - RET(GFN_TRANS_ADD_QUOTA); + return; tr = get_transaction; gfs_assert(sdp, tr,); @@ -479,6 +463,4 @@ LO_ADD(sdp, &ql->ql_le); tr->tr_num_q++; } - - RET(GFN_TRANS_ADD_QUOTA); } --- cluster/gfs-kernel/src/gfs/trans.h 2004/12/18 03:11:13 1.3 +++ cluster/gfs-kernel/src/gfs/trans.h 2006/07/10 23:22:34 1.4 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/unlinked.c 2005/01/12 23:04:18 1.7 +++ cluster/gfs-kernel/src/gfs/unlinked.c 2006/07/10 23:22:34 1.8 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -41,7 +41,6 @@ struct gfs_unlinked * gfs_unlinked_get(struct gfs_sbd *sdp, struct gfs_inum *inum, int create) { - ENTER(GFN_UNLINKED_GET) struct gfs_unlinked *ul = NULL, *new_ul = NULL; struct list_head *tmp, *head; @@ -76,7 +75,7 @@ if (new_ul) /* someone beat us to it; forget our new_ul */ kfree(new_ul); - RETURN(GFN_UNLINKED_GET, ul); + return ul; } /* No match on list, 1st time through loop. @@ -105,14 +104,10 @@ void gfs_unlinked_hold(struct gfs_sbd *sdp, struct gfs_unlinked *ul) { - ENTER(GFN_UNLINKED_HOLD) - spin_lock(&sdp->sd_unlinked_lock); gfs_assert(sdp, ul->ul_count,); ul->ul_count++; spin_unlock(&sdp->sd_unlinked_lock); - - RET(GFN_UNLINKED_HOLD); } /** @@ -127,8 +122,6 @@ void gfs_unlinked_put(struct gfs_sbd *sdp, struct gfs_unlinked *ul) { - ENTER(GFN_UNLINKED_PUT) - spin_lock(&sdp->sd_unlinked_lock); gfs_assert(sdp, ul->ul_count,); @@ -144,8 +137,6 @@ kfree(ul); } else spin_unlock(&sdp->sd_unlinked_lock); - - RET(GFN_UNLINKED_PUT); } /** @@ -161,12 +152,11 @@ struct gfs_unlinked * unlinked_find(struct gfs_sbd *sdp) { - ENTER(GFN_UNLINKED_FIND) struct list_head *tmp, *head; struct gfs_unlinked *ul = NULL; if (test_bit(SDF_ROFS, &sdp->sd_flags)) - RETURN(GFN_UNLINKED_FIND, NULL); + return NULL; gfs_log_lock(sdp); spin_lock(&sdp->sd_unlinked_lock); @@ -198,7 +188,7 @@ spin_unlock(&sdp->sd_unlinked_lock); gfs_log_unlock(sdp); - RETURN(GFN_UNLINKED_FIND, ul); + return ul; } /** @@ -211,8 +201,6 @@ void gfs_unlinked_lock(struct gfs_sbd *sdp, struct gfs_unlinked *ul) { - ENTER(GFN_UNLINKED_LOCK) - spin_lock(&sdp->sd_unlinked_lock); gfs_assert_warn(sdp, !test_bit(ULF_LOCK, &ul->ul_flags)); @@ -221,8 +209,6 @@ ul->ul_count++; spin_unlock(&sdp->sd_unlinked_lock); - - RET(GFN_UNLINKED_LOCK); } /** @@ -235,8 +221,6 @@ void gfs_unlinked_unlock(struct gfs_sbd *sdp, struct gfs_unlinked *ul) { - ENTER(GFN_UNLINKED_UNLOCK) - spin_lock(&sdp->sd_unlinked_lock); gfs_assert_warn(sdp, test_bit(ULF_LOCK, &ul->ul_flags)); @@ -253,8 +237,6 @@ kfree(ul); } else spin_unlock(&sdp->sd_unlinked_lock); - - RET(GFN_UNLINKED_UNLOCK); } /** @@ -270,7 +252,6 @@ gfs_unlinked_merge(struct gfs_sbd *sdp, unsigned int type, struct gfs_inum *inum) { - ENTER(GFN_UNLINKED_MERGE) struct gfs_unlinked *ul; gfs_assert(sdp, atomic_read(&sdp->sd_unlinked_ic_count) == @@ -311,8 +292,6 @@ gfs_log_unlock(sdp); gfs_unlinked_put(sdp, ul); - - RET(GFN_UNLINKED_MERGE); } /** @@ -324,7 +303,6 @@ void gfs_unlinked_cleanup(struct gfs_sbd *sdp) { - ENTER(GFN_UNLINKED_CLEANUP) struct gfs_unlinked *ul; restart: @@ -369,8 +347,6 @@ !atomic_read(&sdp->sd_unlinked_od_count),); gfs_log_unlock(sdp); - - RET(GFN_UNLINKED_CLEANUP); } /** @@ -383,7 +359,6 @@ void gfs_unlinked_limit(struct gfs_sbd *sdp) { - ENTER(GFN_UNLINKED_LIMIT) unsigned int tries = 0, min = 0; int error; @@ -412,8 +387,6 @@ } else if (error != 1) break; } - - RET(GFN_UNLINKED_LIMIT); } /** @@ -426,7 +399,6 @@ void gfs_unlinked_dealloc(struct gfs_sbd *sdp) { - ENTER(GFN_UNLINKED_DEALLOC) unsigned int hits, strikes; int error; @@ -437,7 +409,7 @@ for (;;) { struct gfs_unlinked *ul = unlinked_find(sdp); if (!ul) - RET(GFN_UNLINKED_DEALLOC); + return; error = gfs_inode_dealloc(sdp, &ul->ul_inum); @@ -469,6 +441,4 @@ !test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) printk("GFS: fsid=%s: error deallocating inodes: %d\n", sdp->sd_fsname, error); - - RET(GFN_UNLINKED_DEALLOC); } --- cluster/gfs-kernel/src/gfs/unlinked.h 2004/06/24 08:53:28 1.1 +++ cluster/gfs-kernel/src/gfs/unlinked.h 2006/07/10 23:22:34 1.2 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 --- cluster/gfs-kernel/src/gfs/util.c 2005/03/10 19:57:55 1.12 +++ cluster/gfs-kernel/src/gfs/util.c 2006/07/10 23:22:34 1.13 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -45,9 +45,8 @@ uint32_t gfs_random(void) { - ENTER(GFN_RANDOM) gfs_random_number = 0x0019660D * gfs_random_number + 0x3C6EF35F; - RETURN(GFN_RANDOM, gfs_random_number); + return gfs_random_number; } /** @@ -69,7 +68,6 @@ static __inline__ uint32_t hash_more_internal(const void *data, unsigned int len, uint32_t hash) { - ENTER(GFN_HASH_MORE_INTERNAL) unsigned char *p = (unsigned char *)data; unsigned char *e = p + len; uint32_t h = hash; @@ -79,7 +77,7 @@ h *= 0x01000193; } - RETURN(GFN_HASH_MORE_INTERNAL, h); + return h; } /** @@ -98,10 +96,9 @@ uint32_t gfs_hash(const void *data, unsigned int len) { - ENTER(GFN_HASH) uint32_t h = 0x811C9DC5; h = hash_more_internal(data, len, h); - RETURN(GFN_HASH, h); + return h; } /** @@ -129,9 +126,9 @@ uint32_t gfs_hash_more(const void *data, unsigned int len, uint32_t hash) { - ENTER(GFN_HASH_MORE) - RETURN(GFN_HASH_MORE, - hash_more_internal(data, len, hash)); + uint32_t h; + h = hash_more_internal(data, len, hash); + return h; } /* Byte-wise swap two items of size SIZE. */ @@ -163,7 +160,6 @@ gfs_sort(void *base, unsigned int num_elem, unsigned int size, int (*compar) (const void *, const void *)) { - ENTER(GFN_SORT) register char *pbase = (char *)base; int i, j, k, h; static int cols[16] = {1391376, 463792, 198768, 86961, @@ -185,8 +181,6 @@ } } } - - RET(GFN_SORT); } /** @@ -245,7 +239,6 @@ const char *function, char *file, unsigned int line) { - ENTER(GFN_ASSERT_WITHDRAW_I) int me; me = gfs_lm_withdraw(sdp, "GFS: fsid=%s: fatal: assertion \"%s\" failed\n" @@ -256,7 +249,7 @@ sdp->sd_fsname, function, sdp->sd_fsname, file, line, sdp->sd_fsname, get_seconds()); - RETURN(GFN_ASSERT_WITHDRAW_I, (me) ? -1 : -2); + return (me) ? -1 : -2; } /** @@ -277,12 +270,10 @@ const char *function, char *file, unsigned int line) { - ENTER(GFN_ASSERT_WARN_I) - if (time_before(jiffies, sdp->sd_last_warning + gfs_tune_get(sdp, gt_complain_secs) * HZ)) - RETURN(GFN_ASSERT_WARN_I, -2); + return -2; printk("GFS: fsid=%s: warning: assertion \"%s\" failed\n" "GFS: fsid=%s: function = %s\n" @@ -293,12 +284,12 @@ sdp->sd_fsname, file, line, sdp->sd_fsname, get_seconds()); + sdp->sd_last_warning = jiffies; if (sdp->sd_args.ar_debug) BUG(); - sdp->sd_last_warning = jiffies; - RETURN(GFN_ASSERT_WARN_I, -1); + return -1; } /** @@ -318,9 +309,7 @@ const char *function, char *file, unsigned int line) { - ENTER(GFN_CONSIST_I) - RETURN(GFN_CONSIST_I, - gfs_lm_withdraw(sdp, + return gfs_lm_withdraw(sdp, "GFS: fsid=%s: fatal: filesystem consistency error\n" "GFS: fsid=%s: function = %s\n" "GFS: fsid=%s: file = %s, line = %u\n" @@ -328,7 +317,7 @@ sdp->sd_fsname, sdp->sd_fsname, function, sdp->sd_fsname, file, line, - sdp->sd_fsname, get_seconds())); + sdp->sd_fsname, get_seconds()); } /** @@ -348,10 +337,8 @@ const char *function, char *file, unsigned int line) { - ENTER(GFN_CONSIST_INODE_I) struct gfs_sbd *sdp = ip->i_sbd; - RETURN(GFN_CONSIST_INODE_I, - gfs_lm_withdraw(sdp, + return gfs_lm_withdraw(sdp, "GFS: fsid=%s: fatal: filesystem consistency error\n" "GFS: fsid=%s: inode = %"PRIu64"/%"PRIu64"\n" "GFS: fsid=%s: function = %s\n" @@ -361,7 +348,7 @@ sdp->sd_fsname, ip->i_num.no_formal_ino, ip->i_num.no_addr, sdp->sd_fsname, function, sdp->sd_fsname, file, line, - sdp->sd_fsname, get_seconds())); + sdp->sd_fsname, get_seconds()); } /** @@ -381,10 +368,8 @@ const char *function, char *file, unsigned int line) { - ENTER(GFN_CONSIST_RGRPD_I) struct gfs_sbd *sdp = rgd->rd_sbd; - RETURN(GFN_CONSIST_RGRPD_I, - gfs_lm_withdraw(sdp, + return gfs_lm_withdraw(sdp, "GFS: fsid=%s: fatal: filesystem consistency error\n" "GFS: fsid=%s: RG = %"PRIu64"\n" "GFS: fsid=%s: function = %s\n" @@ -394,7 +379,7 @@ sdp->sd_fsname, rgd->rd_ri.ri_addr, sdp->sd_fsname, function, sdp->sd_fsname, file, line, - sdp->sd_fsname, get_seconds())); + sdp->sd_fsname, get_seconds()); } /** @@ -414,7 +399,6 @@ const char *function, char *file, unsigned int line) { - ENTER(GFN_META_CHECK_II) int me; me = gfs_lm_withdraw(sdp, "GFS: fsid=%s: fatal: invalid metadata block\n" @@ -427,7 +411,7 @@ sdp->sd_fsname, function, sdp->sd_fsname, file, line, sdp->sd_fsname, get_seconds()); - RETURN(GFN_META_CHECK_II, (me) ? -1 : -2); + return (me) ? -1 : -2; } /** @@ -450,7 +434,6 @@ const char *function, char *file, unsigned int line) { - ENTER(GFN_METATYPE_CHECK_II) int me; me = gfs_lm_withdraw(sdp, "GFS: fsid=%s: fatal: invalid metadata block\n" @@ -463,7 +446,7 @@ sdp->sd_fsname, function, sdp->sd_fsname, file, line, sdp->sd_fsname, get_seconds()); - RETURN(GFN_METATYPE_CHECK_II, (me) ? -1 : -2); + return (me) ? -1 : -2; } /** @@ -482,9 +465,7 @@ const char *function, char *file, unsigned int line) { - ENTER(GFN_IO_ERROR_i) - RETURN(GFN_IO_ERROR_i, - gfs_lm_withdraw(sdp, + return gfs_lm_withdraw(sdp, "GFS: fsid=%s: fatal: I/O error\n" "GFS: fsid=%s: function = %s\n" "GFS: fsid=%s: file = %s, line = %u\n" @@ -492,7 +473,7 @@ sdp->sd_fsname, sdp->sd_fsname, function, sdp->sd_fsname, file, line, - sdp->sd_fsname, get_seconds())); + sdp->sd_fsname, get_seconds()); } /** @@ -511,10 +492,8 @@ const char *function, char *file, unsigned int line) { - ENTER(GFN_IO_ERROR_INODE_I) struct gfs_sbd *sdp = ip->i_sbd; - RETURN(GFN_IO_ERROR_INODE_I, - gfs_lm_withdraw(sdp, + return gfs_lm_withdraw(sdp, "GFS: fsid=%s: fatal: I/O error\n" "GFS: fsid=%s: inode = %"PRIu64"/%"PRIu64"\n" "GFS: fsid=%s: function = %s\n" @@ -524,7 +503,7 @@ sdp->sd_fsname, ip->i_num.no_formal_ino, ip->i_num.no_addr, sdp->sd_fsname, function, sdp->sd_fsname, file, line, - sdp->sd_fsname, get_seconds())); + sdp->sd_fsname, get_seconds()); } /** @@ -544,9 +523,7 @@ const char *function, char *file, unsigned int line) { - ENTER(GFN_IO_ERROR_BH_I) - RETURN(GFN_IO_ERROR_BH_I, - gfs_lm_withdraw(sdp, + return gfs_lm_withdraw(sdp, "GFS: fsid=%s: fatal: I/O error\n" "GFS: fsid=%s: block = %"PRIu64"\n" "GFS: fsid=%s: function = %s\n" @@ -556,7 +533,7 @@ sdp->sd_fsname, (uint64_t)bh->b_blocknr, sdp->sd_fsname, function, sdp->sd_fsname, file, line, - sdp->sd_fsname, get_seconds())); + sdp->sd_fsname, get_seconds()); } /** @@ -569,10 +546,9 @@ void * gmalloc(unsigned int size) { - ENTER(GFN_GMALLOC) void *p; RETRY_MALLOC(p = kmalloc(size, GFP_KERNEL), p); - RETURN(GFN_GMALLOC, p); + return p; } /** @@ -586,66 +562,23 @@ int gfs_add_bh_to_ub(struct gfs_user_buffer *ub, struct buffer_head *bh) { - ENTER(GFN_ADD_BH_TO_UB) - uint64_t blkno = bh->b_blocknr; if (ub->ub_count + sizeof(uint64_t) + bh->b_size > ub->ub_size) - RETURN(GFN_ADD_BH_TO_UB, -ENOMEM); + return -ENOMEM; if (copy_to_user(ub->ub_data + ub->ub_count, &blkno, sizeof(uint64_t))) - RETURN(GFN_ADD_BH_TO_UB, -EFAULT); + return -EFAULT; ub->ub_count += sizeof(uint64_t); if (copy_to_user(ub->ub_data + ub->ub_count, bh->b_data, bh->b_size)) - RETURN(GFN_ADD_BH_TO_UB, -EFAULT); + return -EFAULT; ub->ub_count += bh->b_size; - RETURN(GFN_ADD_BH_TO_UB, 0); -} - -/** - * gfs_printf_i - - * @buf: - * @size: - * @count: - * @fmt: - * - * Returns: 0 on success, 1 on out of space - */ - -int -gfs_printf_i(char *buf, unsigned int size, unsigned int *count, - char *fmt, ...) -{ - ENTER(GFN_PRINTF_I) - va_list args; - int left, out; - - if (!buf) { - va_start(args, fmt); - vprintk(fmt, args); - va_end(args); - RETURN(GFN_PRINTF_I, 0); - } - - left = size - *count; - if (left <= 0) - RETURN(GFN_PRINTF_I, 1); - - va_start(args, fmt); - out = vsnprintf(buf + *count, left, fmt, args); - va_end(args); - - if (out < left) - *count += out; - else - RETURN(GFN_PRINTF_I, 1); - - RETURN(GFN_PRINTF_I, 0); + return 0; } --- cluster/gfs-kernel/src/gfs/util.h 2006/02/20 04:33:06 1.9 +++ cluster/gfs-kernel/src/gfs/util.h 2006/07/10 23:22:34 1.10 @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. 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 @@ -340,16 +340,4 @@ gfs_tune_get_i(&(sdp)->sd_tune, &(sdp)->sd_tune.field) -int -gfs_printf_i(char *buf, unsigned int size, unsigned int *count, - char *fmt, ...) -__attribute__ ((format(printf, 4, 5))); - -#define gfs_printf(fmt, args...) \ -do { \ - if (gfs_printf_i(buf, size, count, fmt, ##args)) \ - goto out; \ -} while(0) - - #endif /* __UTIL_DOT_H__ */