1 --- linux-2.4.17/kernel/ksyms.c.lustre Fri Feb 22 15:26:38 2002
2 +++ linux-2.4.17/kernel/ksyms.c Fri Feb 22 15:27:44 2002
4 EXPORT_SYMBOL(lock_may_write);
5 EXPORT_SYMBOL(dcache_readdir);
8 +EXPORT_SYMBOL(pagecache_lock);
9 +EXPORT_SYMBOL(do_kern_mount);
12 /* for stackable file systems (lofs, wrapfs, cryptfs, etc.) */
13 EXPORT_SYMBOL(default_llseek);
14 EXPORT_SYMBOL(dentry_open);
15 --- linux-2.4.18/include/linux/errno.h Fri Feb 9 23:46:13 2001
16 +++ linux-2.4.18ea/include/linux/errno.h Sun Mar 24 23:39:31 2002
18 #define EBADTYPE 527 /* Type not supported by server */
19 #define EJUKEBOX 528 /* Request initiated, but will not complete before timeout */
21 +/* Defined for extended attributes */
22 +#define ENOATTR ENODATA /* No such attribute */
23 +#define ENOTSUP EOPNOTSUPP /* Operation not supported */
28 --- linux-2.4.17/include/linux/fs.h.lustre Fri Feb 22 15:27:53 2002
29 +++ linux-2.4.17/include/linux/fs.h Fri Feb 22 15:28:52 2002
31 int (*revalidate) (struct dentry *);
32 int (*setattr) (struct dentry *, struct iattr *);
33 int (*getattr) (struct dentry *, struct iattr *);
34 + int (*setxattr) (struct dentry *, const char *, void *, size_t, int);
35 + ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
36 + ssize_t (*listxattr) (struct dentry *, char *, size_t);
37 + int (*removexattr) (struct dentry *, const char *);
42 extern struct vfsmount *kern_mount(struct file_system_type *);
43 extern int may_umount(struct vfsmount *);
44 extern long do_mount(char *, char *, char *, unsigned long, void *);
46 +struct vfsmount *do_kern_mount(char *type, int flags, char *name, void *data);
47 #define kern_umount mntput
49 extern int vfs_statfs(struct super_block *, struct statfs *);
50 diff -Nur linux-2.4.18/include/linux/limits.h linux-2.4.18ea/include/linux/limits.h
51 --- linux-2.4.18/include/linux/limits.h Sun Feb 24 04:42:59 2002
52 +++ linux-2.4.18ea/include/linux/limits.h Sun Feb 24 04:34:48 2002
54 #define NAME_MAX 255 /* # chars in a file name */
55 #define PATH_MAX 4096 /* # chars in a path name including nul */
56 #define PIPE_BUF 4096 /* # bytes in atomic write to a pipe */
57 +#define XATTR_NAME_MAX 255 /* # chars in an extended attribute name */
58 +#define XATTR_SIZE_MAX 65536 /* size of an extended attribute value (64k) */
59 +#define XATTR_LIST_MAX 65536 /* size of extended attribute namelist (64k) */
63 --- linux-2.4.17/fs/ext3/Makefile.orig Fri Dec 21 10:41:55 2001
64 +++ linux-2.4.17/fs/ext3/Makefile Fri Mar 22 11:00:58 2002
66 # Note 2! The CFLAGS definitions are now in the main makefile...
70 +export-objs := super.o
72 obj-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
73 ioctl.o namei.o super.o symlink.o
74 --- linux-2.4.17/fs/ext3/super.c.orig Fri Dec 21 10:41:55 2001
75 +++ linux-2.4.17/fs/ext3/super.c Fri Mar 22 11:00:41 2002
77 unregister_filesystem(&ext3_fs_type);
81 +EXPORT_SYMBOL(ext3_bread);
83 MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
84 MODULE_DESCRIPTION("Second Extended Filesystem with journaling extensions");
85 --- lum/include/linux/blkdev.h.orig Thu Mar 28 11:40:24 2002
86 +++ lum/include/linux/blkdev.h Thu Mar 28 23:38:46 2002
91 +#define CONFIG_DEV_RDONLY
92 +void dev_set_rdonly(kdev_t, int);
93 +int dev_check_rdonly(kdev_t);
94 +void dev_clear_rdonly(int);
96 --- lum/drivers/block/blkpg.c.orig Sun Nov 11 11:20:21 2001
97 +++ lum/drivers/block/blkpg.c Thu Mar 28 16:30:41 2002
101 EXPORT_SYMBOL(blk_ioctl);
103 +#define NUM_DEV_NO_WRITE 16
104 +static int dev_no_write[NUM_DEV_NO_WRITE];
107 + * Debug code for turning block devices "read-only" (will discard writes
108 + * silently). This is for filesystem crash/recovery testing.
110 +void dev_set_rdonly(kdev_t dev, int no_write)
113 + printk(KERN_WARNING "Turning device %s read-only\n",
115 + dev_no_write[no_write] = 0xdead0000 + dev;
119 +int dev_check_rdonly(kdev_t dev) {
122 + for (i = 0; i < NUM_DEV_NO_WRITE; i++) {
123 + if ((dev_no_write[i] & 0xffff0000) == 0xdead0000 &&
124 + dev == (dev_no_write[i] & 0xffff))
130 +void dev_clear_rdonly(int no_write) {
131 + dev_no_write[no_write] = 0;
134 +EXPORT_SYMBOL(dev_set_rdonly);
135 +EXPORT_SYMBOL(dev_check_rdonly);
136 +EXPORT_SYMBOL(dev_clear_rdonly);
137 --- lum/drivers/block/loop.c.orig Fri Dec 21 10:41:53 2001
138 +++ lum/drivers/block/loop.c Thu Mar 28 23:39:25 2002
140 spin_unlock_irq(&lo->lo_lock);
143 +#ifdef CONFIG_DEV_RDONLY
144 + if (dev_check_rdonly(rbh->b_rdev))
148 if (lo->lo_flags & LO_FLAGS_READ_ONLY)
150 } else if (rw == READA) {
151 --- lum/drivers/ide/ide-disk.c.orig Fri Dec 21 10:41:54 2001
152 +++ lum/drivers/ide/ide-disk.c Thu Mar 28 23:38:41 2002
155 static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block)
157 +#ifdef CONFIG_DEV_RDONLY
158 + if (rq->cmd == WRITE && dev_check_rdonly(rq->rq_dev)) {
159 + ide_end_request(1, HWGROUP(drive));
160 + return ide_stopped;
164 OUT_BYTE(drive->ctl,IDE_CONTROL_REG);
165 OUT_BYTE(0x00, IDE_FEATURE_REG);
166 --- lum/include/linux/jbd.h.orig Tue Apr 16 14:27:25 2002
167 +++ lum/include/linux/jbd.h Wed Apr 24 05:19:00 2002
169 return bh->b_private;
172 +#define HAVE_JOURNAL_CALLBACK_STATUS
173 +struct journal_callback {
174 + struct list_head jcb_list;
175 + void (*jcb_func)(void *cb_data, int error);
176 + /* user data goes here */
179 struct jbd_revoke_table_s;
181 /* The handle_t type represents a single atomic update being performed
186 + /* List of application registered callbacks for this handle.
187 + * The function(s) will be called after the transaction that
188 + * this handle is part of has been committed to disk.
190 + struct list_head h_jcb;
193 unsigned int h_sync: 1; /* sync-on-close */
194 unsigned int h_jdata: 1; /* force data journaling */
197 /* How many handles used this transaction? */
200 + /* List of registered callback functions for this transaction.
201 + * Called when the transaction is committed. */
202 + struct list_head t_jcb;
207 extern int journal_try_to_free_buffers(journal_t *, struct page *, int);
208 extern int journal_stop(handle_t *);
209 extern int journal_flush (journal_t *);
210 +extern void journal_callback_set(handle_t *handle, void (*fn)(void *, int),
213 extern void journal_lock_updates (journal_t *);
214 extern void journal_unlock_updates (journal_t *);
215 --- lum/fs/jbd/commit.c.orig Fri Apr 12 10:27:52 2002
216 +++ lum/fs/jbd/commit.c Thu May 23 16:53:16 2002
218 transaction's t_log_list queue, and metadata buffers are on
219 the t_iobuf_list queue.
221 - Wait for the transactions in reverse order. That way we are
222 + Wait for the buffers in reverse order. That way we are
223 less likely to be woken up until all IOs have completed, and
224 so we incur less scheduling load.
228 jbd_debug(3, "JBD: commit phase 6\n");
230 - if (is_journal_aborted(journal))
231 + if (is_journal_aborted(journal)) {
232 + unlock_journal(journal);
236 /* Done it all: now write the commit record. We should have
237 * cleaned up our previous buffers by now, so if we are in abort
239 descriptor = journal_get_descriptor_buffer(journal);
241 __journal_abort_hard(journal);
242 + unlock_journal(journal);
247 /* AKPM: buglet - add `i' to tmp! */
248 for (i = 0; i < jh2bh(descriptor)->b_size; i += 512) {
249 journal_header_t *tmp =
251 put_bh(bh); /* One for getblk() */
252 journal_unlock_journal_head(descriptor);
254 - lock_journal(journal);
256 /* End of a transaction! Finally, we can do checkpoint
257 processing: any buffers committed as a result of this
262 + /* Call any callbacks that had been registered for handles in this
263 + * transaction. It is up to the callback to free any allocated
266 + if (!list_empty(&commit_transaction->t_jcb)) {
267 + struct list_head *p, *n;
268 + int error = is_journal_aborted(journal);
270 + list_for_each_safe(p, n, &commit_transaction->t_jcb) {
271 + struct journal_callback *jcb;
273 + jcb = list_entry(p, struct journal_callback, jcb_list);
275 + jcb->jcb_func(jcb, error);
279 + lock_journal(journal);
281 jbd_debug(3, "JBD: commit phase 7\n");
283 J_ASSERT(commit_transaction->t_sync_datalist == NULL);
284 --- lum/fs/jbd/journal.c.orig Fri Apr 12 10:27:52 2002
285 +++ lum/fs/jbd/journal.c Wed Apr 24 05:18:49 2002
288 EXPORT_SYMBOL(journal_flush);
289 EXPORT_SYMBOL(journal_revoke);
290 +EXPORT_SYMBOL(journal_callback_set);
292 EXPORT_SYMBOL(journal_init_dev);
293 EXPORT_SYMBOL(journal_init_inode);
294 --- lum/fs/jbd/transaction.c.orig Fri Apr 12 10:27:52 2002
295 +++ lum/fs/jbd/transaction.c Wed Apr 24 05:31:14 2002
297 transaction->t_state = T_RUNNING;
298 transaction->t_tid = journal->j_transaction_sequence++;
299 transaction->t_expires = jiffies + journal->j_commit_interval;
300 + INIT_LIST_HEAD(&transaction->t_jcb);
302 /* Set up the commit timer for the new transaction. */
303 J_ASSERT (!journal->j_commit_timer_active);
308 +/* Allocate a new handle. This should probably be in a slab... */
309 +static handle_t *get_handle(int nblocks)
311 + handle_t *handle = jbd_kmalloc(sizeof (handle_t), GFP_NOFS);
314 + memset(handle, 0, sizeof (handle_t));
315 + handle->h_buffer_credits = nblocks;
317 + INIT_LIST_HEAD(&handle->h_jcb);
323 * Obtain a new handle.
325 @@ -227,14 +242,11 @@
330 - handle = jbd_kmalloc(sizeof (handle_t), GFP_NOFS);
332 + handle = get_handle(nblocks);
334 return ERR_PTR(-ENOMEM);
335 - memset (handle, 0, sizeof (handle_t));
337 - handle->h_buffer_credits = nblocks;
339 current->journal_info = handle;
341 err = start_this_handle(journal, handle);
342 @@ -333,14 +345,11 @@
344 if (is_journal_aborted(journal))
345 return ERR_PTR(-EIO);
347 - handle = jbd_kmalloc(sizeof (handle_t), GFP_NOFS);
349 + handle = get_handle(nblocks);
351 return ERR_PTR(-ENOMEM);
352 - memset (handle, 0, sizeof (handle_t));
354 - handle->h_buffer_credits = nblocks;
356 current->journal_info = handle;
358 err = try_start_this_handle(journal, handle);
359 @@ -1328,6 +1337,29 @@
363 + * Register a callback function for this handle. The function will be
364 + * called when the transaction that this handle is part of has been
365 + * committed to disk with the original callback data struct and the
366 + * error status of the journal as parameters. There is no guarantee of
367 + * ordering between handles within a single transaction, nor between
368 + * callbacks registered on the same handle.
370 + * The caller is responsible for allocating the journal_callback struct.
371 + * This is to allow the caller to add as much extra data to the callback
372 + * as needed, but reduce the overhead of multiple allocations. The caller
373 + * allocated struct must start with a struct journal_callback at offset 0,
374 + * and has the caller-specific data afterwards.
376 +void journal_callback_set(handle_t *handle, void (*func)(void *, int),
379 + struct journal_callback *jcb = cb_data;
381 + list_add(&jcb->jcb_list, &handle->h_jcb);
382 + jcb->jcb_func = func;
386 * All done for a particular handle.
388 * There is not much action needed here. We just return any remaining
389 @@ -1393,7 +1423,10 @@
390 wake_up(&journal->j_wait_transaction_locked);
394 + /* Move callbacks from the handle to the transaction. */
395 + list_splice(&handle->h_jcb, &transaction->t_jcb);
398 * If the handle is marked SYNC, we need to set another commit
399 * going! We also want to force a commit if the current
400 * transaction is occupying too much of the log, or if the