From 8246e7a04ddf06c8b62f0c8a9bf246a2c9843d74 Mon Sep 17 00:00:00 2001 From: adilger Date: Thu, 20 Jan 2000 18:58:56 +0000 Subject: [PATCH] ext2obd/ext2obd.c: fixed brw I/O to have array of iobufs, not pointer obdfs/super.c: add superblock to list of superblocks obdfs/flushd.c: use pupdated() to do page writes from superblock list --- lustre/include/linux/obd_class.h | 2 -- lustre/include/linux/obdfs.h | 5 +--- lustre/obdfs/flushd.c | 54 ++++++++++++++++++++++++++++------------ 3 files changed, 39 insertions(+), 22 deletions(-) diff --git a/lustre/include/linux/obd_class.h b/lustre/include/linux/obd_class.h index a189e57..4faa960 100644 --- a/lustre/include/linux/obd_class.h +++ b/lustre/include/linux/obd_class.h @@ -170,8 +170,6 @@ struct obd_ops { #define OBT(dev) dev->obd_type->typ_ops #define OBP(dev,op) dev->obd_type->typ_ops->o_ ## op -#define MAX_IOVEC 16 - /* * ======== OBD Metadata Support =========== diff --git a/lustre/include/linux/obdfs.h b/lustre/include/linux/obdfs.h index f4c8ea0..b142edb 100644 --- a/lustre/include/linux/obdfs.h +++ b/lustre/include/linux/obdfs.h @@ -52,10 +52,6 @@ struct dentry *obdfs_follow_link(struct dentry *, struct dentry *, unsigned int) /* list of all OBDFS super blocks */ struct list_head obdfs_super_list; -struct obdfs_super_entry { - struct list_head sl_chain; - struct obdfs_sb_info *sl_sbi; -}; struct obdfs_pgrq { struct list_head rq_ilist; /* linked list of req's */ @@ -88,6 +84,7 @@ struct obdfs_inode_info { char oi_inline[OBD_INLINESZ]; }; +#define MAX_IOVEC 16 static inline struct list_head *obdfs_ilist(struct inode *inode) { diff --git a/lustre/obdfs/flushd.c b/lustre/obdfs/flushd.c index 6b5de8e..8623434 100644 --- a/lustre/obdfs/flushd.c +++ b/lustre/obdfs/flushd.c @@ -57,6 +57,7 @@ int obdfs_flush_reqs(struct list_head *page_list, { struct list_head *tmp = page_list; obd_count num_io = 0; + struct inode *inode = NULL; struct obdo *oa = NULL; struct obdo *obdos[MAX_IOVEC]; struct page *pages[MAX_IOVEC]; @@ -66,10 +67,15 @@ int obdfs_flush_reqs(struct list_head *page_list, obd_flag flags[MAX_IOVEC]; int err = 0; int i; - struct inode *inode = NULL; ENTRY; + if (!page_list) { + CDEBUG(D_INODE, "no list\n"); + EXIT; + return 0; + } + if ( list_empty(page_list)) { CDEBUG(D_INODE, "list empty\n"); EXIT; @@ -82,13 +88,26 @@ int obdfs_flush_reqs(struct list_head *page_list, struct obdfs_pgrq *pgrq; struct page *page; - if ( flush_inode ) + if ( flush_inode ) pgrq = list_entry(tmp, struct obdfs_pgrq, rq_ilist); - else + else pgrq = list_entry(tmp, struct obdfs_pgrq, rq_slist); page = pgrq->rq_page; inode = pgrq->rq_inode; + if ( !inode ) { + CDEBUG(D_INODE, "no inode\n"); + EXIT; + return 0; + } + + if ( !page ) { + CDEBUG(D_INODE, "no page \n"); + EXIT; + return 0; + } + + if (check_time && pgrq->rq_jiffies > (jiffies - pupd_prm.age_buffer)) continue; @@ -116,7 +135,7 @@ int obdfs_flush_reqs(struct list_head *page_list, err = obdfs_do_vec_wr(inode->i_sb, &num_io, obdos, pages, bufs, counts, offsets, flags); - for (i=0 ; inext) != &obdfs_super_list ) { - struct obdfs_super_entry *entry = - list_entry(sl, struct obdfs_super_entry, sl_chain); - sbi = entry->sl_sbi; + struct obdfs_sb_info *sbi = + list_entry(sl, struct obdfs_sb_info, osi_list); /* walk write requests here, use the sb, check the time */ obdfs_flush_reqs(&sbi->osi_pages, 0, 1); } +#if 0 /* again, but now we wait for completion */ sl = &obdfs_super_list; while ( (sl = sl->next) != &obdfs_super_list ) { - struct obdfs_super_entry *entry = - list_entry(sl, struct obdfs_super_entry, sl_chain); - sbi = entry->sl_sbi; + struct obdfs_sb_info *sbi = + list_entry(sl, struct obdfs_sb_info, sl_chain); /* walk write requests here */ obdfs_flush_reqs(&sbi->osi_pages, 0, check_time); } +#endif } @@ -213,7 +231,7 @@ static int pupdate(void *unused) { stop_pupdate: tsk->state = TASK_STOPPED; - MOD_DEC_USE_COUNT; + /* MOD_DEC_USE_COUNT; */ printk("pupdated stopped...\n"); return 0; } @@ -243,8 +261,10 @@ static int pupdate(void *unused) int flushd_init(void) { - /* kernel_thread(bdflush, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND); */ - MOD_INC_USE_COUNT; + /* + kernel_thread(bdflush, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND); + */ + /* MOD_INC_USE_COUNT; */ kernel_thread(pupdate, NULL, 0); printk("flushd inited\n"); return 0; @@ -256,12 +276,14 @@ int flushd_cleanup(void) /* XXX Andreas, we will do this later, for now, you must kill - pupdated with a SIGSTOP from userland, before unloading obdfs.o + pupdated with a SIGTERM from userland, before unloading obdfs.o */ if (pupdated) { - /* send updated a STOP signal */ /* then let it run at least once, before continuing */ + /* XXX need to do something like this here: + send_sig(SIGTERM, current, 0); + */ 1; } -- 1.8.3.1