Whamcloud - gitweb
- unland b_fid to HEAD
[fs/lustre-release.git] / lustre / mds / mds_internal.h
index 4c39219..3d4750e 100644 (file)
@@ -57,6 +57,45 @@ void lprocfs_free_mds_counters(struct lprocfs_stats *ptr);
         lprocfs_counter_incr(mds->mds_counters, opcode);
 #endif
 
+#ifdef __KERNEL__
+/* Open counts for files.  No longer atomic, must hold inode->i_sem */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
+# define mds_inode_oatomic(inode)    ((inode)->i_cindex)
+#else
+# define mds_inode_oatomic(inode)    ((inode)->i_attr_flags)
+#endif
+
+static inline int mds_orphan_open_count(struct inode *inode)
+{
+        LASSERT_MDS_ORPHAN_READ_LOCKED(inode);
+        return mds_inode_oatomic(inode);
+}
+
+static inline int mds_orphan_open_inc(struct inode *inode)
+{
+        LASSERT_MDS_ORPHAN_WRITE_LOCKED(inode);
+        return ++mds_inode_oatomic(inode);
+}
+
+static inline int mds_orphan_open_dec_test(struct inode *inode)
+{
+        LASSERT_MDS_ORPHAN_WRITE_LOCKED(inode);
+        return --mds_inode_oatomic(inode) == 0;
+}
+
+#define mds_inode_is_orphan(inode)  ((inode)->i_flags & 0x4000000)
+#define mds_inode_set_orphan(inode)                                     \
+do {                                                                    \
+        (inode)->i_flags |= 0x4000000;                                  \
+        CDEBUG(D_VFSTRACE, "setting orphan flag on inode %p\n", inode); \
+} while (0)
+#define mds_inode_unset_orphan(inode)                                      \
+do {                                                                       \
+        (inode)->i_flags &= ~(0x4000000);                                  \
+        CDEBUG(D_VFSTRACE, "removing orphan flag from inode %p\n", inode); \
+} while (0)
+#endif /* __KERNEL__ */
+
 /* mds/mds_reint.c */
 int enqueue_ordered_locks(struct obd_device *obd, struct ldlm_res_id *p1_res_id,
                           struct lustre_handle *p1_lockh, int p1_lock_mode,
@@ -77,18 +116,18 @@ int mds_get_parent_child_locked(struct obd_device *obd, struct mds_obd *mds,
                                 char *name, int namelen,
                                 struct lustre_handle *child_lockh,
                                 struct dentry **dchildp, int child_mode,
-                                __u64 child_lockpart, void* clone_info);
+                                __u64 child_lockpart);
 int mds_lock_new_child(struct obd_device *obd, struct inode *inode,
                        struct lustre_handle *child_lockh);
 
 /* mds/mds_lib.c */
+void groups_from_buffer(struct group_info *ginfo, __u32 *gids);
 int mds_update_unpack(struct ptlrpc_request *, int offset,
                       struct mds_update_record *);
+int mds_init_ucred(struct lvfs_ucred *ucred, struct mds_req_sec_desc *rsd);
+void mds_exit_ucred(struct lvfs_ucred *ucred);
 
 /* mds/mds_unlink_open.c */
-int mds_open_unlink_rename(struct mds_update_record *rec,
-                           struct obd_device *obd, struct dentry *dparent,
-                           struct dentry *dchild, void **handle);
 int mds_cleanup_orphans(struct obd_device *obd);
 
 
@@ -125,11 +164,12 @@ int mds_revalidate_lov_ea(struct obd_device *obd, struct inode *inode,
 int mds_query_write_access(struct inode *inode);
 int mds_open(struct mds_update_record *rec, int offset,
              struct ptlrpc_request *req, struct lustre_handle *);
-int mds_pin(struct ptlrpc_request *req);
-int mds_mfd_close(struct ptlrpc_request *req, struct obd_device *obd,
-                  struct mds_file_data *mfd, int unlink_orphan);
-int mds_close(struct ptlrpc_request *req);
-int mds_done_writing(struct ptlrpc_request *req);
+int mds_pin(struct ptlrpc_request *req, int offset);
+int mds_mfd_close(struct ptlrpc_request *req, int offset,
+                  struct obd_device *obd, struct mds_file_data *mfd,
+                  int unlink_orphan);
+int mds_close(struct ptlrpc_request *req, int offset);
+int mds_done_writing(struct ptlrpc_request *req, int offset);
 
 
 /* mds/mds_fs.c */
@@ -142,6 +182,8 @@ int mds_obd_destroy(struct obd_export *exp, struct obdo *oa,
                     struct lov_stripe_md *ea, struct obd_trans_info *oti);
 
 /* mds/handler.c */
+void mds_squash_root(struct mds_obd *mds, struct mds_req_sec_desc *rsd,
+                     ptl_nid_t *peernid);
 int mds_handle(struct ptlrpc_request *req);
 extern struct lvfs_callback_ops mds_lvfs_ops;
 int mds_lov_clean(struct obd_device *obd);
@@ -179,5 +221,19 @@ void mds_unlock_slave_objs(struct obd_device *, struct dentry *,
 int mds_lock_and_check_slave(int, struct ptlrpc_request *, struct lustre_handle *);
 int mds_convert_mea_ea(struct obd_device *, struct inode *, struct lov_mds_md *, int);
 
+/* mds_groups.c */
+int mds_group_hash_init(void);
+void mds_group_hash_cleanup(void);
+void mds_group_hash_flush_idle(void);
+int mds_allow_setgroups(void);
+
+extern char mds_getgroups_upcall[PATH_MAX];
+extern int mds_grp_hash_entry_expire;
+extern int mds_grp_hash_acquire_expire;
+
+struct mds_grp_hash *__mds_get_global_group_hash(void);
+struct mds_grp_hash_entry * mds_get_group_entry(struct mds_obd *mds, uid_t uid);
+void mds_put_group_entry(struct mds_obd *mds, struct mds_grp_hash_entry *entry);
+int mds_handle_group_downcall(int err, uid_t uid, __u32 ngroups, gid_t *groups);
 
 #endif /* _MDS_INTERNAL_H */