X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Finclude%2Flu_object.h;h=b33b8b0c6be9db104c8a44d8de705c611187b309;hb=018e6e44fd52e12c9d4ff78ca1a5345b12577fd2;hp=10df8033236101845706ef0b729ba2e225e302e3;hpb=cec72a356891eaa729314a7bc89c4b2aaef0a31b;p=fs%2Flustre-release.git diff --git a/lustre/include/lu_object.h b/lustre/include/lu_object.h index 10df803..b33b8b0 100644 --- a/lustre/include/lu_object.h +++ b/lustre/include/lu_object.h @@ -1,6 +1,4 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * +/* * GPL HEADER START * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,6 +26,8 @@ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2011, 2012, Whamcloud, Inc. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -169,11 +169,24 @@ struct lu_device_operations { }; /** + * For lu_object_conf flags + */ +typedef enum { + /* This is a new object to be allocated, or the file + * corresponding to the object does not exists. */ + LOC_F_NEW = 0x00000001, +} loc_flags_t; + +/** * Object configuration, describing particulars of object being created. On * server this is not used, as server objects are full identified by fid. On * client configuration contains struct lustre_md. */ struct lu_object_conf { + /** + * Some hints for obj find and alloc. + */ + loc_flags_t loc_flags; }; /** @@ -278,6 +291,10 @@ struct lu_device { * A list of references to this object, for debugging. */ struct lu_ref ld_reference; + /** + * Link the device to the site. + **/ + cfs_list_t ld_linkage; }; struct lu_device_type_operations; @@ -445,6 +462,8 @@ enum la_valid { LA_NLINK = 1 << 10, LA_RDEV = 1 << 11, LA_BLKSIZE = 1 << 12, + LA_KILL_SUID = 1 << 13, + LA_KILL_SGID = 1 << 14, }; /** @@ -614,10 +633,21 @@ struct lu_site { */ cfs_list_t ls_linkage; /** + * List for lu device for this site, protected + * by ls_ld_lock. + **/ + cfs_list_t ls_ld_linkage; + cfs_spinlock_t ls_ld_lock; + + /** * lu_site stats */ struct lprocfs_stats *ls_stats; struct lprocfs_stats *ls_time_stats; + /** + * XXX: a hack! fld has to find md_site via site, remove when possible + */ + struct md_site *ld_md_site; }; static inline struct lu_site_bkt_data * @@ -650,6 +680,9 @@ void lu_object_fini (struct lu_object *o); void lu_object_add_top (struct lu_object_header *h, struct lu_object *o); void lu_object_add (struct lu_object *before, struct lu_object *o); +void lu_dev_add_linkage(struct lu_site *s, struct lu_device *d); +void lu_dev_del_linkage(struct lu_site *s, struct lu_device *d); + /** * Helpers to initialize and finalize device types. */ @@ -686,6 +719,7 @@ static inline int lu_object_is_dying(const struct lu_object_header *h) } void lu_object_put(const struct lu_env *env, struct lu_object *o); +void lu_object_put_nocache(const struct lu_env *env, struct lu_object *o); int lu_site_purge(const struct lu_env *env, struct lu_site *s, int nr); @@ -750,40 +784,23 @@ lu_object_ops(const struct lu_object *o) struct lu_object *lu_object_locate(struct lu_object_header *h, const struct lu_device_type *dtype); -struct lu_cdebug_print_info { - int lpi_subsys; - int lpi_mask; - const char *lpi_file; - const char *lpi_fn; - int lpi_line; -}; - /** * Printer function emitting messages through libcfs_debug_msg(). */ int lu_cdebug_printer(const struct lu_env *env, void *cookie, const char *format, ...); -#define DECLARE_LU_CDEBUG_PRINT_INFO(var, mask) \ - struct lu_cdebug_print_info var = { \ - .lpi_subsys = DEBUG_SUBSYSTEM, \ - .lpi_mask = (mask), \ - .lpi_file = __FILE__, \ - .lpi_fn = __FUNCTION__, \ - .lpi_line = __LINE__ \ - } - /** * Print object description followed by a user-supplied message. */ -#define LU_OBJECT_DEBUG(mask, env, object, format, ...) \ -do { \ - static DECLARE_LU_CDEBUG_PRINT_INFO(__info, mask); \ - \ - if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) { \ - lu_object_print(env, &__info, lu_cdebug_printer, object); \ - CDEBUG(mask, format , ## __VA_ARGS__); \ - } \ +#define LU_OBJECT_DEBUG(mask, env, object, format, ...) \ +do { \ + LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL); \ + \ + if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) { \ + lu_object_print(env, &msgdata, lu_cdebug_printer, object);\ + CDEBUG(mask, format , ## __VA_ARGS__); \ + } \ } while (0) /** @@ -791,12 +808,12 @@ do { \ */ #define LU_OBJECT_HEADER(mask, env, object, format, ...) \ do { \ - static DECLARE_LU_CDEBUG_PRINT_INFO(__info, mask); \ + LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL); \ \ if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) { \ - lu_object_header_print(env, &__info, lu_cdebug_printer, \ + lu_object_header_print(env, &msgdata, lu_cdebug_printer,\ (object)->lo_header); \ - lu_cdebug_printer(env, &__info, "\n"); \ + lu_cdebug_printer(env, &msgdata, "\n"); \ CDEBUG(mask, format , ## __VA_ARGS__); \ } \ } while (0) @@ -815,6 +832,7 @@ int lu_object_invariant(const struct lu_object *o); /** * \retval 1 iff object \a o exists on stable storage, + * \retval 0 iff object \a o not exists on stable storage. * \retval -1 iff object \a o is on remote server. */ static inline int lu_object_exists(const struct lu_object *o) @@ -934,6 +952,7 @@ struct lu_context { * from enum lu_context_tag. */ __u32 lc_tags; + enum lu_context_state lc_state; /** * Pointer to the home service thread. NULL for other execution * contexts. @@ -944,7 +963,6 @@ struct lu_context { * detail. */ void **lc_value; - enum lu_context_state lc_state; /** * Linkage into a list of all remembered contexts. Only * `non-transient' contexts, i.e., ones created for service threads @@ -988,7 +1006,18 @@ enum lu_context_tag { * a client. */ LCT_SESSION = 1 << 4, - + /** + * A per-request data on OSP device + */ + LCT_OSP_THREAD = 1 << 5, + /** + * MGS device thread + */ + LCT_MG_THREAD = 1 << 6, + /** + * Context for local operations + */ + LCT_LOCAL = 1 << 7, /** * Set when at least one of keys, having values in this context has * non-NULL lu_context_key::lct_exit() method. This is used to @@ -1218,6 +1247,14 @@ void lu_context_key_degister_many(struct lu_context_key *k, ...); void lu_context_key_revive_many (struct lu_context_key *k, ...); void lu_context_key_quiesce_many (struct lu_context_key *k, ...); +/* + * update/clear ctx/ses tags. + */ +void lu_context_tags_update(__u32 tags); +void lu_context_tags_clear(__u32 tags); +void lu_session_tags_update(__u32 tags); +void lu_session_tags_clear(__u32 tags); + /** * Environment. */ @@ -1235,6 +1272,7 @@ struct lu_env { int lu_env_init (struct lu_env *env, __u32 tags); void lu_env_fini (struct lu_env *env); int lu_env_refill(struct lu_env *env); +int lu_env_refill_by_tags(struct lu_env *env, __u32 ctags, __u32 stags); /** @} lu_context */ @@ -1299,5 +1337,8 @@ struct lu_kmem_descr { int lu_kmem_init(struct lu_kmem_descr *caches); void lu_kmem_fini(struct lu_kmem_descr *caches); +void lu_object_assign_fid(const struct lu_env *env, struct lu_object *o, + const struct lu_fid *fid); + /** @} lu */ #endif /* __LUSTRE_LU_OBJECT_H */