From a15962c58be39ae01b573b68ffb3857edf085726 Mon Sep 17 00:00:00 2001 From: eeb Date: Sun, 27 Jul 2003 02:39:00 +0000 Subject: [PATCH] * Merged b_devel updates --- lustre/include/linux/lustre_commit_confd.h | 2 +- .../patches/ext3-map_inode_page.patch | 2 + lustre/llite/llite_lib.c | 13 ++---- lustre/obdfilter/filter_internal.h | 6 +-- lustre/obdfilter/filter_io.c | 5 +- lustre/obdfilter/filter_log.c | 4 +- lustre/ptlrpc/recov_thread.c | 53 ++++++++-------------- 7 files changed, 31 insertions(+), 54 deletions(-) diff --git a/lustre/include/linux/lustre_commit_confd.h b/lustre/include/linux/lustre_commit_confd.h index 980e6ce..5a021a8 100644 --- a/lustre/include/linux/lustre_commit_confd.h +++ b/lustre/include/linux/lustre_commit_confd.h @@ -40,7 +40,7 @@ struct llog_commit_master { struct list_head lcm_thread_idle; /* list of idle daemons */ spinlock_t lcm_thread_lock; /* protects thread_list */ atomic_t lcm_thread_numidle;/* number of idle threads */ - atomic_t lcm_thread_total; /* total number of threads */ + int lcm_thread_total; /* total number of threads */ int lcm_thread_max; /* <= num_osts normally */ int lcm_flags; diff --git a/lustre/kernel_patches/patches/ext3-map_inode_page.patch b/lustre/kernel_patches/patches/ext3-map_inode_page.patch index 80f14de..c9b7c15 100644 --- a/lustre/kernel_patches/patches/ext3-map_inode_page.patch +++ b/lustre/kernel_patches/patches/ext3-map_inode_page.patch @@ -82,3 +82,5 @@ EXPORT_SYMBOL(ext3_xattr_set); EXPORT_SYMBOL(ext3_prep_san_write); +EXPORT_SYMBOL(ext3_map_inode_page); + +_ diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index e64c5da..82392f1 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -582,15 +582,15 @@ int ll_setattr_raw(struct inode *inode, struct iattr *attr) } /* We mark all of the fields "set" so MDS/OST does not re-set them */ - if (attr->ia_valid & ATTR_CTIME) { + if (ia_valid & ATTR_CTIME) { attr->ia_ctime = now; attr->ia_valid |= ATTR_CTIME_SET; } - if (!(ia_valid & ATTR_ATIME_SET) && (attr->ia_valid & ATTR_ATIME)) { + if (!(ia_valid & ATTR_ATIME_SET) && (ia_valid & ATTR_ATIME)) { attr->ia_atime = now; attr->ia_valid |= ATTR_ATIME_SET; } - if (!(ia_valid & ATTR_MTIME_SET) && (attr->ia_valid & ATTR_MTIME)) { + if (!(ia_valid & ATTR_MTIME_SET) && (ia_valid & ATTR_MTIME)) { attr->ia_mtime = now; attr->ia_valid |= ATTR_MTIME_SET; } @@ -922,16 +922,11 @@ void ll_umount_begin(struct super_block *sb) struct ll_sb_info *sbi = ll_s2sbi(sb); struct obd_device *obd; struct obd_ioctl_data ioc_data = { 0 }; + ENTRY; CDEBUG(D_VFSTRACE, "VFS Op:\n"); obd = class_conn2obd(&sbi->ll_mdc_conn); - if (obd == NULL) { - CERROR("Invalid MDC connection handle "LPX64"\n", - sbi->ll_mdc_conn.cookie); - EXIT; - return; - } obd->obd_no_recov = 1; obd_iocontrol(IOC_OSC_SET_ACTIVE, &sbi->ll_mdc_conn, sizeof ioc_data, &ioc_data, NULL); diff --git a/lustre/obdfilter/filter_internal.h b/lustre/obdfilter/filter_internal.h index 4207056..b93777a 100644 --- a/lustre/obdfilter/filter_internal.h +++ b/lustre/obdfilter/filter_internal.h @@ -112,8 +112,8 @@ struct dentry *filter_parent_lock(struct obd_device *, obd_mode mode, void f_dput(struct dentry *); struct dentry *filter_fid2dentry(struct obd_device *, struct dentry *dir, obd_mode mode, obd_id id); -struct dentry *__filter_oa2dentry(struct obd_device *obd, struct obdo *oa, - const char *what); +struct dentry *__filter_oa2dentry(struct obd_device *obd,struct obdo *oa, + char *what); #define filter_oa2dentry(obd, oa) __filter_oa2dentry(obd, oa, __FUNCTION__) int filter_finish_transno(struct obd_export *, struct obd_trans_info *, int rc); @@ -141,8 +141,6 @@ int filter_log_op_create(struct llog_handle *cathandle, struct ll_fid *mds_fid, obd_id oid, obd_count ogen, struct llog_cookie *); int filter_log_op_orphan(struct llog_handle *cathandle, obd_id oid, obd_count ogen, struct llog_cookie *); -struct llog_handle *filter_get_catalog(struct obd_device *); -void filter_put_catalog(struct llog_handle *cathandle); /* filter_san.c */ int filter_san_setup(struct obd_device *obd, obd_count len, void *buf); diff --git a/lustre/obdfilter/filter_io.c b/lustre/obdfilter/filter_io.c index 1526295..17f4506 100644 --- a/lustre/obdfilter/filter_io.c +++ b/lustre/obdfilter/filter_io.c @@ -164,9 +164,8 @@ static int lustre_commit_write(struct niobuf_local *lnb) LASSERT(to <= PAGE_SIZE); err = page->mapping->a_ops->commit_write(NULL, page, from, to); -#warning 2.4 folks: wait_on_page_locked does NOT return its error here. if (!err && IS_SYNC(inode)) - wait_on_page_locked(page); + err = wait_on_page_locked(page); //SetPageUptodate(page); // the client commit_write will do this SetPageReferenced(page); @@ -192,7 +191,7 @@ int filter_get_page_write(struct inode *inode, struct niobuf_local *lnb, /* This page is currently locked, so get a temporary page instead. */ if (page == NULL) { - CDEBUG(D_INFO, "ino %lu page %ld locked\n", inode->i_ino,index); + CDEBUG(D_ERROR,"ino %lu page %ld locked\n", inode->i_ino,index); page = alloc_pages(GFP_KERNEL, 0); /* locked page */ if (page == NULL) { CERROR("no memory for a temp page\n"); diff --git a/lustre/obdfilter/filter_log.c b/lustre/obdfilter/filter_log.c index d91e1e8..0c9a984 100644 --- a/lustre/obdfilter/filter_log.c +++ b/lustre/obdfilter/filter_log.c @@ -234,7 +234,7 @@ out_ctxt: } /* This is called from filter_setup() and should be single threaded */ -struct llog_handle *filter_get_catalog(struct obd_device *obd) +static struct llog_handle *filter_get_catalog(struct obd_device *obd) { struct filter_obd *filter = &obd->u.filter; struct filter_server_data *fsd = filter->fo_fsd; @@ -292,7 +292,7 @@ out_handle: goto out; } -void filter_put_catalog(struct llog_handle *cathandle) +static void filter_put_catalog(struct llog_handle *cathandle) { struct llog_handle *loghandle, *n; int rc; diff --git a/lustre/ptlrpc/recov_thread.c b/lustre/ptlrpc/recov_thread.c index 45cda95..95b4151 100644 --- a/lustre/ptlrpc/recov_thread.c +++ b/lustre/ptlrpc/recov_thread.c @@ -33,8 +33,8 @@ #endif #ifndef __KERNEL__ -# include -# include +#include +#include #endif #include #include @@ -47,6 +47,7 @@ #include #include "ptlrpc_internal.h" + static struct llog_commit_master lustre_lcm; static struct llog_commit_master *lcm = &lustre_lcm; @@ -125,12 +126,15 @@ static int log_commit_thread(void *arg) struct llog_commit_daemon *lcd; struct llog_commit_data *llcd, *n; unsigned long flags; - ENTRY; OBD_ALLOC(lcd, sizeof(*lcd)); if (lcd == NULL) RETURN(-ENOMEM); + INIT_LIST_HEAD(&lcd->lcd_lcm_list); + INIT_LIST_HEAD(&lcd->lcd_llcd_list); + lcd->lcd_lcm = lcm; + lock_kernel(); ptlrpc_daemonize(); /* thread never needs to do IO */ @@ -140,16 +144,10 @@ static int log_commit_thread(void *arg) SIGNAL_MASK_UNLOCK(current, flags); spin_lock(&lcm->lcm_thread_lock); - THREAD_NAME(current->comm, "ll_log_commit_%d", - atomic_read(&lcm->lcm_thread_total)); - atomic_inc(&lcm->lcm_thread_total); + THREAD_NAME(current->comm, "ll_log_commit_%d", lcm->lcm_thread_total++); spin_unlock(&lcm->lcm_thread_lock); unlock_kernel(); - INIT_LIST_HEAD(&lcd->lcd_lcm_list); - INIT_LIST_HEAD(&lcd->lcd_llcd_list); - lcd->lcd_lcm = lcm; - CDEBUG(D_HA, "%s started\n", current->comm); do { struct ptlrpc_request *request; @@ -174,7 +172,8 @@ static int log_commit_thread(void *arg) lcm->lcm_flags & LLOG_LCM_FL_EXIT); /* If we are the last available thread, start a new one in case - * we get blocked on an RPC (nobody else will start a new one)*/ + * we get blocked on an RPC (nobody else will start a new one). + */ spin_lock(&lcm->lcm_thread_lock); atomic_dec(&lcm->lcm_thread_numidle); list_move(&lcd->lcd_lcm_list, &lcm->lcm_thread_busy); @@ -193,7 +192,7 @@ static int log_commit_thread(void *arg) } if (atomic_read(&lcm->lcm_thread_numidle) <= 1 && - atomic_read(&lcm->lcm_thread_total) < lcm->lcm_thread_max) { + lcm->lcm_thread_total < lcm->lcm_thread_max) { rc = llog_start_commit_thread(); if (rc < 0) CERROR("error starting thread: rc %d\n", rc); @@ -201,7 +200,8 @@ static int log_commit_thread(void *arg) /* Move all of the pending cancels from the same OST off of * the list, so we don't get multiple threads blocked and/or - * doing upcalls on the same OST in case of failure. */ + * doing upcalls on the same OST in case of failure. + */ spin_lock(&lcm->lcm_llcd_lock); if (!list_empty(sending_list)) { list_move_tail(sending_list->next, @@ -289,7 +289,7 @@ static int log_commit_thread(void *arg) /* If we are force exiting, just drop all of the cookies. */ if (lcm->lcm_flags & LLOG_LCM_FL_EXIT_FORCE) { spin_lock(&lcm->lcm_llcd_lock); - list_splice(&lcm->lcm_llcd_pending, &lcd->lcd_llcd_list); + list_splice(&lcm->lcm_llcd_pending,&lcd->lcd_llcd_list); list_splice(&lcm->lcm_llcd_resend, &lcd->lcd_llcd_list); list_splice(&lcm->lcm_llcd_free, &lcd->lcd_llcd_list); spin_unlock(&lcm->lcm_llcd_lock); @@ -298,14 +298,8 @@ static int log_commit_thread(void *arg) llcd_put(llcd); } - OBD_FREE(lcd, sizeof(*lcd)); - - spin_lock(&lcm->lcm_thread_lock); - atomic_dec(&lcm->lcm_thread_total); - spin_unlock(&lcm->lcm_thread_lock); - wake_up(&lcm->lcm_waitq); - CDEBUG(D_HA, "%s exiting\n", current->comm); + OBD_FREE(lcd, sizeof(*lcd)); return 0; } @@ -314,13 +308,10 @@ int llog_start_commit_thread(void) int rc; ENTRY; - if (atomic_read(&lcm->lcm_thread_total) >= lcm->lcm_thread_max) - RETURN(0); - rc = kernel_thread(log_commit_thread, lcm, CLONE_VM | CLONE_FILES); if (rc < 0) { - CERROR("error starting thread #%d: %d\n", - atomic_read(&lcm->lcm_thread_total), rc); + CERROR("error starting thread #%d: %d\n", lcm->lcm_thread_total, + rc); RETURN(rc); } @@ -341,18 +332,10 @@ int llog_init_commit_master(void) spin_lock_init(&lcm->lcm_llcd_lock); atomic_set(&lcm->lcm_llcd_numfree, 0); lcm->lcm_llcd_minfree = 0; - lcm->lcm_thread_max = 5; return 0; } -int llog_cleanup_commit_master(int force) +int llog_cleanup_commit_master(void) { - lcm->lcm_flags |= LLOG_LCM_FL_EXIT; - if (force) - lcm->lcm_flags |= LLOG_LCM_FL_EXIT_FORCE; - wake_up(&lcm->lcm_waitq); - - wait_event_interruptible(lcm->lcm_waitq, - atomic_read(&lcm->lcm_thread_total) == 0); return 0; } -- 1.8.3.1