mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-17 09:43:59 +08:00
f057f6cdf6
This is the big patch that I've been working on for some time now. There are many reasons for wanting to make this change such as: o Reducing overhead by eliminating duplicated fields between structures o Simplifcation of the code (reduces the code size by a fair bit) o The locking interface is now the DLM interface itself as proposed some time ago. o Fewer lookups of glocks when processing replies from the DLM o Fewer memory allocations/deallocations for each glock o Scope to do further optimisations in the future (but this patch is more than big enough for now!) Please note that (a) this patch relates to the lock_dlm module and not the DLM itself, that is still a separate module; and (b) that we retain the ability to build GFS2 as a standalone single node filesystem with out requiring the DLM. This patch needs a lot of testing, hence my keeping it I restarted my -git tree after the last merge window. That way, this has the maximum exposure before its merged. This is (modulo a few minor bug fixes) the same patch that I've been posting on and off the the last three months and its passed a number of different tests so far. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
170 lines
3.5 KiB
C
170 lines
3.5 KiB
C
/*
|
|
* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
|
|
* Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
|
|
*
|
|
* This copyrighted material is made available to anyone wishing to use,
|
|
* modify, copy, or redistribute it subject to the terms and conditions
|
|
* of the GNU General Public License version 2.
|
|
*/
|
|
|
|
#include <linux/slab.h>
|
|
#include <linux/spinlock.h>
|
|
#include <linux/completion.h>
|
|
#include <linux/buffer_head.h>
|
|
#include <linux/gfs2_ondisk.h>
|
|
#include <linux/parser.h>
|
|
|
|
#include "gfs2.h"
|
|
#include "incore.h"
|
|
#include "super.h"
|
|
#include "sys.h"
|
|
#include "util.h"
|
|
|
|
enum {
|
|
Opt_lockproto,
|
|
Opt_locktable,
|
|
Opt_hostdata,
|
|
Opt_spectator,
|
|
Opt_ignore_local_fs,
|
|
Opt_localflocks,
|
|
Opt_localcaching,
|
|
Opt_debug,
|
|
Opt_nodebug,
|
|
Opt_upgrade,
|
|
Opt_acl,
|
|
Opt_noacl,
|
|
Opt_quota_off,
|
|
Opt_quota_account,
|
|
Opt_quota_on,
|
|
Opt_suiddir,
|
|
Opt_nosuiddir,
|
|
Opt_data_writeback,
|
|
Opt_data_ordered,
|
|
Opt_meta,
|
|
Opt_err,
|
|
};
|
|
|
|
static const match_table_t tokens = {
|
|
{Opt_lockproto, "lockproto=%s"},
|
|
{Opt_locktable, "locktable=%s"},
|
|
{Opt_hostdata, "hostdata=%s"},
|
|
{Opt_spectator, "spectator"},
|
|
{Opt_ignore_local_fs, "ignore_local_fs"},
|
|
{Opt_localflocks, "localflocks"},
|
|
{Opt_localcaching, "localcaching"},
|
|
{Opt_debug, "debug"},
|
|
{Opt_nodebug, "nodebug"},
|
|
{Opt_upgrade, "upgrade"},
|
|
{Opt_acl, "acl"},
|
|
{Opt_noacl, "noacl"},
|
|
{Opt_quota_off, "quota=off"},
|
|
{Opt_quota_account, "quota=account"},
|
|
{Opt_quota_on, "quota=on"},
|
|
{Opt_suiddir, "suiddir"},
|
|
{Opt_nosuiddir, "nosuiddir"},
|
|
{Opt_data_writeback, "data=writeback"},
|
|
{Opt_data_ordered, "data=ordered"},
|
|
{Opt_meta, "meta"},
|
|
{Opt_err, NULL}
|
|
};
|
|
|
|
/**
|
|
* gfs2_mount_args - Parse mount options
|
|
* @sdp:
|
|
* @data:
|
|
*
|
|
* Return: errno
|
|
*/
|
|
|
|
int gfs2_mount_args(struct gfs2_sbd *sdp, struct gfs2_args *args, char *options)
|
|
{
|
|
char *o;
|
|
int token;
|
|
substring_t tmp[MAX_OPT_ARGS];
|
|
|
|
/* Split the options into tokens with the "," character and
|
|
process them */
|
|
|
|
while (1) {
|
|
o = strsep(&options, ",");
|
|
if (o == NULL)
|
|
break;
|
|
if (*o == '\0')
|
|
continue;
|
|
|
|
token = match_token(o, tokens, tmp);
|
|
switch (token) {
|
|
case Opt_lockproto:
|
|
match_strlcpy(args->ar_lockproto, &tmp[0],
|
|
GFS2_LOCKNAME_LEN);
|
|
break;
|
|
case Opt_locktable:
|
|
match_strlcpy(args->ar_locktable, &tmp[0],
|
|
GFS2_LOCKNAME_LEN);
|
|
break;
|
|
case Opt_hostdata:
|
|
match_strlcpy(args->ar_hostdata, &tmp[0],
|
|
GFS2_LOCKNAME_LEN);
|
|
break;
|
|
case Opt_spectator:
|
|
args->ar_spectator = 1;
|
|
break;
|
|
case Opt_ignore_local_fs:
|
|
args->ar_ignore_local_fs = 1;
|
|
break;
|
|
case Opt_localflocks:
|
|
args->ar_localflocks = 1;
|
|
break;
|
|
case Opt_localcaching:
|
|
args->ar_localcaching = 1;
|
|
break;
|
|
case Opt_debug:
|
|
args->ar_debug = 1;
|
|
break;
|
|
case Opt_nodebug:
|
|
args->ar_debug = 0;
|
|
break;
|
|
case Opt_upgrade:
|
|
args->ar_upgrade = 1;
|
|
break;
|
|
case Opt_acl:
|
|
args->ar_posix_acl = 1;
|
|
break;
|
|
case Opt_noacl:
|
|
args->ar_posix_acl = 0;
|
|
break;
|
|
case Opt_quota_off:
|
|
args->ar_quota = GFS2_QUOTA_OFF;
|
|
break;
|
|
case Opt_quota_account:
|
|
args->ar_quota = GFS2_QUOTA_ACCOUNT;
|
|
break;
|
|
case Opt_quota_on:
|
|
args->ar_quota = GFS2_QUOTA_ON;
|
|
break;
|
|
case Opt_suiddir:
|
|
args->ar_suiddir = 1;
|
|
break;
|
|
case Opt_nosuiddir:
|
|
args->ar_suiddir = 0;
|
|
break;
|
|
case Opt_data_writeback:
|
|
args->ar_data = GFS2_DATA_WRITEBACK;
|
|
break;
|
|
case Opt_data_ordered:
|
|
args->ar_data = GFS2_DATA_ORDERED;
|
|
break;
|
|
case Opt_meta:
|
|
args->ar_meta = 1;
|
|
break;
|
|
case Opt_err:
|
|
default:
|
|
fs_info(sdp, "invalid mount option: %s\n", o);
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|