1 Considerations for an API between OBD's and OBDFS
8 struct super_operations {
9 void (*read_inode) (struct inode *);
10 void (*write_inode) (struct inode *);
11 void (*put_inode) (struct inode *);
12 void (*delete_inode) (struct inode *);
13 int (*notify_change) (struct dentry *, struct iattr *);
14 void (*put_super) (struct super_block *);
15 void (*write_super) (struct super_block *);
16 int (*statfs) (struct super_block *, struct statfs *, int);
17 * int (*remount_fs) (struct super_block *, int *, char *);
18 void (*clear_inode) (struct inode *);
19 * void (*umount_begin) (struct super_block *);
25 Called from function iget(ino, dev) - through get_new_inode.
26 Typically called only when a VFS inode is instantiated by FS, i.e.
27 upon lookup, create, mkdir, or upon mounting for the / inode.
29 - executed for new inodes and for existing inodes
30 - for new inodes, avoid traffic to disk
34 lookup("name in dir-inode")
36 get data from dir-inode;
37 find ino of "name" in this data;
40 ----> obd_getattr(obj-no = ino)
43 create("name in dir-inode")
45 get ino for name from pre-alloced obj-no's
46 ---> may call obd_prealloc_ids(hint)
50 ---> do not contact OBD, fill in from FS
52 change data from dir-inode, to contain ("name, ino");
55 mkdir("name in dir-inode")
62 struct obdfs_sb *sb = ... ;
63 obd_connect(dev, &sb->obdfs_conn_info);
65 iget(sb, sb->obdfs_conn_info->conn_ino);
72 struct obd_conn_info {
74 unsigned long conn_ino;
75 unsigned long conn_blocksize;
76 unsigned char conn_blocksize_bits;
84 if ( inode in inode_attr cache ) {
85 get_attr_from_cache(inode, &attr);
87 obd_getattr(conn_id, inode->i_ino, &attr);
90 inode_setattr(inode, &attr);
93 Write_inode is called from the bdflush (sync_dev) routines, through
94 write_inode, sync_inode, sync_list, sync_inodes etc:
96 void sync_dev(kdev_t dev)
101 sync_buffers(dev, 0);
104 * FIXME(eric) we need to sync the physical devices here.
105 * This is because some (scsi) controllers have huge amounts of
106 * cache onboard (hundreds of Mb), and we need to instruct
107 * them to commit all of the dirty memory to disk, and we should
108 * not return until this has happened.
110 * This would need to get implemented by going through the assorted
111 * layers so that each block major number can be synced, and this
112 * would call down into the upper and mid-layer scsi.
116 This sync_inodes function is responsible (for "block" disk file
117 systems) for copying the modified inode metadata into the buffer
118 cache. The sync_buffers call which follows sync_inodes is responsible
119 for writing back this meta data. For OBD's this is different.
121 I expect the following routine to be there:
123 sync_inode_pages(dev,0);
125 sync_inode_metadata(dev);
128 The statfs function should return simple summary information available
129 on the disk: %free, total space, etc. May require a new obd_command.
131 Similarly write_super would instruct the disk to commit any pending
132 data. This is called from do_unmount just before put_super (the
133 latter breaks down the vm super block structure).
136 - undo pre-allocated inode numbers
138 The disk itself also needs a cleanup function.
140 struct file_operations {
141 loff_t (*llseek) (struct file *, loff_t, int);
142 ssize_t (*read) (struct file *, char *, size_t, loff_t *);
143 ssize_t (*write) (struct file *, const char *, size_t, loff_t *);
144 int (*readdir) (struct file *, void *, filldir_t);
145 unsigned int (*poll) (struct file *, struct poll_table_struct *);
146 int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
147 int (*mmap) (struct file *, struct vm_area_struct *);
148 int (*open) (struct inode *, struct file *);
149 int (*flush) (struct file *);
150 int (*release) (struct inode *, struct file *);
151 int (*fsync) (struct file *, struct dentry *);
152 int (*fasync) (int, struct file *, int);
153 int (*check_media_change) (kdev_t dev);
154 int (*revalidate) (kdev_t dev);
155 int (*lock) (struct file *, int, struct file_lock *);
159 struct inode_operations {
160 struct file_operations * default_file_ops;
161 int (*create) (struct inode *,struct dentry *,int);
162 struct dentry * (*lookup) (struct inode *,struct dentry *);
163 int (*link) (struct dentry *,struct inode *,struct dentry *);
164 int (*unlink) (struct inode *,struct dentry *);
165 int (*symlink) (struct inode *,struct dentry *,const char *);
166 int (*mkdir) (struct inode *,struct dentry *,int);
167 int (*rmdir) (struct inode *,struct dentry *);
168 int (*mknod) (struct inode *,struct dentry *,int,int);
169 int (*rename) (struct inode *, struct dentry *,
170 struct inode *, struct dentry *);
171 int (*readlink) (struct dentry *, char *,int);
172 struct dentry * (*follow_link) (struct dentry *, struct dentry *, unsigned int);
174 * the order of these functions within the VFS template has been
175 * changed because SMP locking has changed: from now on all get_block,
176 * readpage, writepage and flushpage functions are supposed to do
177 * whatever locking they need to get proper SMP operation - for
178 * now in most cases this means a lock/unlock_kernel at entry/exit.
179 * [The new order is also slightly more logical :)]
182 * Generic block allocator exported by the lowlevel fs. All metadata
183 * details are handled by the lowlevel fs, all 'logical data content'
184 * details are handled by the highlevel block layer.
186 int (*get_block) (struct inode *, long, struct buffer_head *, int);
188 int (*readpage) (struct file *, struct page *);
189 int (*writepage) (struct file *, struct page *);
190 int (*flushpage) (struct inode *, struct page *, unsigned long);
192 void (*truncate) (struct inode *);
193 int (*permission) (struct inode *, int);
194 int (*smap) (struct inode *,int);
195 int (*revalidate) (struct dentry *);