⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 llite_internal.h

📁 lustre 1.6.5 source code
💻 H
📖 第 1 页 / 共 3 页
字号:
char *ll_read_opt(const char *opt, char *data);void ll_lli_init(struct ll_inode_info *lli);int ll_fill_super(struct super_block *sb);void ll_put_super(struct super_block *sb);void ll_kill_super(struct super_block *sb);struct inode *ll_inode_from_lock(struct ldlm_lock *lock);void ll_clear_inode(struct inode *inode);int ll_setattr_raw(struct inode *inode, struct iattr *attr);int ll_setattr(struct dentry *de, struct iattr *attr);#ifndef HAVE_STATFS_DENTRY_PARAMint ll_statfs(struct super_block *sb, struct kstatfs *sfs);#elseint ll_statfs(struct dentry *de, struct kstatfs *sfs);#endifint ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs,                       __u64 max_age, __u32 flags);void ll_update_inode(struct inode *inode, struct lustre_md *md);void ll_read_inode2(struct inode *inode, void *opaque);int ll_iocontrol(struct inode *inode, struct file *file,                 unsigned int cmd, unsigned long arg);#ifdef HAVE_UMOUNTBEGIN_VFSMOUNTvoid ll_umount_begin(struct vfsmount *vfsmnt, int flags);#elsevoid ll_umount_begin(struct super_block *sb);#endifint ll_remount_fs(struct super_block *sb, int *flags, char *data);int ll_prep_inode(struct obd_export *exp, struct inode **inode,                  struct ptlrpc_request *req, int offset, struct super_block *);void lustre_dump_dentry(struct dentry *, int recur);void lustre_dump_inode(struct inode *);struct ll_async_page *llite_pglist_next_llap(struct ll_sb_info *sbi,                                             struct list_head *list);int ll_obd_statfs(struct inode *inode, void *arg);int ll_get_max_mdsize(struct ll_sb_info *sbi, int *max_mdsize);int ll_process_config(struct lustre_cfg *lcfg);/* llite/llite_nfs.c */extern struct export_operations lustre_export_operations;__u32 get_uuid2int(const char *name, int len);struct dentry *ll_fh_to_dentry(struct super_block *sb, __u32 *data, int len,                               int fhtype, int parent);int ll_dentry_to_fh(struct dentry *, __u32 *datap, int *lenp, int need_parent);/* llite/special.c */extern struct inode_operations ll_special_inode_operations;extern struct file_operations ll_special_chr_inode_fops;extern struct file_operations ll_special_chr_file_fops;extern struct file_operations ll_special_blk_inode_fops;extern struct file_operations ll_special_fifo_inode_fops;extern struct file_operations ll_special_fifo_file_fops;extern struct file_operations ll_special_sock_inode_fops;/* llite/symlink.c */extern struct inode_operations ll_fast_symlink_inode_operations;/* llite/llite_close.c */struct ll_close_queue {        spinlock_t              lcq_lock;        struct list_head        lcq_list;        wait_queue_head_t       lcq_waitq;        struct completion       lcq_comp;};#ifdef HAVE_CLOSE_THREADvoid llap_write_pending(struct inode *inode, struct ll_async_page *llap);void llap_write_complete(struct inode *inode, struct ll_async_page *llap);void ll_open_complete(struct inode *inode);int ll_is_inode_dirty(struct inode *inode);void ll_try_done_writing(struct inode *inode);void ll_queue_done_writing(struct inode *inode);#elsestatic inline void llap_write_pending(struct inode *inode,                                      struct ll_async_page *llap) { return; };static inline void llap_write_complete(struct inode *inode,                                       struct ll_async_page *llap) { return; };static inline void ll_open_complete(struct inode *inode) { return; };static inline int ll_is_inode_dirty(struct inode *inode) { return 0; };static inline void ll_try_done_writing(struct inode *inode) { return; };static inline void ll_queue_done_writing(struct inode *inode) { return; };//static inline void ll_close_thread_shutdown(struct ll_close_queue *lcq) { return; };//static inline int ll_close_thread_start(struct ll_close_queue **lcq_ret) { return 0; };#endifvoid ll_close_thread_shutdown(struct ll_close_queue *lcq);int ll_close_thread_start(struct ll_close_queue **lcq_ret);/* llite/llite_mmap.c */#if  (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))typedef struct rb_root  rb_root_t;typedef struct rb_node  rb_node_t;#endifstruct ll_lock_tree_node;struct ll_lock_tree {        rb_root_t                       lt_root;        struct list_head                lt_locked_list;        struct ll_file_data             *lt_fd;};int ll_teardown_mmaps(struct address_space *mapping, __u64 first, __u64 last);int ll_file_mmap(struct file * file, struct vm_area_struct * vma);struct ll_lock_tree_node * ll_node_from_inode(struct inode *inode, __u64 start,                                              __u64 end, ldlm_mode_t mode);int ll_tree_lock(struct ll_lock_tree *tree,                 struct ll_lock_tree_node *first_node,                 const char *buf, size_t count, int ast_flags);int ll_tree_lock_iov(struct ll_lock_tree *tree,                     struct ll_lock_tree_node *first_node,                     const struct iovec *iov, unsigned long nr_segs,                     int ast_flags);int ll_tree_unlock(struct ll_lock_tree *tree);#define    ll_s2sbi(sb)        (s2lsi(sb)->lsi_llsbi)#if  (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))static inline __u64 ll_ts2u64(struct timespec *time){        __u64 t = time->tv_sec;        return t;}#else  /* 2.4 here */static inline __u64 ll_ts2u64(time_t *time){        return *time;}#endif/* don't need an addref as the sb_info should be holding one */static inline struct obd_export *ll_s2obdexp(struct super_block *sb){        return ll_s2sbi(sb)->ll_osc_exp;}/* don't need an addref as the sb_info should be holding one */static inline struct obd_export *ll_s2mdcexp(struct super_block *sb){        return ll_s2sbi(sb)->ll_mdc_exp;}static inline struct client_obd *sbi2mdc(struct ll_sb_info *sbi){        struct obd_device *obd = sbi->ll_mdc_exp->exp_obd;        if (obd == NULL)                LBUG();        return &obd->u.cli;}// FIXME: replace the name of this with LL_SB to conform to kernel stuffstatic inline struct ll_sb_info *ll_i2sbi(struct inode *inode){        return ll_s2sbi(inode->i_sb);}static inline struct obd_export *ll_i2obdexp(struct inode *inode){        return ll_s2obdexp(inode->i_sb);}static inline struct obd_export *ll_i2mdcexp(struct inode *inode){        return ll_s2mdcexp(inode->i_sb);}static inline void ll_inode2fid(struct ll_fid *fid, struct inode *inode){        mdc_pack_fid(fid, inode->i_ino, inode->i_generation,                     inode->i_mode & S_IFMT);}static inline int ll_mds_max_easize(struct super_block *sb){        return sbi2mdc(ll_s2sbi(sb))->cl_max_mds_easize;}static inline __u64 ll_file_maxbytes(struct inode *inode){        return ll_i2info(inode)->lli_maxbytes;}/* llite/xattr.c */int ll_setxattr(struct dentry *dentry, const char *name,                const void *value, size_t size, int flags);ssize_t ll_getxattr(struct dentry *dentry, const char *name,                    void *buffer, size_t size);ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size);int ll_removexattr(struct dentry *dentry, const char *name);/* statahead.c */#define LL_SA_RPC_MIN   2#define LL_SA_RPC_DEF   32#define LL_SA_RPC_MAX   8192/* per inode struct, for dir only */struct ll_statahead_info {        struct inode           *sai_inode;        unsigned int            sai_generation; /* generation for statahead */        atomic_t                sai_refcount;   /* when access this struct, hold                                                 * refcount */        unsigned int            sai_sent;       /* stat requests sent count */        unsigned int            sai_replied;    /* stat requests which received                                                 * reply */        unsigned int            sai_max;        /* max ahead of lookup */        unsigned int            sai_index;      /* index of statahead entry */        unsigned int            sai_hit;        /* hit count */        unsigned int            sai_miss;       /* miss count:                                                 * for "ls -al" case, it includes                                                 * hidden dentry miss;                                                 * for "ls -l" case, it does not                                                 * include hidden dentry miss.                                                 * "sai_miss_hidden" is used for                                                 * the later case.                                                 */        unsigned int            sai_consecutive_miss; /* consecutive miss */        unsigned int            sai_miss_hidden;/* "ls -al", but first dentry                                                 * is not a hidden one */        unsigned int            sai_skip_hidden;/* skipped hidden dentry count */        unsigned int            sai_ls_all:1;   /* "ls -al", do stat-ahead for                                                 * hidden entries */        cfs_waitq_t             sai_waitq;      /* stat-ahead wait queue */        struct ptlrpc_thread    sai_thread;     /* stat-ahead thread */        struct list_head        sai_entries;    /* stat-ahead entries */};int do_statahead_enter(struct inode *dir, struct dentry **dentry, int lookup);void ll_statahead_exit(struct dentry *dentry, int result);void ll_stop_statahead(struct inode *inode, void *key);static inlinevoid ll_d_wakeup(struct dentry *dentry){        struct ll_dentry_data *lld = ll_d2d(dentry);        LASSERT(dentry->d_op != &ll_init_d_ops);        if (lld != NULL)                cfs_waitq_broadcast(&lld->lld_waitq);}static inlineint ll_statahead_enter(struct inode *dir, struct dentry **dentryp, int lookup){        struct ll_sb_info        *sbi = ll_i2sbi(dir);        struct ll_inode_info     *lli = ll_i2info(dir);        struct ll_dentry_data    *ldd = ll_d2d(*dentryp);        if (sbi->ll_sa_max == 0)                return -ENOTSUPP;        /* not the same process, don't statahead */        if (lli->lli_opendir_pid != cfs_curproc_pid())                return -EBADF;        /*         * When "ls" a dentry, the system trigger more than once "revalidate" or         * "lookup", for "getattr", for "getxattr", and maybe for others.         * Under patchless client mode, the operation intent is not accurate,         * it maybe misguide the statahead thread. For example:         * The "revalidate" call for "getattr" and "getxattr" of a dentry maybe         * have the same operation intent -- "IT_GETATTR".         * In fact, one dentry should has only one chance to interact with the         * statahead thread, otherwise the statahead windows will be confused.         * The solution is as following:         * Assign "lld_sa_generation" with "sai_generation" when a dentry         * "IT_GETATTR" for the first time, and the subsequent "IT_GETATTR"         * will bypass interacting with statahead thread for checking:         * "lld_sa_generation == lli_sai->sai_generation"         */         if (ldd && lli->lli_sai &&            ldd->lld_sa_generation == lli->lli_sai->sai_generation)                return -EAGAIN;        return do_statahead_enter(dir, dentryp, lookup);}/* llite ioctl register support rountine */#ifdef __KERNEL__enum llioc_iter {        LLIOC_CONT = 0,        LLIOC_STOP};#define LLIOC_MAX_CMD           256/* * Rules to write a callback function: * * Parameters: *  @magic: Dynamic ioctl call routine will feed this vaule with the pointer *      returned to ll_iocontrol_register.  Callback functions should use this *      data to check the potential collasion of ioctl cmd. If collasion is  *      found, callback function should return LLIOC_CONT. *  @rcp: The result of ioctl command. * *  Return values: *      If @magic matches the pointer returned by ll_iocontrol_data, the  *      callback should return LLIOC_STOP; return LLIOC_STOP otherwise. */typedef enum llioc_iter (*llioc_callback_t)(struct inode *inode,                 struct file *file, unsigned int cmd, unsigned long arg,                void *magic, int *rcp);enum llioc_iter ll_iocontrol_call(struct inode *inode, struct file *file,                 unsigned int cmd, unsigned long arg, int *rcp);/* export functions *//* Register ioctl block dynamatically for a regular file.  * * @cmd: the array of ioctl command set * @count: number of commands in the @cmd * @cb: callback function, it will be called if an ioctl command is found to  *      belong to the command list @cmd. * * Return vaule: *      A magic pointer will be returned if success;  *      otherwise, NULL will be returned.  * */void *ll_iocontrol_register(llioc_callback_t cb, int count, unsigned int *cmd);void ll_iocontrol_unregister(void *magic);#endif#endif /* LLITE_INTERNAL_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -