Whamcloud - gitweb
Clean out this change in my tree; don't install the liblustre file.
[fs/lustre-release.git] / lustre / liblustre / llite_lib.h
index 043be49..9a3b6cc 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Lustre Light Super operations
  *
- *  Copyright (c) 2002, 2003 Cluster File Systems, Inc.
+ *  Copyright (c) 2002-2004 Cluster File Systems, Inc.
  *
  *   This file is part of Lustre, http://www.lustre.org.
  *
 struct ll_file_data {
         struct obd_client_handle fd_mds_och;
         __u32 fd_flags;
+        struct lustre_handle fd_cwlockh;
+        unsigned long fd_gid;
 };
 
 struct llu_sb_info
 {
         struct obd_uuid         ll_sb_uuid;
-        struct obd_export      *ll_mdc_exp;
-        struct obd_export      *ll_osc_exp;
+        struct obd_export      *ll_md_exp;
+        struct obd_export      *ll_dt_exp;
         obd_id                  ll_rootino;
         int                     ll_flags;
         struct list_head        ll_conn_chain;
@@ -63,7 +65,7 @@ struct llu_sb_info
 
 struct llu_inode_info {
         struct llu_sb_info     *lli_sbi;
-        struct ll_fid           lli_fid;
+        struct lustre_id        lli_id;
 
         struct lov_stripe_md   *lli_smd;
         char                   *lli_symlink_name;
@@ -76,16 +78,14 @@ struct llu_inode_info {
 
         struct lookup_intent   *lli_it;
 
-        /* XXX workaround for libsysio unlink */
-        int                     lli_stale_flag;
         /* XXX workaround for libsysio readdir */
         loff_t                  lli_dir_pos;
 
-        /* in libsysio we have no chance to store data in file,
-         * so place it here. since it's possible that an file
-         * was opened several times without close, we track an
-         * open_count here */
+        /* in libsysio we have no chance to store data in file, so place it
+         * here. since it's possible that an file was opened several times
+         * without close, we track an open_count here */
         struct ll_file_data    *lli_file_data;
+        int                     lli_open_flags;
         int                     lli_open_count;
 
         /* stat FIXME not 64 bit clean */
@@ -98,38 +98,14 @@ struct llu_inode_info {
         dev_t                   lli_st_rdev;
         loff_t                  lli_st_size;
         unsigned int            lli_st_blksize;
-        unsigned int            lli_st_blocks;
+        unsigned long           lli_st_blocks;
         time_t                  lli_st_atime;
         time_t                  lli_st_mtime;
         time_t                  lli_st_ctime;
 
         /* not for stat, change it later */
-        int                    lli_st_flags;
-        unsigned long          lli_st_generation;
-};
-
-#define LLU_SYSIO_COOKIE_SIZE(x) \
-        (sizeof(struct llu_sysio_cookie) + \
-         sizeof(struct ll_async_page) * (x) + \
-         sizeof(struct page) * (x))
-
-struct llu_sysio_cookie {
-        struct obd_sync_io_container *lsc_osic;
-        struct inode           *lsc_inode;
-        int                     lsc_maxpages;
-        int                     lsc_npages;
-        struct ll_async_page   *lsc_llap;
-        struct page            *lsc_pages;
-        __u64                   lsc_rwcount;
-};
-
-/* XXX why uio.h haven't the definition? */
-#define MAX_IOVEC 32
-
-struct llu_sysio_callback_args
-{
-        int ncookies;
-        struct llu_sysio_cookie *cookies[MAX_IOVEC];
+        int                     lli_st_flags;
+        unsigned long           lli_st_generation;
 };
 
 static inline struct llu_sb_info *llu_fs2sbi(struct filesys *fs)
@@ -147,19 +123,19 @@ static inline struct llu_sb_info *llu_i2sbi(struct inode *inode)
         return llu_i2info(inode)->lli_sbi;
 }
 
-static inline struct obd_export *llu_i2obdexp(struct inode *inode)
+static inline struct obd_export *llu_i2dtexp(struct inode *inode)
 {
-        return llu_i2info(inode)->lli_sbi->ll_osc_exp;
+        return llu_i2info(inode)->lli_sbi->ll_dt_exp;
 }
 
-static inline struct obd_export *llu_i2mdcexp(struct inode *inode)
+static inline struct obd_export *llu_i2mdexp(struct inode *inode)
 {
-        return llu_i2info(inode)->lli_sbi->ll_mdc_exp;
+        return llu_i2info(inode)->lli_sbi->ll_md_exp;
 }
 
 static inline int llu_is_root_inode(struct inode *inode)
 {
-        return (llu_i2info(inode)->lli_fid.id ==
+        return (llu_i2info(inode)->lli_id.li_stc.u.e3s.l3s_ino ==
                 llu_i2info(inode)->lli_sbi->ll_rootino);
 }
 
@@ -189,54 +165,24 @@ do {                                                                           \
 #define LL_LOOKUP_POSITIVE 1
 #define LL_LOOKUP_NEGATIVE 2
 
-static inline void ll_inode2fid(struct ll_fid *fid, struct inode *inode)
-{
-        *fid = llu_i2info(inode)->lli_fid;
-}
-
 struct it_cb_data {
         struct inode *icbd_parent;
         struct pnode *icbd_child;
         obd_id hash;
 };
 
-static inline void ll_i2uctxt(struct ll_uctxt *ctxt, struct inode *i1,
-                              struct inode *i2)
+static inline void ll_inode2id(struct lustre_id *id,
+                               struct inode *inode)
 {
-        struct llu_inode_info *lli1 = llu_i2info(i1);
-        struct llu_inode_info *lli2;
-
-        LASSERT(i1);
-        LASSERT(ctxt);
-
-        if (in_group_p(lli1->lli_st_gid))
-                ctxt->gid1 = lli1->lli_st_gid;
-        else
-                ctxt->gid1 = -1;
-
-        if (i2) {
-               lli2 = llu_i2info(i2);
-                if (in_group_p(lli2->lli_st_gid))
-                        ctxt->gid2 = lli2->lli_st_gid;
-                else
-                        ctxt->gid2 = -1;
-        } else 
-                ctxt->gid2 = 0;
+        *id = llu_i2info(inode)->lli_id;
 }
 
-
 typedef int (*intent_finish_cb)(struct ptlrpc_request *,
                                 struct inode *parent, struct pnode *pnode, 
                                 struct lookup_intent *, int offset, obd_id ino);
 int llu_intent_lock(struct inode *parent, struct pnode *pnode,
                     struct lookup_intent *, int flags, intent_finish_cb);
 
-/* FIXME */
-static inline int ll_permission(struct inode *inode, int flag, void * unused)
-{
-        return 0;
-}
-
 static inline __u64 ll_file_maxbytes(struct inode *inode)
 {
         return llu_i2info(inode)->lli_maxbytes;
@@ -248,13 +194,15 @@ struct mount_option_s
         char *osc_uuid;
 };
 
+#define IS_BAD_PTR(ptr)         \
+        ((unsigned long)(ptr) == 0 || (unsigned long)(ptr) > -1000UL)
+
 /* llite_lib.c */
 void generate_random_uuid(unsigned char uuid_out[16]);
 int liblustre_process_log(struct config_llog_instance *cfg, int allow_recov);
 int ll_parse_mount_target(const char *target, char **mdsnid,
                           char **mdsname, char **profile);
 
-extern int     g_zconf;
 extern char   *g_zconf_mdsnid;
 extern char   *g_zconf_mdsname;
 extern char   *g_zconf_profile;
@@ -263,53 +211,41 @@ extern struct mount_option_s mount_option;
 /* super.c */
 void llu_update_inode(struct inode *inode, struct mds_body *body,
                       struct lov_stripe_md *lmm);
-void obdo_to_inode(struct inode *dst, struct obdo *src, obd_flag valid);
-void obdo_from_inode(struct obdo *dst, struct inode *src, obd_flag valid);
+void obdo_to_inode(struct inode *dst, struct obdo *src, obd_valid valid);
+void obdo_from_inode(struct obdo *dst, struct inode *src, obd_valid valid);
 int ll_it_open_error(int phase, struct lookup_intent *it);
 struct inode *llu_iget(struct filesys *fs, struct lustre_md *md);
 int llu_inode_getattr(struct inode *inode, struct lov_stripe_md *lsm);
+int llu_setattr_raw(struct inode *inode, struct iattr *attr);
 
 extern struct fssw_ops llu_fssw_ops;
 
 /* file.c */
-void llu_prepare_mdc_op_data(struct mdc_op_data *data,
-                             struct inode *i1,
-                             struct inode *i2,
-                             const char *name,
-                             int namelen,
-                             int mode);
+void llu_prepare_mdc_data(struct mdc_op_data *data, struct inode *i1,
+                          struct inode *i2, const char *name, int namelen,
+                          int mode);
+                          
 int llu_create(struct inode *dir, struct pnode_base *pnode, int mode);
 int llu_iop_open(struct pnode *pnode, int flags, mode_t mode);
 int llu_mdc_close(struct obd_export *mdc_exp, struct inode *inode);
 int llu_iop_close(struct inode *inode);
-int llu_iop_ipreadv(struct inode *ino, struct ioctx *ioctxp);
-int llu_iop_ipwritev(struct inode *ino, struct ioctx *ioctxp);
+_SYSIO_OFF_T llu_iop_pos(struct inode *ino, _SYSIO_OFF_T off);
 int llu_vmtruncate(struct inode * inode, loff_t offset);
-void obdo_refresh_inode(struct inode *dst, struct obdo *src, obd_flag valid);
+void obdo_refresh_inode(struct inode *dst, struct obdo *src, obd_valid valid);
 int llu_objects_destroy(struct ptlrpc_request *request, struct inode *dir);
 
 /* rw.c */
-int llu_iop_iodone(struct ioctx *ioctxp __IS_UNUSED);
-struct llu_sysio_callback_args*
-llu_file_write(struct inode *inode, const struct iovec *iovec,
-                      size_t iovlen, loff_t pos);
-struct llu_sysio_callback_args*
-llu_file_read(struct inode *inode, const struct iovec *iovec,
-                       size_t iovlen, loff_t pos);
-int llu_extent_lock_no_validate(struct ll_file_data *fd,
-                               struct inode *inode,
-                               struct lov_stripe_md *lsm,
-                               int mode,
-                               struct ldlm_extent *extent,
-                               struct lustre_handle *lockh,
-                               int ast_flags);
+int llu_iop_read(struct inode *ino, struct ioctx *ioctxp);
+int llu_iop_write(struct inode *ino, struct ioctx *ioctxp);
+int llu_iop_iodone(struct ioctx *ioctxp);
+int llu_glimpse_size(struct inode *inode);
 int llu_extent_lock(struct ll_file_data *fd, struct inode *inode,
-                   struct lov_stripe_md *lsm,
-                   int mode, struct ldlm_extent *extent,
-                   struct lustre_handle *lockh);
+                    struct lov_stripe_md *lsm, int mode,
+                    ldlm_policy_data_t *policy, struct lustre_handle *lockh,
+                    int ast_flags);
 int llu_extent_unlock(struct ll_file_data *fd, struct inode *inode,
-                struct lov_stripe_md *lsm, int mode,
-                struct lustre_handle *lockh);
+                      struct lov_stripe_md *lsm, int mode,
+                      struct lustre_handle *lockh);
 
 /* namei.c */
 int llu_iop_lookup(struct pnode *pnode,