linux/drivers/staging/lustre/lustre/include/lustre_fld.h
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0
   2/*
   3 * GPL HEADER START
   4 *
   5 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   6 *
   7 * This program is free software; you can redistribute it and/or modify
   8 * it under the terms of the GNU General Public License version 2 only,
   9 * as published by the Free Software Foundation.
  10 *
  11 * This program is distributed in the hope that it will be useful, but
  12 * WITHOUT ANY WARRANTY; without even the implied warranty of
  13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14 * General Public License version 2 for more details (a copy is included
  15 * in the LICENSE file that accompanied this code).
  16 *
  17 * You should have received a copy of the GNU General Public License
  18 * version 2 along with this program; If not, see
  19 * http://www.gnu.org/licenses/gpl-2.0.html
  20 *
  21 * GPL HEADER END
  22 */
  23/*
  24 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  25 * Use is subject to license terms.
  26 *
  27 * Copyright (c) 2011, 2015, Intel Corporation.
  28 */
  29/*
  30 * This file is part of Lustre, http://www.lustre.org/
  31 * Lustre is a trademark of Sun Microsystems, Inc.
  32 */
  33
  34#ifndef __LINUX_FLD_H
  35#define __LINUX_FLD_H
  36
  37/** \defgroup fld fld
  38 *
  39 * @{
  40 */
  41
  42#include <uapi/linux/lustre/lustre_idl.h>
  43#include <linux/libcfs/libcfs.h>
  44#include <seq_range.h>
  45
  46struct lu_client_fld;
  47struct lu_server_fld;
  48struct lu_fld_hash;
  49struct fld_cache;
  50
  51extern const struct dt_index_features fld_index_features;
  52extern const char fld_index_name[];
  53
  54/*
  55 * FLD (Fid Location Database) interface.
  56 */
  57enum {
  58        LUSTRE_CLI_FLD_HASH_DHT = 0,
  59        LUSTRE_CLI_FLD_HASH_RRB
  60};
  61
  62struct lu_fld_target {
  63        struct list_head               ft_chain;
  64        struct obd_export       *ft_exp;
  65        struct lu_server_fld    *ft_srv;
  66        __u64               ft_idx;
  67};
  68
  69struct lu_server_fld {
  70        /**
  71         * super sequence controller export, needed to forward fld
  72         * lookup  request.
  73         */
  74        struct obd_export       *lsf_control_exp;
  75
  76        /** Client FLD cache. */
  77        struct fld_cache        *lsf_cache;
  78
  79        /** Protect index modifications */
  80        struct mutex            lsf_lock;
  81
  82        /** Fld service name in form "fld-srv-lustre-MDTXXX" */
  83        char                 lsf_name[LUSTRE_MDT_MAXNAMELEN];
  84
  85};
  86
  87struct lu_client_fld {
  88        /** Client side debugfs entry. */
  89        struct dentry           *lcf_debugfs_entry;
  90
  91        /** List of exports client FLD knows about. */
  92        struct list_head               lcf_targets;
  93
  94        /** Current hash to be used to chose an export. */
  95        struct lu_fld_hash      *lcf_hash;
  96
  97        /** Exports count. */
  98        int                   lcf_count;
  99
 100        /** Lock protecting exports list and fld_hash. */
 101        spinlock_t               lcf_lock;
 102
 103        /** Client FLD cache. */
 104        struct fld_cache        *lcf_cache;
 105
 106        /** Client fld debugfs entry name. */
 107        char                     lcf_name[LUSTRE_MDT_MAXNAMELEN];
 108};
 109
 110/* Client methods */
 111int fld_client_init(struct lu_client_fld *fld,
 112                    const char *prefix, int hash);
 113
 114void fld_client_fini(struct lu_client_fld *fld);
 115
 116void fld_client_flush(struct lu_client_fld *fld);
 117
 118int fld_client_lookup(struct lu_client_fld *fld, u64 seq, u32 *mds,
 119                      __u32 flags, const struct lu_env *env);
 120
 121int fld_client_create(struct lu_client_fld *fld,
 122                      struct lu_seq_range *range,
 123                      const struct lu_env *env);
 124
 125int fld_client_delete(struct lu_client_fld *fld, u64 seq,
 126                      const struct lu_env *env);
 127
 128int fld_client_add_target(struct lu_client_fld *fld,
 129                          struct lu_fld_target *tar);
 130
 131int fld_client_del_target(struct lu_client_fld *fld,
 132                          __u64 idx);
 133
 134void fld_client_debugfs_fini(struct lu_client_fld *fld);
 135
 136/** @} fld */
 137
 138#endif
 139