From 75dcbc1743ee8aae3a1933fcdcdcda1830062b30 Mon Sep 17 00:00:00 2001 From: zab Date: Tue, 27 May 2003 01:25:16 +0000 Subject: [PATCH] get b_ad compiling after the b_devel merge. - move the possibly broken waitfor_one_page to one place - o_mtime is seconds, that's what ll_ts2u64 returns. s/%Lu/LPU64/ - get rid of client_tgt2uuid2obd copies, export it from obdclass - move client_obd_{setup,cleanup} into obdclass, export, kill dupes - remove empty ptlrpc_lib - get rid of random sanobd dupe in lov - hoist ll_alloc_brw out of a kernel version ifdef - no, seriously, unsigned long flags. --- lustre/ldlm/ldlm_lib.c | 158 +-------------------------------------------- lustre/osc/osc_lib.c | 10 +-- lustre/ptlrpc/ptlrpc_lib.c | 119 ---------------------------------- 3 files changed, 4 insertions(+), 283 deletions(-) delete mode 100644 lustre/ptlrpc/ptlrpc_lib.c diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 8b5acc6..b537ebe 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -31,162 +31,6 @@ #include #include -struct obd_device *client_tgtuuid2obd(struct obd_uuid *tgtuuid) -{ - int i; - - for (i = 0; i < MAX_OBD_DEVICES; i++) { - struct obd_device *obd = &obd_dev[i]; - if (obd->obd_type == NULL) - continue; - if ((strncmp(obd->obd_type->typ_name, LUSTRE_OSC_NAME, - sizeof LUSTRE_OSC_NAME) == 0) || - (strncmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME, - sizeof LUSTRE_MDC_NAME) == 0)) { - struct client_obd *cli = &obd->u.cli; - struct obd_import *imp = cli->cl_import; - if (strncmp(tgtuuid->uuid, imp->imp_target_uuid.uuid, - sizeof(imp->imp_target_uuid)) == 0) - return obd; - } - } - - return NULL; -} - -int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf) -{ - struct ptlrpc_connection *conn; - struct obd_ioctl_data* data = buf; - struct client_obd *cli = &obddev->u.cli; - struct obd_import *imp; - struct obd_uuid server_uuid; - int rq_portal, rp_portal, connect_op; - char *name; - ENTRY; - - if (obddev->obd_type->typ_ops->o_brw) { - rq_portal = OST_REQUEST_PORTAL; - rp_portal = OSC_REPLY_PORTAL; - name = "osc"; - connect_op = OST_CONNECT; - } else { - rq_portal = MDS_REQUEST_PORTAL; - rp_portal = MDC_REPLY_PORTAL; - name = "mdc"; - connect_op = MDS_CONNECT; - } - - if (data->ioc_inllen1 < 1) { - CERROR("requires a TARGET UUID\n"); - RETURN(-EINVAL); - } - - if (data->ioc_inllen1 > 37) { - CERROR("client UUID must be less than 38 characters\n"); - RETURN(-EINVAL); - } - - if (data->ioc_inllen2 < 1) { - CERROR("setup requires a SERVER UUID\n"); - RETURN(-EINVAL); - } - - if (data->ioc_inllen2 > 37) { - CERROR("target UUID must be less than 38 characters\n"); - RETURN(-EINVAL); - } - - sema_init(&cli->cl_sem, 1); - cli->cl_conn_count = 0; - memcpy(server_uuid.uuid, data->ioc_inlbuf2, MIN(data->ioc_inllen2, - sizeof(server_uuid))); - - conn = ptlrpc_uuid_to_connection(&server_uuid); - if (conn == NULL) - RETURN(-ENOENT); - - ptlrpc_init_client(rq_portal, rp_portal, name, - &obddev->obd_ldlm_client); - - imp = class_new_import(); - if (imp == NULL) { - ptlrpc_put_connection(conn); - RETURN(-ENOMEM); - } - imp->imp_connection = conn; - imp->imp_client = &obddev->obd_ldlm_client; - imp->imp_obd = obddev; - imp->imp_connect_op = connect_op; - imp->imp_generation = 0; - memcpy(imp->imp_target_uuid.uuid, data->ioc_inlbuf1, data->ioc_inllen1); - class_import_put(imp); - - cli->cl_import = imp; - cli->cl_max_mds_easize = sizeof(struct lov_mds_md); - cli->cl_sandev = to_kdev_t(0); - - RETURN(0); -} - -int client_obd_cleanup(struct obd_device *obddev, int force, int failover) -{ - struct client_obd *client = &obddev->u.cli; - - if (!client->cl_import) - RETURN(-EINVAL); - class_destroy_import(client->cl_import); - client->cl_import = NULL; - RETURN(0); -} - -#ifdef __KERNEL__ -/* convert a pathname into a kdev_t */ -static kdev_t path2dev(char *path) -{ - struct dentry *dentry; - struct nameidata nd; - kdev_t dev; - KDEVT_VAL(dev, 0); - - if (!path_init(path, LOOKUP_FOLLOW, &nd)) - return 0; - - if (path_walk(path, &nd)) - return 0; - - dentry = nd.dentry; - if (dentry->d_inode && !is_bad_inode(dentry->d_inode) && - S_ISBLK(dentry->d_inode->i_mode)) - dev = dentry->d_inode->i_rdev; - path_release(&nd); - - return dev; -} - -int client_sanobd_setup(struct obd_device *obddev, obd_count len, void *buf) -{ - struct obd_ioctl_data* data = buf; - struct client_obd *cli = &obddev->u.cli; - ENTRY; - - if (data->ioc_inllen3 < 1) { - CERROR("setup requires a SAN device pathname\n"); - RETURN(-EINVAL); - } - - client_obd_setup(obddev, len, buf); - - cli->cl_sandev = path2dev(data->ioc_inlbuf3); - if (!kdev_t_to_nr(cli->cl_sandev)) { - CERROR("%s seems not a valid SAN device\n", data->ioc_inlbuf3); - RETURN(-EINVAL); - } - - RETURN(0); -} -#endif - int ptlrpc_import_connect(struct lustre_handle *conn, struct obd_device *obd, struct obd_uuid *cluuid) { @@ -618,7 +462,7 @@ int target_handle_connect(struct ptlrpc_request *req, svc_handler_t handler) struct obd_uuid remote_uuid; struct list_head *p; char *str, *tmp; - int rc, i, abort_recovery; + int rc = 0, i, abort_recovery; ENTRY; LASSERT_REQSWAB (req, 0); diff --git a/lustre/osc/osc_lib.c b/lustre/osc/osc_lib.c index aa04a1a..c874db8 100644 --- a/lustre/osc/osc_lib.c +++ b/lustre/osc/osc_lib.c @@ -34,14 +34,10 @@ static kdev_t path2dev(char *path) { struct dentry *dentry; struct nameidata nd; - kdev_t dev; - KDEVT_VAL(dev, 0); + kdev_t dev = KDEVT_INIT(0); - if (!path_init(path, LOOKUP_FOLLOW, &nd)) - return 0; - - if (path_walk(path, &nd)) - return 0; + if (ll_path_lookup(path, LOOKUP_FOLLOW, &nd)) + return val_to_kdev(0); dentry = nd.dentry; if (dentry->d_inode && !is_bad_inode(dentry->d_inode) && diff --git a/lustre/ptlrpc/ptlrpc_lib.c b/lustre/ptlrpc/ptlrpc_lib.c deleted file mode 100644 index 71142fa..0000000 --- a/lustre/ptlrpc/ptlrpc_lib.c +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * - * Copyright (c) 2003 Cluster File Systems, Inc. - * - * This file is part of Lustre, http://www.lustre.org. - * - * Lustre is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * Lustre is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Lustre; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#define EXPORT_SYMTAB -#define DEBUG_SUBSYSTEM S_RPC - -#ifdef __KERNEL__ -# include -#else -# include -#endif -#include -#include -#include -#include - -int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf) -{ - struct ptlrpc_connection *conn; - struct obd_ioctl_data* data = buf; - struct client_obd *cli = &obddev->u.cli; - struct obd_import *imp; - struct obd_uuid server_uuid; - int rq_portal, rp_portal, connect_op; - char *name; - ENTRY; - - if (obddev->obd_type->typ_ops->o_brw) { - rq_portal = OST_REQUEST_PORTAL; - rp_portal = OSC_REPLY_PORTAL; - name = "osc"; - connect_op = OST_CONNECT; - } else { - rq_portal = MDS_REQUEST_PORTAL; - rp_portal = MDC_REPLY_PORTAL; - name = "mdc"; - connect_op = MDS_CONNECT; - } - - if (data->ioc_inllen1 < 1) { - CERROR("requires a TARGET UUID\n"); - RETURN(-EINVAL); - } - - if (data->ioc_inllen1 > 37) { - CERROR("client UUID must be less than 38 characters\n"); - RETURN(-EINVAL); - } - - if (data->ioc_inllen2 < 1) { - CERROR("setup requires a SERVER UUID\n"); - RETURN(-EINVAL); - } - - if (data->ioc_inllen2 > 37) { - CERROR("target UUID must be less than 38 characters\n"); - RETURN(-EINVAL); - } - - sema_init(&cli->cl_sem, 1); - cli->cl_conn_count = 0; - memcpy(server_uuid.uuid, data->ioc_inlbuf2, MIN(data->ioc_inllen2, - sizeof(server_uuid))); - - conn = ptlrpc_uuid_to_connection(&server_uuid); - if (conn == NULL) - RETURN(-ENOENT); - - ptlrpc_init_client(rq_portal, rp_portal, name, - &obddev->obd_ldlm_client); - - imp = class_new_import(); - if (imp == NULL) { - ptlrpc_put_connection(conn); - RETURN(-ENOMEM); - } - imp->imp_connection = conn; - imp->imp_client = &obddev->obd_ldlm_client; - imp->imp_obd = obddev; - imp->imp_connect_op = connect_op; - imp->imp_generation = 0; - memcpy(imp->imp_target_uuid.uuid, data->ioc_inlbuf1, data->ioc_inllen1); - class_import_put(imp); - - cli->cl_import = imp; - cli->cl_max_mds_easize = sizeof(struct lov_mds_md); - cli->cl_sandev = to_kdev_t(0); - - RETURN(0); -} - -int client_obd_cleanup(struct obd_device *obddev, int force, int failover) -{ - struct client_obd *client = &obddev->u.cli; - - if (!client->cl_import) - RETURN(-EINVAL); - class_destroy_import(client->cl_import); - client->cl_import = NULL; - RETURN(0); -} -- 1.8.3.1