1 /* object based disk file system
3 * This software is licensed under the GPL. See the file COPYING in the
4 * top directory of this distribution for details.
6 * Copyright (C), 1999, Stelias Computing Inc
14 #include <linux/obd_class.h>
15 #include <linux/list.h>
18 void obdfs_read_inode(struct inode *inode);
21 int flushd_init(void);
25 int obdfs_do_writepage(struct inode *, struct page *, int sync);
26 int obdfs_init_wreqcache(void);
27 void obdfs_cleanup_wreqcache(void);
28 int obdfs_readpage(struct dentry *dentry, struct page *page);
29 int obdfs_writepage(struct dentry *dentry, struct page *page);
30 struct page *obdfs_getpage(struct inode *inode, unsigned long offset, int create, int locked);
31 int obdfs_write_one_page(struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char * buf);
34 struct dentry *obdfs_lookup(struct inode * dir, struct dentry *dentry);
35 int obdfs_create (struct inode * dir, struct dentry * dentry, int mode);
36 int obdfs_mkdir(struct inode *dir, struct dentry *dentry, int mode);
37 int obdfs_rmdir(struct inode *dir, struct dentry *dentry);
38 int obdfs_unlink(struct inode *dir, struct dentry *dentry);
39 int obdfs_mknod(struct inode *dir, struct dentry *dentry, int mode, int rdev);
40 int obdfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname);
41 int obdfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry);
42 int obdfs_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry);
44 int obdfs_check_dir_entry (const char * function, struct inode * dir,
45 struct ext2_dir_entry_2 * de,
47 unsigned long offset);
49 int obdfs_readlink (struct dentry *, char *, int);
50 struct dentry *obdfs_follow_link(struct dentry *, struct dentry *, unsigned int);
52 struct obdfs_super_entry {
53 struct list_head sl_chain;
54 struct obdfs_sb_info *sbi;
58 struct list_head wb_list; /* linked list of req's */
59 struct inode *wb_inode; /* dentry referenced */
60 struct page *wb_page; /* page to be written */
63 struct obdfs_sb_info {
64 struct obd_conn osi_conn;
65 struct super_block *osi_super;
66 struct obd_device *osi_obd;
67 struct obd_ops *osi_ops;
68 ino_t osi_rootino; /* which root inode */
69 int osi_minor; /* minor of /dev/obdX */
70 struct list_head osi_list; /* linked list of inodes to write */
73 struct obdfs_inode_info {
75 struct list_head oi_list;
79 #define WB_NEXT(req) ((struct obdfs_wreq *) ((req)->wb_list.next))
80 /* XXX page list should go on each inode instead of supberblock */
81 #define OBD_LIST(inode) (((struct obdfs_sb_info *)(&(inode)->i_sb->u.generic_sbp))->osi_list)
82 #define WREQ(entry) (list_entry(entry, struct obdfs_wreq, wb_list))
84 void obdfs_sysctl_init(void);
85 void obdfs_sysctl_clean(void);
87 extern struct file_operations obdfs_file_operations;
88 extern struct inode_operations obdfs_file_inode_operations;
89 extern struct inode_operations obdfs_dir_inode_operations;
90 extern struct inode_operations obdfs_symlink_inode_operations;
92 static inline struct obd_ops *iops(struct inode *i)
94 struct obdfs_sb_info *sbi = (struct obdfs_sb_info *) &i->i_sb->u.generic_sbp;
98 static inline struct obd_conn *iid(struct inode *i)
100 struct obdfs_sb_info *sbi = (struct obdfs_sb_info *) &i->i_sb->u.generic_sbp;
101 return &sbi->osi_conn;
108 #warning "*** WARNING redefining OPS"
110 #define OPS(sb,op) ((struct obdfs_sb_info *)(& ## sb ## ->u.generic_sbp))->osi_ops->o_ ## op
111 #define IOPS(inode,op) ((struct obdfs_sb_info *)(& ## inode->i_sb ## ->u.generic_sbp))->osi_ops->o_ ## op
115 #warning "*** WARNING redefining ID"
117 #define ID(sb) (&((struct obdfs_sb_info *)( & ## sb ## ->u.generic_sbp))->osi_conn)
118 #define IID(inode) (&((struct obdfs_sb_info *)( & ## inode->i_sb ## ->u.generic_sbp))->osi_conn)
121 #define OBDFS_SUPER_MAGIC 0x4711