X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fosd-zfs%2Fosd_internal.h;h=44de8d78b950970c888d1ccd1dcd30161c620834;hp=540f2eca0cda21d1e7463c3c013da479c393c31f;hb=2acb75c36511aca9f30ca381562dc8f1ea451bd4;hpb=f1c56a55d453855f8fa57d5aded8800dfb53f060;ds=sidebyside diff --git a/lustre/osd-zfs/osd_internal.h b/lustre/osd-zfs/osd_internal.h index 540f2ec..44de8d7 100644 --- a/lustre/osd-zfs/osd_internal.h +++ b/lustre/osd-zfs/osd_internal.h @@ -28,7 +28,7 @@ * Use is subject to license terms. */ /* - * Copyright (c) 2011, 2012 Whamcloud, Inc. + * Copyright (c) 2012, Intel Corporation. * Use is subject to license terms. */ /* @@ -47,7 +47,7 @@ #define _OSD_INTERNAL_H #include -#include +#include #include #include @@ -76,12 +76,22 @@ struct osd_it_quota { /** * Iterator's in-memory data structure for ZAPs + * + * ZFS does not store . and .. on a disk, instead they are + * generated up on request + * to follow this format we do the same */ struct osd_zap_it { zap_cursor_t *ozi_zc; struct osd_object *ozi_obj; struct lustre_capa *ozi_capa; - unsigned ozi_reset:1; /* 1 -- no need to advance */ + unsigned ozi_reset:1; /* 1 -- no need to advance */ + /* ozi_pos - position of the cursor: + * 0 - before any record + * 1 - "." + * 2 - ".." + * 3 - real records */ + unsigned ozi_pos:3; union { char ozi_name[NAME_MAX + 1]; /* file name for dir */ __u64 ozi_key; /* binary key for index files */ @@ -147,12 +157,16 @@ struct osd_thread_info { char oti_str[64]; char oti_key[MAXNAMELEN + 1]; + struct lustre_mdt_attrs oti_mdt_attrs; struct lu_attr oti_la; struct osa_attr oti_osa; zap_attribute_t oti_za; dmu_object_info_t oti_doi; struct luz_direntry oti_zde; + + struct lquota_id_info oti_qi; + struct lu_seq_range oti_seq_range; }; extern struct lu_context_key osd_key; @@ -166,8 +180,9 @@ struct osd_thandle { struct thandle ot_super; cfs_list_t ot_dcb_list; cfs_list_t ot_sa_list; - cfs_semaphore_t ot_sa_lock; + struct semaphore ot_sa_lock; dmu_tx_t *ot_tx; + struct lquota_trans ot_quota_trans; __u32 ot_write_commit:1, ot_assigned:1; }; @@ -182,6 +197,19 @@ struct osd_oi { uint64_t oi_zapid; }; +struct osd_seq { + uint64_t *os_compat_dirs; + int os_subdir_count; /* subdir count for each seq */ + obd_seq os_seq; /* seq number */ + cfs_list_t os_seq_list; /* list to seq_list */ +}; + +struct osd_seq_list { + rwlock_t osl_seq_list_lock; /* lock for seq_list */ + cfs_list_t osl_seq_list; /* list head for seq */ + struct semaphore osl_seq_init_sem; +}; + #define OSD_OST_MAP_SIZE 32 /* @@ -208,10 +236,11 @@ struct osd_device { uint64_t od_root; struct osd_oi **od_oi_table; unsigned int od_oi_count; - uint64_t od_ost_compat_dirs[OSD_OST_MAP_SIZE]; - uint64_t od_ost_compat_grp0; + uint64_t od_ost_compat_grp0; + struct osd_seq_list od_seq_list; unsigned int od_rdonly:1, + od_xattr_in_sa:1, od_quota_iused_est:1; char od_mntdev[128]; char od_svname[128]; @@ -250,14 +279,14 @@ struct osd_object { nvlist_t *oo_sa_xattr; cfs_list_t oo_sa_linkage; - cfs_rw_semaphore_t oo_sem; + struct rw_semaphore oo_sem; /* cached attributes */ - cfs_rwlock_t oo_attr_lock; + rwlock_t oo_attr_lock; struct lu_attr oo_attr; /* protects extended attributes */ - cfs_semaphore_t oo_guard; + struct semaphore oo_guard; uint64_t oo_xattr; /* record size for index file */ @@ -268,6 +297,10 @@ int osd_statfs(const struct lu_env *, struct dt_device *, struct obd_statfs *); extern const struct dt_index_operations osd_acct_index_ops; uint64_t osd_quota_fid2dmu(const struct lu_fid *fid); extern struct lu_device_operations osd_lu_ops; +int osd_declare_quota(const struct lu_env *env, struct osd_device *osd, + qid_t uid, qid_t gid, long long space, + struct osd_thandle *oh, bool is_blk, int *flags, + bool force); /* * Helpers. @@ -325,6 +358,15 @@ static inline int osd_object_invariant(const struct lu_object *l) return osd_invariant(osd_obj(l)); } +static inline struct seq_server_site *osd_seq_site(struct osd_device *osd) +{ + return osd->od_dt_dev.dd_lu_dev.ld_site->ld_seq_site; +} + +static inline char *osd_name(struct osd_device *osd) +{ + return osd->od_dt_dev.dd_lu_dev.ld_obd->obd_name; +} #ifdef LPROCFS enum { @@ -402,6 +444,31 @@ int osd_xattr_del(const struct lu_env *env, struct dt_object *dt, struct lustre_capa *capa); int osd_xattr_list(const struct lu_env *env, struct dt_object *dt, struct lu_buf *lb, struct lustre_capa *capa); +void __osd_xattr_declare_set(const struct lu_env *env, struct osd_object *obj, + int vallen, const char *name, struct osd_thandle *oh); +int __osd_sa_xattr_set(const struct lu_env *env, struct osd_object *obj, + const struct lu_buf *buf, const char *name, int fl, + struct osd_thandle *oh);; +int __osd_xattr_set(const struct lu_env *env, struct osd_object *obj, + const struct lu_buf *buf, const char *name, int fl, + struct osd_thandle *oh); +static inline int +osd_xattr_set_internal(const struct lu_env *env, struct osd_object *obj, + const struct lu_buf *buf, const char *name, int fl, + struct osd_thandle *oh, struct lustre_capa *capa) +{ + int rc; + + if (osd_obj2dev(obj)->od_xattr_in_sa) { + rc = __osd_sa_xattr_set(env, obj, buf, name, fl, oh); + if (rc == -EFBIG) + rc = __osd_xattr_set(env, obj, buf, name, fl, oh); + } else { + rc = __osd_xattr_set(env, obj, buf, name, fl, oh); + } + + return rc; +} #endif #endif /* _OSD_INTERNAL_H */