From 9bb4c2413323c2bc7bb0686ab6b86f0ca6215781 Mon Sep 17 00:00:00 2001 From: pschwan Date: Thu, 5 Sep 2002 19:14:59 +0000 Subject: [PATCH] - debug.c was only used by obdclass, so I moved it there - some of page.c wasn't used by anything, so I removed those bits; much of page.c was only used in one module, so those bits moved there; two functions were shared, so now they're in obdclass; page.c is no more. - stop building and distributing obdfs - little warning and formatting fixups that I noticed along the way --- lustre/Makefile.am | 2 +- lustre/configure.in | 12 +- lustre/include/linux/lustre_lib.h | 6 - lustre/include/linux/obd_class.h | 1 - lustre/ldlm/ldlm_lockd.c | 8 +- lustre/lib/page.c | 294 -------------------------------------- lustre/llite/Makefile.am | 10 +- lustre/llite/rw.c | 36 +++++ lustre/lov/Makefile.am | 5 +- lustre/obdclass/Makefile.am | 9 +- lustre/obdclass/class_obd.c | 2 + lustre/{lib => obdclass}/debug.c | 0 lustre/obdclass/genops.c | 75 ++++++++++ lustre/obdfilter/Makefile.am | 4 +- lustre/obdfilter/filter.c | 88 ++++++++++++ lustre/obdfs/rw.c | 2 - lustre/osc/osc_request.c | 55 ++++--- lustre/ost/Makefile.am | 6 +- lustre/ptlrpc/service.c | 59 ++++---- lustre/utils/obd.c | 1 - 20 files changed, 272 insertions(+), 403 deletions(-) delete mode 100644 lustre/lib/page.c rename lustre/{lib => obdclass}/debug.c (100%) diff --git a/lustre/Makefile.am b/lustre/Makefile.am index f5d2d13..266acf6 100644 --- a/lustre/Makefile.am +++ b/lustre/Makefile.am @@ -8,7 +8,7 @@ AUTOMAKE_OPTIONS = foreign # NOTE: keep extN before mds SUBDIRS = lov utils obdclass ldlm ptlrpc llite lib obdecho mdc osc extN SUBDIRS+= mds ost tests obdfilter demos doc scripts -DIST_SUBDIRS = $(SUBDIRS) obdfs +DIST_SUBDIRS = $(SUBDIRS) EXTRA_DIST = BUGS FDL Rules include patches archdep.m4 # We get the version from the spec file. diff --git a/lustre/configure.in b/lustre/configure.in index 574d354..482ecf3 100644 --- a/lustre/configure.in +++ b/lustre/configure.in @@ -95,10 +95,8 @@ AC_SUBST(demodir) # not needed until the AC_CHECK_LIB(readline) above works # AM_CONFIG_HEADER(include/config.h) -AC_OUTPUT(Makefile lib/Makefile ldlm/Makefile \ - obdecho/Makefile ptlrpc/Makefile \ - lov/Makefile osc/Makefile mdc/Makefile mds/Makefile ost/Makefile utils/Makefile \ - tests/Makefile obdfilter/Makefile obdclass/Makefile \ - llite/Makefile obdfs/Makefile demos/Makefile \ - doc/Makefile scripts/Makefile scripts/lustre.spec \ - extN/Makefile) +AC_OUTPUT(Makefile lib/Makefile ldlm/Makefile obdecho/Makefile ptlrpc/Makefile \ + lov/Makefile osc/Makefile mdc/Makefile mds/Makefile ost/Makefile \ + utils/Makefile tests/Makefile obdfilter/Makefile obdclass/Makefile \ + llite/Makefile demos/Makefile doc/Makefile scripts/Makefile \ + scripts/lustre.spec extN/Makefile) diff --git a/lustre/include/linux/lustre_lib.h b/lustre/include/linux/lustre_lib.h index 72f4c5c..c6826ea 100644 --- a/lustre/include/linux/lustre_lib.h +++ b/lustre/include/linux/lustre_lib.h @@ -87,12 +87,6 @@ struct io_cb_data { int ll_sync_io_cb(struct io_cb_data *data, int err, int phase); struct io_cb_data *ll_init_cb(void); -inline void lustre_put_page(struct page *page); -struct page *lustre_get_page_read(struct inode *dir, unsigned long index); -struct page *lustre_get_page_write(struct inode *dir, unsigned long index); -int lustre_commit_write(struct page *page, unsigned from, unsigned to); -void set_page_clean(struct page *page); -void set_page_dirty(struct page *page); /* simple.c */ struct obd_run_ctxt; diff --git a/lustre/include/linux/obd_class.h b/lustre/include/linux/obd_class.h index f554ab7..08a9415 100644 --- a/lustre/include/linux/obd_class.h +++ b/lustre/include/linux/obd_class.h @@ -687,7 +687,6 @@ int class_connect(struct lustre_handle *conn, struct obd_device *obd, char *cluuid); int class_disconnect(struct lustre_handle *conn); void class_disconnect_all(struct obd_device *obddev); -struct obd_export *class_conn2export(struct lustre_handle *); /* generic operations shared by various OBD types */ int class_multi_setup(struct obd_device *obddev, uint32_t len, void *data); diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 86e4eae..81fcb01 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -52,10 +52,10 @@ static struct timer_list waiting_locks_timer; /* * Indicate that we're waiting for a client to call us back cancelling a given * lock. We add it to the pending-callback chain, and schedule the lock-timeout - * timer to fire appropriately. (We round up to the next second, to avoid floods - * of timer firings during periods of high lock contention and traffic. + * timer to fire appropriately. (We round up to the next second, to avoid + * floods of timer firings during periods of high lock contention and traffic. */ -int ldlm_add_waiting_lock(struct ldlm_lock *lock) +static int ldlm_add_waiting_lock(struct ldlm_lock *lock) { unsigned long timeout_rounded; ENTRY; @@ -81,7 +81,7 @@ int ldlm_add_waiting_lock(struct ldlm_lock *lock) * callback arrive without incident. This adjusts the lock-timeout timer if * needed. Returns 0 if the lock wasn't pending after all, 1 if it was. */ -int ldlm_del_waiting_lock(struct ldlm_lock *lock) +static int ldlm_del_waiting_lock(struct ldlm_lock *lock) { struct list_head *list_next; diff --git a/lustre/lib/page.c b/lustre/lib/page.c deleted file mode 100644 index 019c38e..0000000 --- a/lustre/lib/page.c +++ /dev/null @@ -1,294 +0,0 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * - * Copyright (C) 2001, 2002 Cluster File Systems, Inc. - * - * This file is part of Lustre, http://www.sf.net/projects/lustre/ - * - * Lustre is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * Lustre is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Lustre; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - - - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#define DEBUG_SUBSYSTEM S_OST - -#include -#include -#include -#include - -static int sync_io_timeout(void *data) -{ - struct io_cb_data *cbd = data; - struct ptlrpc_bulk_desc *desc = cbd->desc; - - ENTRY; - desc->bd_connection->c_level = LUSTRE_CONN_RECOVD; - desc->bd_flags |= PTL_RPC_FL_TIMEOUT; - if (desc->bd_connection && class_signal_connection_failure) { - - /* XXXshaver Do we need a resend strategy, or do we just - * XXXshaver return -ERESTARTSYS and punt it? - */ - CERROR("signalling failure of conn %p\n", desc->bd_connection); - class_signal_connection_failure(desc->bd_connection); - - /* We go back to sleep, until we're resumed or interrupted. */ - RETURN(0); - } - - /* If we can't be recovered, just abort the syscall with -ETIMEDOUT. */ - RETURN(1); -} - -static int sync_io_intr(void *data) -{ - struct io_cb_data *cbd = data; - struct ptlrpc_bulk_desc *desc = cbd->desc; - - ENTRY; - desc->bd_flags |= PTL_RPC_FL_INTR; - RETURN(1); /* ignored, as of this writing */ -} - -int ll_sync_io_cb(struct io_cb_data *data, int err, int phase) -{ - int ret; - ENTRY; - - if (phase == CB_PHASE_START) { - struct l_wait_info lwi; - lwi = LWI_TIMEOUT_INTR(obd_timeout * HZ, sync_io_timeout, - sync_io_intr, data); - ret = l_wait_event(data->waitq, data->complete, &lwi); - if (atomic_dec_and_test(&data->refcount)) - OBD_FREE(data, sizeof(*data)); - if (ret == -ERESTARTSYS) - return ret; - } else if (phase == CB_PHASE_FINISH) { - data->err = err; - data->complete = 1; - wake_up(&data->waitq); - if (atomic_dec_and_test(&data->refcount)) - OBD_FREE(data, sizeof(*data)); - return err; - } else - LBUG(); - EXIT; - return 0; -} - -struct io_cb_data *ll_init_cb(void) -{ - struct io_cb_data *d; - - - OBD_ALLOC(d, sizeof(*d)); - if (d) { - init_waitqueue_head(&d->waitq); - atomic_set(&d->refcount, 2); - } - RETURN(d); -} - -/* - * Remove page from dirty list - */ -static void __set_page_clean(struct page *page) -{ - struct address_space *mapping = page->mapping; - struct inode *inode; - - if (!mapping) - return; - -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,9)) - spin_lock(&pagecache_lock); -#endif - - list_del(&page->list); - list_add(&page->list, &mapping->clean_pages); - - inode = mapping->host; - if (list_empty(&mapping->dirty_pages)) { - CDEBUG(D_INODE, "inode clean\n"); - inode->i_state &= ~I_DIRTY_PAGES; - } -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,10)) - spin_unlock(&pagecache_lock); -#endif - EXIT; -} - -inline void set_page_clean(struct page *page) -{ - if (PageDirty(page)) { - ClearPageDirty(page); - __set_page_clean(page); - } -} - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10)) -/* - * Add a page to the dirty page list. - */ -void __set_page_dirty(struct page *page) -{ - struct address_space *mapping; - spinlock_t *pg_lock; - - pg_lock = PAGECACHE_LOCK(page); - spin_lock(pg_lock); - - mapping = page->mapping; - spin_lock(&mapping->page_lock); - - list_del(&page->list); - list_add(&page->list, &mapping->dirty_pages); - - spin_unlock(&mapping->page_lock); - spin_unlock(pg_lock); - - if (mapping->host) - mark_inode_dirty_pages(mapping->host); -} -#else -/* - * Add a page to the dirty page list. - */ -void set_page_dirty(struct page *page) -{ - if (!test_and_set_bit(PG_dirty, &page->flags)) { - struct address_space *mapping = page->mapping; - - if (mapping) { - spin_lock(&pagecache_lock); - list_del(&page->list); - list_add(&page->list, &mapping->dirty_pages); - spin_unlock(&pagecache_lock); - - if (mapping->host) - mark_inode_dirty_pages(mapping->host); - } - } -} -#endif - -inline void lustre_put_page(struct page *page) -{ - kunmap(page); - page_cache_release(page); -} - -struct page *lustre_get_page_read(struct inode *inode, unsigned long index) -{ - struct address_space *mapping = inode->i_mapping; - struct page *page; - int rc; - - page = read_cache_page(mapping, index, - (filler_t*)mapping->a_ops->readpage, NULL); - if (!IS_ERR(page)) { - wait_on_page(page); - kmap(page); - if (!Page_Uptodate(page)) { - CERROR("page index %lu not uptodate\n", index); - GOTO(err_page, rc = -EIO); - } - if (PageError(page)) { - CERROR("page index %lu has error\n", index); - GOTO(err_page, rc = -EIO); - } - } - return page; - -err_page: - lustre_put_page(page); - return ERR_PTR(rc); -} - -struct page *lustre_get_page_write(struct inode *inode, unsigned long index) -{ - struct address_space *mapping = inode->i_mapping; - struct page *page; - int rc; - - page = grab_cache_page(mapping, index); /* locked page */ - - if (!IS_ERR(page)) { - kmap(page); - /* Note: Called with "O" and "PAGE_SIZE" this is essentially - * a no-op for most filesystems, because we write the whole - * page. For partial-page I/O this will read in the page. - */ - rc = mapping->a_ops->prepare_write(NULL, page, 0, PAGE_SIZE); - if (rc) { - CERROR("page index %lu, rc = %d\n", index, rc); - if (rc != -ENOSPC) - LBUG(); - GOTO(err_unlock, rc); - } - /* XXX not sure if we need this if we are overwriting page */ - if (PageError(page)) { - CERROR("error on page index %lu, rc = %d\n", index, rc); - LBUG(); - GOTO(err_unlock, rc = -EIO); - } - } - return page; - -err_unlock: - unlock_page(page); - lustre_put_page(page); - return ERR_PTR(rc); -} - -int lustre_commit_write(struct page *page, unsigned from, unsigned to) -{ - struct inode *inode = page->mapping->host; - int err; - - err = page->mapping->a_ops->commit_write(NULL, page, from, to); - if (!err && IS_SYNC(inode)) - err = waitfor_one_page(page); - - //SetPageUptodate(page); // the client commit_write will do this - - SetPageReferenced(page); - unlock_page(page); - lustre_put_page(page); - return err; -} diff --git a/lustre/llite/Makefile.am b/lustre/llite/Makefile.am index aae1b6f..e46300d 100644 --- a/lustre/llite/Makefile.am +++ b/lustre/llite/Makefile.am @@ -9,18 +9,10 @@ MODULE = llite modulefs_DATA = llite.o EXTRA_PROGRAMS = llite -page.c: - test -e page.c || ln -sf $(top_srcdir)/lib/page.c - - -LINX=page.c llite_SOURCES = dcache.c commit_callback.c super.c rw.c -llite_SOURCES += file.c dir.c sysctl.c namei.c symlink.c $(LINX) +llite_SOURCES += file.c dir.c sysctl.c namei.c symlink.c llite_SOURCES += lov_pack.c -dist-hook: - list='$(LINX)'; for f in $$list; do rm -f $(distdir)/$$f; done - lov_pack.c: test -e lov_pack.c || ln -sf $(top_srcdir)/lib/lov_pack.c . diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index bbdfad3..ad6d6cf 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -33,6 +33,42 @@ #include #include +/* + * Remove page from dirty list + */ +static void __set_page_clean(struct page *page) +{ + struct address_space *mapping = page->mapping; + struct inode *inode; + + if (!mapping) + return; + +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,9)) + spin_lock(&pagecache_lock); +#endif + + list_del(&page->list); + list_add(&page->list, &mapping->clean_pages); + + inode = mapping->host; + if (list_empty(&mapping->dirty_pages)) { + CDEBUG(D_INODE, "inode clean\n"); + inode->i_state &= ~I_DIRTY_PAGES; + } +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,10)) + spin_unlock(&pagecache_lock); +#endif + EXIT; +} + +inline void set_page_clean(struct page *page) +{ + if (PageDirty(page)) { + ClearPageDirty(page); + __set_page_clean(page); + } +} /* SYNCHRONOUS I/O to object storage for an inode */ static int ll_brw(int rw, struct inode *inode, struct page *page, int create) diff --git a/lustre/lov/Makefile.am b/lustre/lov/Makefile.am index 62986f2..f45ddd9 100644 --- a/lustre/lov/Makefile.am +++ b/lustre/lov/Makefile.am @@ -10,12 +10,9 @@ modulefs_DATA = lov.o EXTRA_PROGRAMS = lov LINX= lov_pack.c -lov_SOURCES = lov_obd.c page.c $(LINX) +lov_SOURCES = lov_obd.c $(LINX) lov_pack.c: test -e lov_pack.c || ln -sf $(top_srcdir)/lib/lov_pack.c -page.c: - test -e page.c || ln -sf $(top_srcdir)/lib/page.c - include $(top_srcdir)/Rules diff --git a/lustre/obdclass/Makefile.am b/lustre/obdclass/Makefile.am index 40f997f..322df7d 100644 --- a/lustre/obdclass/Makefile.am +++ b/lustre/obdclass/Makefile.am @@ -2,13 +2,6 @@ DEFS= MODULE = obdclass modulefs_DATA = obdclass.o EXTRA_PROGRAMS = obdclass -LINX=page.c debug.c -obdclass_SOURCES = genops.c proc_lustre.c class_obd.c sysctl.c uuid.c $(LINX) - -debug.c: - test -e debug.c || ln -sf $(top_srcdir)/lib/debug.c - -page.c: - test -e page.c || ln -sf $(top_srcdir)/lib/page.c +obdclass_SOURCES = debug.c genops.c proc_lustre.c class_obd.c sysctl.c uuid.c include $(top_srcdir)/Rules diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index 53959c7..5fe7411 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -645,6 +645,8 @@ EXPORT_SYMBOL(class_uuid_unparse); EXPORT_SYMBOL(class_signal_connection_failure); EXPORT_SYMBOL(mds_destroy_export); EXPORT_SYMBOL(ldlm_destroy_export); +EXPORT_SYMBOL(ll_sync_io_cb); +EXPORT_SYMBOL(ll_init_cb); static int __init init_obdclass(void) { diff --git a/lustre/lib/debug.c b/lustre/obdclass/debug.c similarity index 100% rename from lustre/lib/debug.c rename to lustre/obdclass/debug.c diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 45d0a38..adb16f2 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -25,6 +25,81 @@ kmem_cache_t *obdo_cachep = NULL; kmem_cache_t *export_cachep = NULL; kmem_cache_t *import_cachep = NULL; +/* I would prefer if these next four functions were in ptlrpc, to be honest, + * but obdclass uses them for the netregression ioctls. -phil */ +static int sync_io_timeout(void *data) +{ + struct io_cb_data *cbd = data; + struct ptlrpc_bulk_desc *desc = cbd->desc; + + ENTRY; + desc->bd_connection->c_level = LUSTRE_CONN_RECOVD; + desc->bd_flags |= PTL_RPC_FL_TIMEOUT; + if (desc->bd_connection && class_signal_connection_failure) { + + /* XXXshaver Do we need a resend strategy, or do we just + * XXXshaver return -ERESTARTSYS and punt it? + */ + CERROR("signalling failure of conn %p\n", desc->bd_connection); + class_signal_connection_failure(desc->bd_connection); + + /* We go back to sleep, until we're resumed or interrupted. */ + RETURN(0); + } + + /* If we can't be recovered, just abort the syscall with -ETIMEDOUT. */ + RETURN(1); +} + +static int sync_io_intr(void *data) +{ + struct io_cb_data *cbd = data; + struct ptlrpc_bulk_desc *desc = cbd->desc; + + ENTRY; + desc->bd_flags |= PTL_RPC_FL_INTR; + RETURN(1); /* ignored, as of this writing */ +} + +int ll_sync_io_cb(struct io_cb_data *data, int err, int phase) +{ + int ret; + ENTRY; + + if (phase == CB_PHASE_START) { + struct l_wait_info lwi; + lwi = LWI_TIMEOUT_INTR(obd_timeout * HZ, sync_io_timeout, + sync_io_intr, data); + ret = l_wait_event(data->waitq, data->complete, &lwi); + if (atomic_dec_and_test(&data->refcount)) + OBD_FREE(data, sizeof(*data)); + if (ret == -ERESTARTSYS) + return ret; + } else if (phase == CB_PHASE_FINISH) { + data->err = err; + data->complete = 1; + wake_up(&data->waitq); + if (atomic_dec_and_test(&data->refcount)) + OBD_FREE(data, sizeof(*data)); + return err; + } else + LBUG(); + EXIT; + return 0; +} + +struct io_cb_data *ll_init_cb(void) +{ + struct io_cb_data *d; + + OBD_ALLOC(d, sizeof(*d)); + if (d) { + init_waitqueue_head(&d->waitq); + atomic_set(&d->refcount, 2); + } + RETURN(d); +} + /* * support functions: we could use inter-module communication, but this * is more portable to other OS's diff --git a/lustre/obdfilter/Makefile.am b/lustre/obdfilter/Makefile.am index 2f545ee..1eab611 100644 --- a/lustre/obdfilter/Makefile.am +++ b/lustre/obdfilter/Makefile.am @@ -8,11 +8,9 @@ MODULE = obdfilter modulefs_DATA = obdfilter.o EXTRA_PROGRAMS = obdfilter -LINX=page.c simple.c +LINX=simple.c simple.c: test -e simple.c || ln -sf $(top_srcdir)/lib/simple.c -page.c: - test -e page.c || ln -sf $(top_srcdir)/lib/page.c FILTERC = filter.c obdfilter_SOURCES = $(FILTERC) $(LINX) diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 53e60eb..fb87334 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -960,6 +960,94 @@ static int filter_journal_stop(void *journal_save, struct filter_obd *filter, return rc; } +static inline void lustre_put_page(struct page *page) +{ + kunmap(page); + page_cache_release(page); +} + +static struct page * +lustre_get_page_read(struct inode *inode, unsigned long index) +{ + struct address_space *mapping = inode->i_mapping; + struct page *page; + int rc; + + page = read_cache_page(mapping, index, + (filler_t*)mapping->a_ops->readpage, NULL); + if (!IS_ERR(page)) { + wait_on_page(page); + kmap(page); + if (!Page_Uptodate(page)) { + CERROR("page index %lu not uptodate\n", index); + GOTO(err_page, rc = -EIO); + } + if (PageError(page)) { + CERROR("page index %lu has error\n", index); + GOTO(err_page, rc = -EIO); + } + } + return page; + +err_page: + lustre_put_page(page); + return ERR_PTR(rc); +} + +static struct page * +lustre_get_page_write(struct inode *inode, unsigned long index) +{ + struct address_space *mapping = inode->i_mapping; + struct page *page; + int rc; + + page = grab_cache_page(mapping, index); /* locked page */ + + if (!IS_ERR(page)) { + kmap(page); + /* Note: Called with "O" and "PAGE_SIZE" this is essentially + * a no-op for most filesystems, because we write the whole + * page. For partial-page I/O this will read in the page. + */ + rc = mapping->a_ops->prepare_write(NULL, page, 0, PAGE_SIZE); + if (rc) { + CERROR("page index %lu, rc = %d\n", index, rc); + if (rc != -ENOSPC) + LBUG(); + GOTO(err_unlock, rc); + } + /* XXX not sure if we need this if we are overwriting page */ + if (PageError(page)) { + CERROR("error on page index %lu, rc = %d\n", index, rc); + LBUG(); + GOTO(err_unlock, rc = -EIO); + } + } + return page; + +err_unlock: + unlock_page(page); + lustre_put_page(page); + return ERR_PTR(rc); +} + +static int lustre_commit_write(struct page *page, unsigned from, unsigned to) +{ + struct inode *inode = page->mapping->host; + int err; + + err = page->mapping->a_ops->commit_write(NULL, page, from, to); + if (!err && IS_SYNC(inode)) + err = waitfor_one_page(page); + + //SetPageUptodate(page); // the client commit_write will do this + + SetPageReferenced(page); + unlock_page(page); + lustre_put_page(page); + return err; +} + struct page *filter_get_page_write(struct inode *inode, unsigned long index, struct niobuf_local *lnb, int *pglocked) { diff --git a/lustre/obdfs/rw.c b/lustre/obdfs/rw.c index e4b690d..f79fd2e 100644 --- a/lustre/obdfs/rw.c +++ b/lustre/obdfs/rw.c @@ -171,8 +171,6 @@ static int obdfs_brw(int rw, struct inode *inode2, return err; } /* obdfs_brw */ -extern void set_page_clean(struct page *); - /* SYNCHRONOUS I/O to object storage for an inode -- object attr will be updated too */ static int obdfs_commit_page(struct page *page, int create, int from, int to) { diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 5d7aab5..c88ce46 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -30,7 +30,7 @@ #include /* for OBD_FAIL_CHECK */ #include /* for ll_i2info */ -static int osc_getattr(struct lustre_handle *conn, struct obdo *oa, +static int osc_getattr(struct lustre_handle *conn, struct obdo *oa, struct lov_stripe_md *md) { struct ptlrpc_request *request; @@ -38,8 +38,8 @@ static int osc_getattr(struct lustre_handle *conn, struct obdo *oa, int rc, size = sizeof(*body); ENTRY; - request = ptlrpc_prep_req(class_conn2cliimp(conn), OST_GETATTR, 1, &size, - NULL); + request = ptlrpc_prep_req(class_conn2cliimp(conn), OST_GETATTR, 1, + &size, NULL); if (!request) RETURN(-ENOMEM); @@ -145,8 +145,8 @@ static int osc_setattr(struct lustre_handle *conn, struct obdo *oa, int rc, size = sizeof(*body); ENTRY; - request = ptlrpc_prep_req(class_conn2cliimp(conn), OST_SETATTR, 1, &size, - NULL); + request = ptlrpc_prep_req(class_conn2cliimp(conn), OST_SETATTR, 1, + &size, NULL); if (!request) RETURN(-ENOMEM); @@ -157,9 +157,7 @@ static int osc_setattr(struct lustre_handle *conn, struct obdo *oa, rc = ptlrpc_queue_wait(request); rc = ptlrpc_check_status(request, rc); - GOTO(out, rc); - out: ptlrpc_free_req(request); return rc; } @@ -237,7 +235,7 @@ static int osc_punch(struct lustre_handle *conn, struct obdo *oa, #warning FIXME: pack only valid fields instead of memcpy, endianness, valid memcpy(&body->oa, oa, sizeof(*oa)); - /* overload the blocks and size fields in the oa with start/end */ + /* overload the blocks and size fields in the oa with start/end */ #warning FIXME: endianness, size=start, blocks=end? body->oa.o_blocks = start; body->oa.o_size = end; @@ -271,8 +269,8 @@ static int osc_destroy(struct lustre_handle *conn, struct obdo *oa, CERROR("oa NULL\n"); RETURN(-EINVAL); } - request = ptlrpc_prep_req(class_conn2cliimp(conn), OST_DESTROY, 1, &size, - NULL); + request = ptlrpc_prep_req(class_conn2cliimp(conn), OST_DESTROY, 1, + &size, NULL); if (!request) RETURN(-ENOMEM); @@ -329,7 +327,7 @@ static void brw_finish(struct ptlrpc_bulk_desc *desc, void *data) ENTRY; if (desc->bd_flags & PTL_RPC_FL_TIMEOUT) { - err = (desc->bd_flags & PTL_RPC_FL_INTR ? -ERESTARTSYS : + err = (desc->bd_flags & PTL_RPC_FL_INTR ? -ERESTARTSYS : -ETIMEDOUT); } @@ -437,18 +435,19 @@ static int osc_brw_read(struct lustre_handle *conn, struct lov_stripe_md *md, * such as a timeout in a sleep that it performs, brw_finish * will never get called, and we'll leak the desc, fail to kunmap * things, cats will live with dogs. One solution would be to - * export brw_finish as osc_brw_finish, so that the timeout case and - * its kin could call it for proper cleanup. An alternative would - * be for an error return from the callback to cause us to clean up, - * but that doesn't help the truly async cases (like LOV), which - * will immediately return from their PHASE_START callback, before - * any such cleanup-requiring error condition can be detected. + * export brw_finish as osc_brw_finish, so that the timeout case + * and its kin could call it for proper cleanup. An alternative + * would be for an error return from the callback to cause us to + * clean up, but that doesn't help the truly async cases (like + * LOV), which will immediately return from their PHASE_START + * callback, before any such cleanup-requiring error condition can + * be detected. */ if (rc) GOTO(out_req, rc); /* Callbacks cause asynchronous handling. */ - rc = callback(data, 0, CB_PHASE_START); + rc = callback(data, 0, CB_PHASE_START); out_req: ptlrpc_req_finished(request); @@ -601,8 +600,8 @@ static int osc_brw(int cmd, struct lustre_handle *conn, return osc_brw_read(conn, md, page_count, pga, callback, data); } -static int osc_enqueue(struct lustre_handle *connh, struct lov_stripe_md *md, - struct lustre_handle *parent_lock, +static int osc_enqueue(struct lustre_handle *connh, struct lov_stripe_md *md, + struct lustre_handle *parent_lock, __u32 type, void *extentp, int extent_len, __u32 mode, int *flags, void *callback, void *data, int datalen, struct lustre_handle *lockh) @@ -711,10 +710,10 @@ static int osc_iocontrol(long cmd, struct lustre_handle *conn, int len, int err = 0; ENTRY; - if (_IOC_TYPE(cmd) != IOC_LDLM_TYPE || _IOC_NR(cmd) < - IOC_LDLM_MIN_NR || _IOC_NR(cmd) > IOC_LDLM_MAX_NR) { + if (_IOC_TYPE(cmd) != IOC_LDLM_TYPE || + _IOC_NR(cmd) < IOC_LDLM_MIN_NR || _IOC_NR(cmd) > IOC_LDLM_MAX_NR) { CDEBUG(D_IOCTL, "invalid ioctl (type %ld, nr %ld, size %ld)\n", - _IOC_TYPE(cmd), _IOC_NR(cmd), _IOC_SIZE(cmd)); + _IOC_TYPE(cmd), _IOC_NR(cmd), _IOC_SIZE(cmd)); RETURN(-EINVAL); } @@ -725,12 +724,12 @@ static int osc_iocontrol(long cmd, struct lustre_handle *conn, int len, GOTO(out, err); } case IOC_LDLM_REGRESS_START: { - unsigned int numthreads = 1; - unsigned int numheld = 10; - unsigned int numres = 10; + unsigned int numthreads = 1; + unsigned int numheld = 10; + unsigned int numres = 10; unsigned int numext = 10; char *parse; - + if (data->ioc_inllen1) { parse = data->ioc_inlbuf1; if (*parse != '\0') { @@ -755,7 +754,7 @@ static int osc_iocontrol(long cmd, struct lustre_handle *conn, int len, } } - err = ldlm_regression_start(obddev, conn, numthreads, + err = ldlm_regression_start(obddev, conn, numthreads, numheld, numres, numext); CERROR("-- done err %d\n", err); diff --git a/lustre/ost/Makefile.am b/lustre/ost/Makefile.am index 29b0c30..6ba1c9c 100644 --- a/lustre/ost/Makefile.am +++ b/lustre/ost/Makefile.am @@ -8,16 +8,13 @@ MODULE = ost modulefs_DATA = ost.o EXTRA_PROGRAMS = ost -LINX=page.c obd_pack.c l_net.c ll_pack.c +LINX=obd_pack.c l_net.c ll_pack.c ll_pack.c: test -e ll_pack.c || ln -sf $(top_srcdir)/lib/ll_pack.c obd_pack.c: test -e obd_pack.c || ln -sf $(top_srcdir)/lib/obd_pack.c -page.c: - test -e page.c || ln -sf $(top_srcdir)/lib/page.c - l_net.c: test -e l_net.c || ln -sf $(top_srcdir)/lib/l_net.c @@ -26,4 +23,3 @@ dist-hook: list='$(LINX)'; for f in $$list; do rm -f $(distdir)/$$f; done include $(top_srcdir)/Rules - diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 9c69af8..af99b41 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -64,8 +64,8 @@ static int ptlrpc_check_event(struct ptlrpc_service *svc, } struct ptlrpc_service * -ptlrpc_init_svc(__u32 bufsize, int nbuffs, int req_portal, int rep_portal, char *uuid, - svc_handler_t handler, char *name) +ptlrpc_init_svc(__u32 bufsize, int nbuffs, int req_portal, int rep_portal, + char *uuid, svc_handler_t handler, char *name) { int err; int rc, i; @@ -98,7 +98,7 @@ ptlrpc_init_svc(__u32 bufsize, int nbuffs, int req_portal, int rep_portal, char } /* NB We need exactly 1 event for each buffer we queue */ - rc = PtlEQAlloc(service->srv_self.peer_ni, service->srv_nbuffs, + rc = PtlEQAlloc(service->srv_self.peer_ni, service->srv_nbuffs, request_in_callback, &(service->srv_eq_h)); if (rc != PTL_OK) { @@ -108,17 +108,17 @@ ptlrpc_init_svc(__u32 bufsize, int nbuffs, int req_portal, int rep_portal, char RETURN(NULL); } - OBD_ALLOC(service->srv_rqbds, - service->srv_nbuffs * sizeof (struct ptlrpc_request_buffer_desc)); + OBD_ALLOC(service->srv_rqbds, service->srv_nbuffs * + sizeof(struct ptlrpc_request_buffer_desc)); if (service->srv_rqbds == NULL) { CERROR("no memory\n"); LBUG(); GOTO(failed, NULL); } - + for (i = 0; i < service->srv_nbuffs; i++) { - struct ptlrpc_request_buffer_desc *rqbd = &service->srv_rqbds[i]; - + struct ptlrpc_request_buffer_desc *rqbd =&service->srv_rqbds[i]; + rqbd->rqbd_service = service; ptl_set_inv_handle (&rqbd->rqbd_me_h); OBD_ALLOC(rqbd->rqbd_buffer, service->srv_buf_size); @@ -153,7 +153,7 @@ static int handle_incoming_request(struct obd_device *obddev, LASSERT (rqbd->rqbd_service == svc); LASSERT (rqbd->rqbd_buffer == event->mem_desc.start); LASSERT (event->offset == 0); - + memset(&request, 0, sizeof(request)); request.rq_svc = svc; request.rq_obd = obddev; @@ -200,7 +200,8 @@ static int handle_incoming_request(struct obd_device *obddev, * We don't know how to find that from here. */ request.rq_peer.peer_ni = svc->srv_self.peer_ni; - request.rq_export = class_conn2export((struct lustre_handle *) request.rq_reqmsg); + request.rq_export = class_conn2export((struct lustre_handle *) + request.rq_reqmsg); if (request.rq_export) { request.rq_connection = request.rq_export->exp_connection; @@ -344,28 +345,26 @@ int ptlrpc_unregister_service(struct ptlrpc_service *service) { int rc, i; - if (service->srv_rqbds != NULL) - { - for (i = 0; i < service->srv_nbuffs; i++) { - struct ptlrpc_request_buffer_desc *rqbd = &service->srv_rqbds[i]; - - if (rqbd->rqbd_buffer == NULL) /* no buffer allocated */ - continue; /* => never initialised */ - - /* Buffer allocated => got linked */ - LASSERT (ptl_is_valid_handle (&rqbd->rqbd_me_h)); - - rc = PtlMEUnlink(rqbd->rqbd_me_h); - if (rc) - CERROR("PtlMEUnlink failed: %d\n", rc); - - OBD_FREE(rqbd->rqbd_buffer, service->srv_buf_size); - } + for (i = 0; i < service->srv_nbuffs; i++) { + struct ptlrpc_request_buffer_desc *rqbd =&service->srv_rqbds[i]; - OBD_FREE(service->srv_rqbds, - service->srv_nbuffs * sizeof (struct ptlrpc_request_buffer_desc)); + if (rqbd->rqbd_buffer == NULL) /* no buffer allocated */ + continue; /* => never initialised */ + + /* Buffer allocated => got linked */ + LASSERT (ptl_is_valid_handle (&rqbd->rqbd_me_h)); + + rc = PtlMEUnlink(rqbd->rqbd_me_h); + if (rc) + CERROR("PtlMEUnlink failed: %d\n", rc); + + OBD_FREE(rqbd->rqbd_buffer, service->srv_buf_size); } + if (service->srv_rqbds != NULL) + OBD_FREE(service->srv_rqbds, service->srv_nbuffs * + sizeof (struct ptlrpc_request_buffer_desc)); + rc = PtlEQFree(service->srv_eq_h); if (rc) CERROR("PtlEQFree failed: %d\n", rc); @@ -377,7 +376,7 @@ int ptlrpc_unregister_service(struct ptlrpc_service *service) } OBD_FREE(service, sizeof(*service)); - if (rc) + if (rc) LBUG(); return rc; } diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c index 6a22992..2346ae8 100644 --- a/lustre/utils/obd.c +++ b/lustre/utils/obd.c @@ -1003,7 +1003,6 @@ int jt_obd_test_brw(int argc, char **argv) struct timeval start, next_time; int pages = 1, objid = 3, count, next_count; int verbose = 1, write = 0, rw; - long long offset; char *end; int i; int len; -- 1.8.3.1