1 /* SPDX-License-Identifier: GPL-2.0 */
4 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
5 * Use is subject to license terms.
7 * Copyright (c) 2011, 2014, Intel Corporation.
11 * This file is part of Lustre, http://www.lustre.org/
13 * MDS data structures.
14 * See also lustre_idl.h for wire formats of requests.
26 #include <linux/dcache.h>
27 #ifdef CONFIG_LUSTRE_FS_POSIX_ACL
28 # include <lustre_compat.h>
29 #endif /* CONFIG_LUSTRE_FS_POSIX_ACL */
30 #include <lustre_handles.h>
31 #include <lustre_intent.h>
32 #include <libcfs/libcfs.h>
33 #include <obd_class.h>
34 #include <uapi/linux/lustre/lustre_idl.h>
35 #include <lustre_lib.h>
36 #include <lustre_dlm.h>
37 #include <lustre_export.h>
41 struct ptlrpc_request;
45 * Update the maximum possible easize.
47 * This value is learned from ptlrpc replies sent by the MDT. The
48 * default easize is initialized to the minimum value but allowed to
49 * grow up to a single page in size if required to handle the common
52 * \see client_obd::cl_default_mds_easize
54 * \param[in] exp export for MDC device
55 * \param[in] body body of ptlrpc reply from MDT
58 static inline void mdc_update_max_ea_from_body(struct obd_export *exp,
59 struct mdt_body *body)
61 if (body->mbo_valid & OBD_MD_FLMODEASIZE) {
62 struct client_obd *cli = &exp->exp_obd->u.cli;
65 if (cli->cl_max_mds_easize < body->mbo_max_mdsize)
66 cli->cl_max_mds_easize = body->mbo_max_mdsize;
68 def_easize = min_t(__u32, body->mbo_max_mdsize,
69 OBD_MAX_DEFAULT_EA_SIZE);
70 cli->cl_default_mds_easize = def_easize;
76 int it_open_error(int phase, struct lookup_intent *it);
78 static inline bool cl_is_lov_delay_create(enum mds_open_flags flags)
80 return (flags & O_LOV_DELAY_CREATE) == O_LOV_DELAY_CREATE;
83 static inline void cl_lov_delay_create_clear(unsigned int *flags)
85 if ((*flags & O_LOV_DELAY_CREATE) == O_LOV_DELAY_CREATE)
86 *flags &= ~O_LOV_DELAY_CREATE;
89 static inline unsigned long hash_x_index(__u64 hash, int hash64)
91 if (BITS_PER_LONG == 32 && hash64)
93 /* save hash 0 with hash 1 */
94 return ~0UL - (hash + !hash);