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 */
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
*/
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;
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);
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]);
}
return;
}
EXIT;
-}
+} /* obdfs_truncate */
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,
oa = obdo_alloc();
if ( !oa ) {
printk(__FUNCTION__ ": obdo_alloc failed\n");
+ EXIT;
return;
}
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 */
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 */