From a86aaafa8f49c628e9d2f7d7f39fe5c81e2b73fc Mon Sep 17 00:00:00 2001 From: adilger Date: Thu, 9 Mar 2000 10:48:45 +0000 Subject: [PATCH] doc/OBD-HOWTO.sgml: updated references to attach types from *_obd to obd* and also mentioned autoloading of class modules. doc/obdspec.sgml: added paragraph on usage of o_valid when passing between class drivers, to ensure consistency of metadata in each driver. Updated punch definition. ext2obd/ext2_obd.c: ensure that this driver only returns o_valid flags for fields which it has set obdfs/flushd.c: ensure all pages are flushed at unmount time obdfs/super.c: fix fast symlinks (from 2.3.42) snap/snap.c: ensure we keep o_valid safe across method calls if required. Removed hacks which are resolved by proper o_valid handling in ext2obd. --- lustre/obdfs/flushd.c | 11 ++++++++--- lustre/obdfs/rw.c | 3 ++- lustre/obdfs/super.c | 29 ++++++++--------------------- 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/lustre/obdfs/flushd.c b/lustre/obdfs/flushd.c index ec6a1fc..588c7f8 100644 --- a/lustre/obdfs/flushd.c +++ b/lustre/obdfs/flushd.c @@ -148,7 +148,7 @@ void obdfs_dequeue_pages(struct inode *inode) int obdfs_flush_reqs(struct list_head *inode_list, unsigned long check_time) { struct list_head *tmp; - int total_io = 0; + unsigned long max_io, total_io = 0; obd_count num_io; obd_count num_obdos; struct inode *inodes[MAX_IOVEC]; /* write data back to these */ @@ -179,6 +179,10 @@ int obdfs_flush_reqs(struct list_head *inode_list, unsigned long check_time) return 0; } + /* If we are forcing a write, write out all dirty pages */ + max_io = check_time == ~0UL ? 1<<31 : pupd_prm.ndirty; + CDEBUG(D_INFO, "max_io = %lu\n", max_io); + /* Add each inode's dirty pages to a write vector, and write it. * Traverse list in reverse order, so we do FIFO, not LIFO order */ @@ -186,7 +190,7 @@ int obdfs_flush_reqs(struct list_head *inode_list, unsigned long check_time) tmp = inode_list; num_io = 0; num_obdos = 0; - while ( (tmp = tmp->prev) != inode_list && total_io < pupd_prm.ndirty) { + while ( (tmp = tmp->prev) != inode_list && total_io < max_io) { struct obdfs_inode_info *ii; struct inode *inode; int res; @@ -213,10 +217,11 @@ int obdfs_flush_reqs(struct list_head *inode_list, unsigned long check_time) if ( res < 0 ) { CDEBUG(D_INODE, "fatal: unable to enqueue inode %ld (err %d)\n", - inode->i_ino, err); + inode->i_ino, res); /* XXX Move bad inode to end of list so we can * continue with flushing list. This is a * temporary measure to avoid machine lockups. + * Maybe if we have -ENOENT, simply discard. */ list_del(tmp); list_add(tmp, inode_list); diff --git a/lustre/obdfs/rw.c b/lustre/obdfs/rw.c index 8eac82e..ce58fd6 100644 --- a/lustre/obdfs/rw.c +++ b/lustre/obdfs/rw.c @@ -228,6 +228,7 @@ int obdfs_do_vec_wr(struct inode **inodes, obd_count num_io, while ( num_obdos > 0) { --num_obdos; CDEBUG(D_INFO, "free obdo %ld\n",(long)obdos[num_obdos]->o_id); + /* copy o_blocks to i_blocks */ obdfs_to_inode(inodes[num_obdos], obdos[num_obdos]); obdo_free(obdos[num_obdos]); } @@ -480,4 +481,4 @@ void obdfs_truncate(struct inode *inode) return; } EXIT; -} +} /* obdfs_truncate */ diff --git a/lustre/obdfs/super.c b/lustre/obdfs/super.c index 87f76c2..191cb87 100644 --- a/lustre/obdfs/super.c +++ b/lustre/obdfs/super.c @@ -304,7 +304,9 @@ static void obdfs_read_inode(struct inode *inode) inode->i_op = &obdfs_dir_inode_operations; EXIT; } else if (S_ISLNK(inode->i_mode)) { - inode->i_op = &obdfs_symlink_inode_operations; + inode->i_op = inode->i_blocks + ?&obdfs_symlink_inode_operations + :&obdfs_fast_symlink_inode_operations; EXIT; } else { init_special_inode(inode, inode->i_mode, @@ -328,6 +330,7 @@ static void obdfs_write_inode(struct inode *inode) oa = obdo_alloc(); if ( !oa ) { printk(__FUNCTION__ ": obdo_alloc failed\n"); + EXIT; return; } @@ -335,18 +338,10 @@ static void obdfs_write_inode(struct inode *inode) obdfs_from_inode(oa, inode); err = IOPS(inode, setattr)(IID(inode), oa); - if ( err ) { + if ( err ) printk(__FUNCTION__ ": obd_setattr fails (%d)\n", err); - EXIT; - } else { - /* Copy back attributes from oa, as there may have been - * changes at the target (e.g. obdo becomes a redirector - * in the snapshot layer). - */ - obdfs_to_inode(inode, oa); - EXIT; - } + EXIT; obdo_free(oa); } /* obdfs_write_inode */ @@ -426,18 +421,10 @@ static int obdfs_notify_change(struct dentry *de, struct iattr *attr) obdo_from_iattr(oa, attr); err = IOPS(inode, setattr)(IID(inode), oa); - if ( err ) { + if ( err ) printk(__FUNCTION__ ": obd_setattr fails (%d)\n", err); - EXIT; - } else { - /* Copy back attributes from oa, as there may have been - * changes at the target (e.g. obdo becomes a redirector - * in the snapshot layer). - */ - obdfs_to_inode(inode, oa); - EXIT; - } + EXIT; obdo_free(oa); return err; } /* obdfs_notify_change */ -- 1.8.3.1