📄 llite_internal.h
字号:
unsigned long ras_last_readpage; /* * number of pages read after last read-ahead window reset. As window * is reset on each seek, this is effectively a number of consecutive * accesses. Maybe ->ras_accessed_in_window is better name. * * XXX nikita: window is also reset (by ras_update()) when Lustre * believes that memory pressure evicts read-ahead pages. In that * case, it probably doesn't make sense to expand window to * PTLRPC_MAX_BRW_PAGES on the third access. */ unsigned long ras_consecutive_pages; /* * number of read requests after the last read-ahead window reset * As window is reset on each seek, this is effectively the number * on consecutive read request and is used to trigger read-ahead. */ unsigned long ras_consecutive_requests; /* * Parameters of current read-ahead window. Handled by * ras_update(). On the initial access to the file or after a seek, * window is reset to 0. After 3 consecutive accesses, window is * expanded to PTLRPC_MAX_BRW_PAGES. Afterwards, window is enlarged by * PTLRPC_MAX_BRW_PAGES chunks up to ->ra_max_pages. */ unsigned long ras_window_start, ras_window_len; /* * Where next read-ahead should start at. This lies within read-ahead * window. Read-ahead window is read in pieces rather than at once * because: 1. lustre limits total number of pages under read-ahead by * ->ra_max_pages (see ll_ra_count_get()), 2. client cannot read pages * not covered by DLM lock. */ unsigned long ras_next_readahead; /* * Total number of ll_file_read requests issued, reads originating * due to mmap are not counted in this total. This value is used to * trigger full file read-ahead after multiple reads to a small file. */ unsigned long ras_requests; /* * Page index with respect to the current request, these value * will not be accurate when dealing with reads issued via mmap. */ unsigned long ras_request_index; /* * list of struct ll_ra_read's one per read(2) call current in * progress against this file descriptor. Used by read-ahead code, * protected by ->ras_lock. */ struct list_head ras_read_beads; /* * The following 3 items are used for detecting the stride I/O * mode. * In stride I/O mode, * ...............|-----data-----|****gap*****|--------|******|.... * offset |-stride_pages-|-stride_gap-| * ras_stride_offset = offset; * ras_stride_length = stride_pages + stride_gap; * ras_stride_pages = stride_pages; * Note: all these three items are counted by pages. */ unsigned long ras_stride_length; unsigned long ras_stride_pages; pgoff_t ras_stride_offset; /* * number of consecutive stride request count, and it is similar as * ras_consecutive_requests, but used for stride I/O mode. * Note: only more than 2 consecutive stride request are detected, * stride read-ahead will be enable */ unsigned long ras_consecutive_stride_requests;};extern cfs_mem_cache_t *ll_file_data_slab;struct lustre_handle;struct ll_file_data { struct ll_readahead_state fd_ras; int fd_omode; struct lustre_handle fd_cwlockh; unsigned long fd_gid; __u32 fd_flags;};struct lov_stripe_md;extern spinlock_t inode_lock;extern struct proc_dir_entry *proc_lustre_fs_root;static inline struct inode *ll_info2i(struct ll_inode_info *lli){#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) return &lli->lli_vfs_inode;#else return list_entry(lli, struct inode, u.generic_ip);#endif}struct it_cb_data { struct inode *icbd_parent; struct dentry **icbd_childp; obd_id hash;};void ll_i2gids(__u32 *suppgids, struct inode *i1,struct inode *i2);#define LLAP_MAGIC 98764321extern cfs_mem_cache_t *ll_async_page_slab;extern size_t ll_async_page_slab_size;struct ll_async_page { int llap_magic; /* only trust these if the page lock is providing exclusion */ unsigned int llap_write_queued:1, llap_defer_uptodate:1, llap_origin:3, llap_ra_used:1, llap_ignore_quota:1, llap_nocache:1, llap_lockless_io_page:1; void *llap_cookie; struct page *llap_page; struct list_head llap_pending_write; struct list_head llap_pglist_item; /* checksum for paranoid I/O debugging */ __u32 llap_checksum;};/* * enumeration of llap_from_page() call-sites. Used to export statistics in * /proc/fs/lustre/llite/fsN/dump_page_cache. */enum { LLAP_ORIGIN_UNKNOWN = 0, LLAP_ORIGIN_READPAGE, LLAP_ORIGIN_READAHEAD, LLAP_ORIGIN_COMMIT_WRITE, LLAP_ORIGIN_WRITEPAGE, LLAP_ORIGIN_REMOVEPAGE, LLAP_ORIGIN_LOCKLESS_IO, LLAP__ORIGIN_MAX,};extern char *llap_origins[];#ifdef HAVE_REGISTER_CACHE#define ll_register_cache(cache) register_cache(cache)#define ll_unregister_cache(cache) unregister_cache(cache)#else#define ll_register_cache(cache) do {} while (0)#define ll_unregister_cache(cache) do {} while (0)#endifvoid ll_ra_read_in(struct file *f, struct ll_ra_read *rar);void ll_ra_read_ex(struct file *f, struct ll_ra_read *rar);struct ll_ra_read *ll_ra_read_get(struct file *f);/* llite/lproc_llite.c */#ifdef LPROCFSint lprocfs_register_mountpoint(struct proc_dir_entry *parent, struct super_block *sb, char *osc, char *mdc);void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi);void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count);void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars);#elsestatic inline int lprocfs_register_mountpoint(struct proc_dir_entry *parent, struct super_block *sb, char *osc, char *mdc){return 0;}static inline void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi) {}static void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count) {}static void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars){ memset(lvars, 0, sizeof(*lvars));}#endif/* llite/dir.c */extern struct file_operations ll_dir_operations;extern struct inode_operations ll_dir_inode_operations;struct page *ll_get_dir_page(struct inode *dir, unsigned long n);/* * p is at least 6 bytes before the end of page */typedef struct ext2_dir_entry_2 ext2_dirent;static inline ext2_dirent *ext2_next_entry(ext2_dirent *p){ return (ext2_dirent *)((char*)p + le16_to_cpu(p->rec_len));}static inline unsignedext2_validate_entry(char *base, unsigned offset, unsigned mask){ ext2_dirent *de = (ext2_dirent*)(base + offset); ext2_dirent *p = (ext2_dirent*)(base + (offset&mask)); while ((char*)p < (char*)de) p = ext2_next_entry(p); return (char *)p - base;}static inline void ext2_put_page(struct page *page){ kunmap(page); page_cache_release(page);}static inline unsigned long dir_pages(struct inode *inode){ return (inode->i_size + CFS_PAGE_SIZE - 1) >> CFS_PAGE_SHIFT;}/* llite/namei.c */int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir);struct inode *ll_iget(struct super_block *sb, ino_t hash, struct lustre_md *lic);int ll_mdc_cancel_unused(struct lustre_handle *, struct inode *, int flags, void *opaque);int ll_mdc_blocking_ast(struct ldlm_lock *, struct ldlm_lock_desc *, void *data, int flag);int ll_prepare_mdc_op_data(struct mdc_op_data *, struct inode *i1, struct inode *i2, const char *name, int namelen, int mode, void *data);#ifndef HAVE_VFS_INTENT_PATCHESstruct lookup_intent *ll_convert_intent(struct open_intent *oit, int lookup_flags);#endifvoid ll_pin_extent_cb(void *data);int ll_page_removal_cb(void *data, int discard);int ll_extent_lock_cancel_cb(struct ldlm_lock *lock, struct ldlm_lock_desc *new, void *data, int flag);int lookup_it_finish(struct ptlrpc_request *request, int offset, struct lookup_intent *it, void *data);void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry);/* llite/rw.c */int ll_prepare_write(struct file *, struct page *, unsigned from, unsigned to);int ll_commit_write(struct file *, struct page *, unsigned from, unsigned to);int ll_writepage(struct page *page);void ll_inode_fill_obdo(struct inode *inode, int cmd, struct obdo *oa);int ll_ap_completion(void *data, int cmd, struct obdo *oa, int rc);int llap_shrink_cache(struct ll_sb_info *sbi, int shrink_fraction);extern struct cache_definition ll_cache_definition;void ll_removepage(struct page *page);int ll_readpage(struct file *file, struct page *page);struct ll_async_page *llap_cast_private(struct page *page);void ll_readahead_init(struct inode *inode, struct ll_readahead_state *ras);void ll_ra_accounting(struct ll_async_page *llap,struct address_space *mapping);void ll_truncate(struct inode *inode);int ll_file_punch(struct inode *, loff_t, int);ssize_t ll_file_lockless_io(struct file *, const struct iovec *, unsigned long, loff_t *, int, ssize_t);void ll_clear_file_contended(struct inode*);int ll_sync_page_range(struct inode *, struct address_space *, loff_t, size_t);/* llite/file.c */extern struct file_operations ll_file_operations;extern struct file_operations ll_file_operations_flock;extern struct file_operations ll_file_operations_noflock;extern struct inode_operations ll_file_inode_operations;extern int ll_inode_revalidate_it(struct dentry *, struct lookup_intent *);extern int ll_have_md_lock(struct inode *inode, __u64 bits);int ll_extent_lock(struct ll_file_data *, struct inode *, struct lov_stripe_md *, int mode, ldlm_policy_data_t *, struct lustre_handle *, int ast_flags);int ll_extent_unlock(struct ll_file_data *, struct inode *, struct lov_stripe_md *, int mode, struct lustre_handle *);int ll_file_open(struct inode *inode, struct file *file);int ll_file_release(struct inode *inode, struct file *file);int ll_lsm_getattr(struct obd_export *, struct lov_stripe_md *, struct obdo *);int ll_glimpse_ioctl(struct ll_sb_info *sbi, struct lov_stripe_md *lsm, lstat_t *st);int ll_glimpse_size(struct inode *inode, int ast_flags);int ll_local_open(struct file *file, struct lookup_intent *it, struct ll_file_data *fd, struct obd_client_handle *och);int ll_release_openhandle(struct dentry *, struct lookup_intent *);int ll_mdc_close(struct obd_export *mdc_exp, struct inode *inode, struct file *file);int ll_mdc_real_close(struct inode *inode, int flags);extern void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid, struct file *file, size_t count, int rw);#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))int ll_getattr_it(struct vfsmount *mnt, struct dentry *de, struct lookup_intent *it, struct kstat *stat);int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat);#endifstruct ll_file_data *ll_file_data_get(void);#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))int ll_inode_permission(struct inode *inode, int mask, struct nameidata *nd);#elseint ll_inode_permission(struct inode *inode, int mask);#endifint ll_lov_setstripe_ea_info(struct inode *inode, struct file *file, int flags, struct lov_user_md *lum, int lum_size);int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, struct lov_mds_md **lmm, int *lmm_size, struct ptlrpc_request **request);int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump, int set_default);int ll_dir_getstripe(struct inode *inode, struct lov_mds_md **lmm, int *lmm_size, struct ptlrpc_request **request);/* llite/dcache.c */extern struct dentry_operations ll_init_d_ops;extern struct dentry_operations ll_d_ops;extern struct dentry_operations ll_fini_d_ops;void ll_intent_drop_lock(struct lookup_intent *);void ll_intent_release(struct lookup_intent *);extern void ll_set_dd(struct dentry *de);int ll_drop_dentry(struct dentry *dentry);void ll_unhash_aliases(struct inode *);void ll_frob_intent(struct lookup_intent **itp, struct lookup_intent *deft);void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry);int ll_dcompare(struct dentry *parent, struct qstr *d_name, struct qstr *name);int revalidate_it_finish(struct ptlrpc_request *request, int offset, struct lookup_intent *it, struct dentry *de);/* llite/llite_lib.c */extern struct super_operations lustre_super_operations;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -