1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
5 #ifndef LLITE_INTERNAL_H
6 #define LLITE_INTERNAL_H
8 #ifdef CONFIG_FS_POSIX_ACL
11 # include <linux/xattr_acl.h>
13 #ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
14 # include <linux/posix_acl_xattr.h>
18 #include <lustre_debug.h>
19 #include <lustre_ver.h>
20 #include <linux/lustre_version.h>
21 #include <lustre_disk.h> /* for s2sbi */
24 struct lustre_intent_data {
25 __u64 it_lock_handle[2];
31 /* If there is no FMODE_EXEC defined, make it to match nothing */
36 #define LL_IT2STR(it) ((it) ? ldlm_it2str((it)->it_op) : "0")
37 #define LUSTRE_FPRIVATE(file) ((file)->private_data)
39 #ifdef LUSTRE_KERNEL_VERSION
40 static inline struct lookup_intent *ll_nd2it(struct nameidata *nd)
42 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
50 struct ll_dentry_data {
53 struct obd_client_handle lld_cwd_och;
54 struct obd_client_handle lld_mnt_och;
55 #ifndef LUSTRE_KERNEL_VERSION
56 struct lookup_intent *lld_it;
60 #define ll_d2d(de) ((struct ll_dentry_data*) de->d_fsdata)
62 extern struct file_operations ll_pgcache_seq_fops;
64 #define LLI_INODE_MAGIC 0x111d0de5
65 #define LLI_INODE_DEAD 0xdeadd00d
66 #define LLI_F_HAVE_OST_SIZE_LOCK 0
67 #define LLI_F_HAVE_MDS_SIZE_LOCK 1
69 struct ll_inode_info {
71 struct semaphore lli_size_sem;
72 void *lli_size_sem_owner;
73 struct semaphore lli_open_sem;
74 struct semaphore lli_write_sem;
75 struct lov_stripe_md *lli_smd;
76 char *lli_symlink_name;
79 unsigned long lli_flags;
81 /* this lock protects s_d_w and p_w_ll and mmap_cnt */
83 struct list_head lli_pending_write_llaps;
84 int lli_send_done_writing;
85 atomic_t lli_mmap_cnt;
87 struct list_head lli_close_item;
89 /* for writepage() only to communicate to fsync */
92 struct posix_acl *lli_posix_acl;
94 struct list_head lli_dead_list;
96 struct semaphore lli_och_sem; /* Protects access to och pointers
97 and their usage counters */
98 /* We need all three because every inode may be opened in different
100 struct obd_client_handle *lli_mds_read_och;
101 __u64 lli_open_fd_read_count;
102 struct obd_client_handle *lli_mds_write_och;
103 __u64 lli_open_fd_write_count;
104 struct obd_client_handle *lli_mds_exec_och;
105 __u64 lli_open_fd_exec_count;
107 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
108 struct inode lli_vfs_inode;
113 * Locking to guarantee consistency of non-atomic updates to long long i_size,
114 * consistency between file size and KMS, and consistency within
115 * ->lli_smd->lsm_oinfo[]'s.
117 * Implemented by ->lli_size_sem and ->lsm_sem, nested in that order.
120 void ll_inode_size_lock(struct inode *inode, int lock_lsm);
121 void ll_inode_size_unlock(struct inode *inode, int unlock_lsm);
123 // FIXME: replace the name of this with LL_I to conform to kernel stuff
124 // static inline struct ll_inode_info *LL_I(struct inode *inode)
125 static inline struct ll_inode_info *ll_i2info(struct inode *inode)
127 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
128 return container_of(inode, struct ll_inode_info, lli_vfs_inode);
130 return (struct ll_inode_info *)&(inode->u.generic_ip);
134 /* default to about 40meg of readahead on a given system. That much tied
135 * up in 512k readahead requests serviced at 40ms each is about 1GB/s. */
136 #define SBI_DEFAULT_READAHEAD_MAX (40UL << (20 - CFS_PAGE_SHIFT))
138 /* default to read-ahead full files smaller than 2MB on the second read */
139 #define SBI_DEFAULT_READAHEAD_WHOLE_MAX (2UL << (20 - CFS_PAGE_SHIFT))
144 RA_STAT_DISTANT_READPAGE,
145 RA_STAT_MISS_IN_WINDOW,
146 RA_STAT_FAILED_GRAB_PAGE,
147 RA_STAT_FAILED_MATCH,
152 RA_STAT_MAX_IN_FLIGHT,
153 RA_STAT_WRONG_GRAB_PAGE,
158 unsigned long ra_cur_pages;
159 unsigned long ra_max_pages;
160 unsigned long ra_max_read_ahead_whole_pages;
161 unsigned long ra_stats[_NR_RA_STAT];
164 /* LL_HIST_MAX=32 causes an overflow */
165 #define LL_HIST_MAX 28
166 #define LL_HIST_START 12 /* buckets start at 2^12 = 4k */
167 #define LL_PROCESS_HIST_MAX 10
168 struct per_process_info {
170 struct obd_histogram pp_r_hist;
171 struct obd_histogram pp_w_hist;
174 /* pp_extents[LL_PROCESS_HIST_MAX] will hold the combined process info */
175 struct ll_rw_extents_info {
176 struct per_process_info pp_extents[LL_PROCESS_HIST_MAX + 1];
179 #define LL_OFFSET_HIST_MAX 100
180 struct ll_rw_process_info {
183 loff_t rw_range_start;
185 loff_t rw_last_file_pos;
187 size_t rw_smallest_extent;
188 size_t rw_largest_extent;
189 struct file *rw_last_file;
209 VFS_OPS_INODE_PERMISSION,
213 enum vfs_track_type {
214 VFS_TRACK_ALL = 0, /* track all processes */
215 VFS_TRACK_PID, /* track process with this pid */
216 VFS_TRACK_PPID, /* track processes with this ppid */
217 VFS_TRACK_GID, /* track processes with this gid */
221 /* flags for sbi->ll_flags */
222 #define LL_SBI_NOLCK 0x01 /* DLM locking disabled (directio-only) */
223 #define LL_SBI_CHECKSUM 0x02 /* checksum each page as it's written */
224 #define LL_SBI_FLOCK 0x04
225 #define LL_SBI_USER_XATTR 0x08 /* support user xattr */
226 #define LL_SBI_ACL 0x10 /* support ACL */
227 #define LL_SBI_JOIN 0x20 /* support JOIN */
230 struct list_head ll_list;
231 /* this protects pglist and ra_info. It isn't safe to
232 * grab from interrupt contexts */
234 struct obd_uuid ll_sb_uuid;
235 struct obd_export *ll_mdc_exp;
236 struct obd_export *ll_osc_exp;
237 struct proc_dir_entry *ll_proc_root;
238 obd_id ll_rootino; /* number of root inode */
241 struct list_head ll_conn_chain; /* per-conn chain of SBs */
242 struct lustre_client_ocd ll_lco;
244 struct list_head ll_orphan_dentry_list; /*please don't ask -p*/
245 struct ll_close_queue *ll_lcq;
247 struct lprocfs_stats *ll_stats; /* lprocfs stats counter */
249 unsigned long ll_async_page_max;
250 unsigned long ll_async_page_count;
251 unsigned long ll_pglist_gen;
252 struct list_head ll_pglist; /* all pages (llap_pglist_item) */
254 struct ll_ra_info ll_ra_info;
255 unsigned int ll_namelen;
256 struct file_operations *ll_fop;
258 struct list_head ll_deathrow; /* inodes to be destroyed (b1443) */
259 spinlock_t ll_deathrow_lock;
260 /* =0 - hold lock over whole read/write
261 * >0 - max. chunk to be read/written w/o lock re-acquiring */
262 unsigned long ll_max_rw_chunk;
265 struct ll_rw_extents_info ll_rw_extents_info;
266 int ll_extent_process_count;
267 struct ll_rw_process_info ll_rw_process_info[LL_PROCESS_HIST_MAX];
268 unsigned int ll_offset_process_count;
269 struct ll_rw_process_info ll_rw_offset_info[LL_OFFSET_HIST_MAX];
270 unsigned int ll_rw_offset_entry_count;
271 struct lprocfs_stats *ll_vfs_ops_stats;
272 enum vfs_track_type ll_vfs_track_type;
276 #define LL_DEFAULT_MAX_RW_CHUNK (32 * 1024 * 1024)
281 struct task_struct *lrr_reader;
282 struct list_head lrr_linkage;
286 * per file-descriptor read-ahead data.
288 struct ll_readahead_state {
291 * index of the last page that read(2) needed and that wasn't in the
292 * cache. Used by ras_update() to detect seeks.
294 * XXX nikita: if access seeks into cached region, Lustre doesn't see
297 unsigned long ras_last_readpage;
299 * number of pages read after last read-ahead window reset. As window
300 * is reset on each seek, this is effectively a number of consecutive
301 * accesses. Maybe ->ras_accessed_in_window is better name.
303 * XXX nikita: window is also reset (by ras_update()) when Lustre
304 * believes that memory pressure evicts read-ahead pages. In that
305 * case, it probably doesn't make sense to expand window to
306 * PTLRPC_MAX_BRW_PAGES on the third access.
308 unsigned long ras_consecutive_pages;
310 * number of read requests after the last read-ahead window reset
311 * As window is reset on each seek, this is effectively the number
312 * on consecutive read request and is used to trigger read-ahead.
314 unsigned long ras_consecutive_requests;
316 * Parameters of current read-ahead window. Handled by
317 * ras_update(). On the initial access to the file or after a seek,
318 * window is reset to 0. After 3 consecutive accesses, window is
319 * expanded to PTLRPC_MAX_BRW_PAGES. Afterwards, window is enlarged by
320 * PTLRPC_MAX_BRW_PAGES chunks up to ->ra_max_pages.
322 unsigned long ras_window_start, ras_window_len;
324 * Where next read-ahead should start at. This lies within read-ahead
325 * window. Read-ahead window is read in pieces rather than at once
326 * because: 1. lustre limits total number of pages under read-ahead by
327 * ->ra_max_pages (see ll_ra_count_get()), 2. client cannot read pages
328 * not covered by DLM lock.
330 unsigned long ras_next_readahead;
332 * Total number of ll_file_read requests issued, reads originating
333 * due to mmap are not counted in this total. This value is used to
334 * trigger full file read-ahead after multiple reads to a small file.
336 unsigned long ras_requests;
338 * Page index with respect to the current request, these value
339 * will not be accurate when dealing with reads issued via mmap.
341 unsigned long ras_request_index;
343 * list of struct ll_ra_read's one per read(2) call current in
344 * progress against this file descriptor. Used by read-ahead code,
345 * protected by ->ras_lock.
347 struct list_head ras_read_beads;
350 extern kmem_cache_t *ll_file_data_slab;
351 struct lustre_handle;
352 struct ll_file_data {
353 struct ll_readahead_state fd_ras;
355 struct lustre_handle fd_cwlockh;
356 unsigned long fd_gid;
360 struct lov_stripe_md;
362 extern spinlock_t inode_lock;
364 extern struct proc_dir_entry *proc_lustre_fs_root;
366 static inline struct inode *ll_info2i(struct ll_inode_info *lli)
368 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
369 return &lli->lli_vfs_inode;
371 return list_entry(lli, struct inode, u.generic_ip);
376 struct inode *icbd_parent;
377 struct dentry **icbd_childp;
381 void ll_i2gids(__u32 *suppgids, struct inode *i1,struct inode *i2);
383 #define LLAP_MAGIC 98764321
385 extern kmem_cache_t *ll_async_page_slab;
386 extern size_t ll_async_page_slab_size;
387 struct ll_async_page {
389 /* only trust these if the page lock is providing exclusion */
390 unsigned int llap_write_queued:1,
391 llap_defer_uptodate:1,
396 struct page *llap_page;
397 struct list_head llap_pending_write;
398 struct list_head llap_pglist_item;
399 /* checksum for paranoid I/O debugging */
404 * enumeration of llap_from_page() call-sites. Used to export statistics in
405 * /proc/fs/lustre/llite/fsN/dump_page_cache.
408 LLAP_ORIGIN_UNKNOWN = 0,
409 LLAP_ORIGIN_READPAGE,
410 LLAP_ORIGIN_READAHEAD,
411 LLAP_ORIGIN_COMMIT_WRITE,
412 LLAP_ORIGIN_WRITEPAGE,
413 LLAP_ORIGIN_REMOVEPAGE,
416 extern char *llap_origins[];
418 #ifdef HAVE_REGISTER_CACHE
419 #define ll_register_cache(cache) register_cache(cache)
420 #define ll_unregister_cache(cache) unregister_cache(cache)
422 #define ll_register_cache(cache) do {} while (0)
423 #define ll_unregister_cache(cache) do {} while (0)
426 void ll_ra_read_in(struct file *f, struct ll_ra_read *rar);
427 void ll_ra_read_ex(struct file *f, struct ll_ra_read *rar);
428 struct ll_ra_read *ll_ra_read_get(struct file *f);
430 /* llite/lproc_llite.c */
432 int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
433 struct super_block *sb, char *osc, char *mdc);
434 void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi);
435 void ll_vfs_ops_tally(struct ll_sb_info *sbi, int op);
437 static inline int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
438 struct super_block *sb, char *osc, char *mdc){return 0;}
439 static inline void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi) {}
440 static void ll_vfs_ops_tally(struct ll_sb_info *sbi, int op) {}
445 extern struct file_operations ll_dir_operations;
446 extern struct inode_operations ll_dir_inode_operations;
449 int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir);
450 struct inode *ll_iget(struct super_block *sb, ino_t hash,
451 struct lustre_md *lic);
452 struct dentry *ll_find_alias(struct inode *, struct dentry *);
453 int ll_mdc_cancel_unused(struct lustre_handle *, struct inode *, int flags,
455 int ll_mdc_blocking_ast(struct ldlm_lock *, struct ldlm_lock_desc *,
456 void *data, int flag);
457 int ll_prepare_mdc_op_data(struct mdc_op_data *,
458 struct inode *i1, struct inode *i2,
459 const char *name, int namelen, int mode);
460 #ifndef LUSTRE_KERNEL_VERSION
461 struct lookup_intent *ll_convert_intent(struct open_intent *oit,
466 int ll_prepare_write(struct file *, struct page *, unsigned from, unsigned to);
467 int ll_commit_write(struct file *, struct page *, unsigned from, unsigned to);
468 int ll_writepage(struct page *page);
469 void ll_inode_fill_obdo(struct inode *inode, int cmd, struct obdo *oa);
470 int ll_ap_completion(void *data, int cmd, struct obdo *oa, int rc);
471 int llap_shrink_cache(struct ll_sb_info *sbi, int shrink_fraction);
472 extern struct cache_definition ll_cache_definition;
473 void ll_removepage(struct page *page);
474 int ll_readpage(struct file *file, struct page *page);
475 struct ll_async_page *llap_from_cookie(void *cookie);
476 struct ll_async_page *llap_cast_private(struct page *page);
477 void ll_readahead_init(struct inode *inode, struct ll_readahead_state *ras);
478 void ll_ra_accounting(struct ll_async_page *llap,struct address_space *mapping);
479 void ll_truncate(struct inode *inode);
480 int ll_sync_page_range(struct inode *, struct address_space *, loff_t, size_t);
483 extern struct file_operations ll_file_operations;
484 extern struct file_operations ll_file_operations_flock;
485 extern struct inode_operations ll_file_inode_operations;
486 extern int ll_inode_revalidate_it(struct dentry *, struct lookup_intent *);
487 extern int ll_have_md_lock(struct inode *inode, __u64 bits);
488 int ll_extent_lock(struct ll_file_data *, struct inode *,
489 struct lov_stripe_md *, int mode, ldlm_policy_data_t *,
490 struct lustre_handle *, int ast_flags);
491 int ll_extent_unlock(struct ll_file_data *, struct inode *,
492 struct lov_stripe_md *, int mode, struct lustre_handle *);
493 int ll_file_open(struct inode *inode, struct file *file);
494 int ll_file_release(struct inode *inode, struct file *file);
495 int ll_lsm_getattr(struct obd_export *, struct lov_stripe_md *, struct obdo *);
496 int ll_glimpse_ioctl(struct ll_sb_info *sbi,
497 struct lov_stripe_md *lsm, lstat_t *st);
498 int ll_glimpse_size(struct inode *inode, int ast_flags);
499 int ll_local_open(struct file *file,
500 struct lookup_intent *it, struct ll_file_data *fd,
501 struct obd_client_handle *och);
502 int ll_release_openhandle(struct dentry *, struct lookup_intent *);
503 int ll_mdc_close(struct obd_export *mdc_exp, struct inode *inode,
505 int ll_mdc_real_close(struct inode *inode, int flags);
506 extern void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid, struct file
507 *file, size_t count, int rw);
508 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
509 int ll_getattr_it(struct vfsmount *mnt, struct dentry *de,
510 struct lookup_intent *it, struct kstat *stat);
511 int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat);
513 struct ll_file_data *ll_file_data_get(void);
514 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
515 int ll_inode_permission(struct inode *inode, int mask, struct nameidata *nd);
517 int ll_inode_permission(struct inode *inode, int mask);
519 int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file,
520 int flags, struct lov_user_md *lum,
522 int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename,
523 struct lov_mds_md **lmm, int *lmm_size,
524 struct ptlrpc_request **request);
525 int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump);
526 int ll_dir_getstripe(struct inode *inode, struct lov_mds_md **lmm,
527 int *lmm_size, struct ptlrpc_request **request);
530 void ll_intent_drop_lock(struct lookup_intent *);
531 void ll_intent_release(struct lookup_intent *);
532 extern void ll_set_dd(struct dentry *de);
533 int ll_drop_dentry(struct dentry *dentry);
534 void ll_unhash_aliases(struct inode *);
535 void ll_frob_intent(struct lookup_intent **itp, struct lookup_intent *deft);
536 void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry);
537 int ll_dcompare(struct dentry *parent, struct qstr *d_name, struct qstr *name);
538 int revalidate_it_finish(struct ptlrpc_request *request, int offset,
539 struct lookup_intent *it, struct dentry *de);
541 /* llite/llite_lib.c */
542 extern struct super_operations lustre_super_operations;
544 char *ll_read_opt(const char *opt, char *data);
545 void ll_lli_init(struct ll_inode_info *lli);
546 int ll_fill_super(struct super_block *sb);
547 void ll_put_super(struct super_block *sb);
548 struct inode *ll_inode_from_lock(struct ldlm_lock *lock);
549 void ll_clear_inode(struct inode *inode);
550 int ll_setattr_raw(struct inode *inode, struct iattr *attr);
551 int ll_setattr(struct dentry *de, struct iattr *attr);
552 #ifndef HAVE_STATFS_DENTRY_PARAM
553 int ll_statfs(struct super_block *sb, struct kstatfs *sfs);
555 int ll_statfs(struct dentry *de, struct kstatfs *sfs);
557 int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs,
559 void ll_update_inode(struct inode *inode, struct lustre_md *md);
560 void ll_read_inode2(struct inode *inode, void *opaque);
561 int ll_iocontrol(struct inode *inode, struct file *file,
562 unsigned int cmd, unsigned long arg);
563 #ifdef HAVE_UMOUNTBEGIN_VFSMOUNT
564 void ll_umount_begin(struct vfsmount *vfsmnt, int flags);
566 void ll_umount_begin(struct super_block *sb);
568 int ll_remount_fs(struct super_block *sb, int *flags, char *data);
569 int ll_prep_inode(struct obd_export *exp, struct inode **inode,
570 struct ptlrpc_request *req, int offset, struct super_block *);
571 void lustre_dump_dentry(struct dentry *, int recur);
572 void lustre_dump_inode(struct inode *);
573 struct ll_async_page *llite_pglist_next_llap(struct ll_sb_info *sbi,
574 struct list_head *list);
575 int ll_obd_statfs(struct inode *inode, void *arg);
576 int ll_get_max_mdsize(struct ll_sb_info *sbi, int *max_mdsize);
577 int ll_process_config(struct lustre_cfg *lcfg);
579 /* llite/llite_nfs.c */
580 extern struct export_operations lustre_export_operations;
581 __u32 get_uuid2int(const char *name, int len);
582 struct dentry *ll_fh_to_dentry(struct super_block *sb, __u32 *data, int len,
583 int fhtype, int parent);
584 int ll_dentry_to_fh(struct dentry *, __u32 *datap, int *lenp, int need_parent);
586 /* llite/special.c */
587 extern struct inode_operations ll_special_inode_operations;
588 extern struct file_operations ll_special_chr_inode_fops;
589 extern struct file_operations ll_special_chr_file_fops;
590 extern struct file_operations ll_special_blk_inode_fops;
591 extern struct file_operations ll_special_fifo_inode_fops;
592 extern struct file_operations ll_special_fifo_file_fops;
593 extern struct file_operations ll_special_sock_inode_fops;
595 /* llite/symlink.c */
596 extern struct inode_operations ll_fast_symlink_inode_operations;
598 /* llite/llite_close.c */
599 struct ll_close_queue {
601 struct list_head lcq_list;
602 wait_queue_head_t lcq_waitq;
603 struct completion lcq_comp;
606 void llap_write_pending(struct inode *inode, struct ll_async_page *llap);
607 void llap_write_complete(struct inode *inode, struct ll_async_page *llap);
608 void ll_open_complete(struct inode *inode);
609 int ll_is_inode_dirty(struct inode *inode);
610 void ll_try_done_writing(struct inode *inode);
611 void ll_queue_done_writing(struct inode *inode);
612 void ll_close_thread_shutdown(struct ll_close_queue *lcq);
613 int ll_close_thread_start(struct ll_close_queue **lcq_ret);
615 /* llite/llite_mmap.c */
616 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
617 typedef struct rb_root rb_root_t;
618 typedef struct rb_node rb_node_t;
621 struct ll_lock_tree_node;
622 struct ll_lock_tree {
624 struct list_head lt_locked_list;
625 struct ll_file_data *lt_fd;
628 int ll_teardown_mmaps(struct address_space *mapping, __u64 first, __u64 last);
629 int ll_file_mmap(struct file * file, struct vm_area_struct * vma);
630 struct ll_lock_tree_node * ll_node_from_inode(struct inode *inode, __u64 start,
631 __u64 end, ldlm_mode_t mode);
632 int ll_tree_lock(struct ll_lock_tree *tree,
633 struct ll_lock_tree_node *first_node,
634 const char *buf, size_t count, int ast_flags);
635 int ll_tree_unlock(struct ll_lock_tree *tree);
637 #define ll_s2sbi(sb) (s2lsi(sb)->lsi_llsbi)
639 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
640 void __d_rehash(struct dentry * entry, int lock);
641 static inline __u64 ll_ts2u64(struct timespec *time)
643 __u64 t = time->tv_sec;
647 static inline __u64 ll_ts2u64(time_t *time)
653 /* don't need an addref as the sb_info should be holding one */
654 static inline struct obd_export *ll_s2obdexp(struct super_block *sb)
656 return ll_s2sbi(sb)->ll_osc_exp;
659 /* don't need an addref as the sb_info should be holding one */
660 static inline struct obd_export *ll_s2mdcexp(struct super_block *sb)
662 return ll_s2sbi(sb)->ll_mdc_exp;
665 static inline struct client_obd *sbi2mdc(struct ll_sb_info *sbi)
667 struct obd_device *obd = sbi->ll_mdc_exp->exp_obd;
673 // FIXME: replace the name of this with LL_SB to conform to kernel stuff
674 static inline struct ll_sb_info *ll_i2sbi(struct inode *inode)
676 return ll_s2sbi(inode->i_sb);
679 static inline struct obd_export *ll_i2obdexp(struct inode *inode)
681 return ll_s2obdexp(inode->i_sb);
684 static inline struct obd_export *ll_i2mdcexp(struct inode *inode)
686 return ll_s2mdcexp(inode->i_sb);
689 static inline void ll_inode2fid(struct ll_fid *fid, struct inode *inode)
691 mdc_pack_fid(fid, inode->i_ino, inode->i_generation,
692 inode->i_mode & S_IFMT);
695 static inline int ll_mds_max_easize(struct super_block *sb)
697 return sbi2mdc(ll_s2sbi(sb))->cl_max_mds_easize;
700 static inline __u64 ll_file_maxbytes(struct inode *inode)
702 return ll_i2info(inode)->lli_maxbytes;
706 int ll_setxattr(struct dentry *dentry, const char *name,
707 const void *value, size_t size, int flags);
708 ssize_t ll_getxattr(struct dentry *dentry, const char *name,
709 void *buffer, size_t size);
710 ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size);
711 int ll_removexattr(struct dentry *dentry, const char *name);
713 #endif /* LLITE_INTERNAL_H */