if (current->need_resched)
schedule ();
}
+#define work_struct_t struct tq_struct
#else
{
cond_resched();
}
+#define work_struct_t struct work_struct
+
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) */
#ifdef PORTAL_DEBUG
/* temporary expedient: limit number of entries in discontiguous MDs */
# define PTL_MTU (512<<10)
# define PTL_MD_MAX_IOV 128
+# define PTL_MD_MAX_PAGES min_t(int, PTL_MD_MAX_IOV, PTL_MTU / PAGE_SIZE)
struct lib_msg_t {
struct list_head msg_list;
#ifndef __INCLUDE_GMNAL_H__
#define __INCLUDE_GMNAL_H__
+#ifndef EXPORT_SYMTAB
+# define EXPORT_SYMTAB
+#endif
+
#include "linux/config.h"
#include "linux/module.h"
#include "linux/tty.h"
#include "linux/init.h"
#include "linux/sem.h"
#include "linux/vmalloc.h"
-#ifdef MODVERSIONS
-#include <linux/modversions.h>
-#endif
#define DEBUG_SUBSYSTEM S_GMNAL
#include "gm_internal.h"
+
/*
* Defines for the API NAL
*/
*dist = 27;
return(PTL_OK);
}
-
-
-
-
-EXPORT_SYMBOL(gmnal_cb_send);
-EXPORT_SYMBOL(gmnal_cb_send_pages);
-EXPORT_SYMBOL(gmnal_cb_recv);
-EXPORT_SYMBOL(gmnal_cb_recv_pages);
-EXPORT_SYMBOL(gmnal_cb_read);
-EXPORT_SYMBOL(gmnal_cb_write);
-EXPORT_SYMBOL(gmnal_cb_cli);
-EXPORT_SYMBOL(gmnal_cb_sti);
-EXPORT_SYMBOL(gmnal_cb_dist);
-EXPORT_SYMBOL(gmnal_cb_printf);
-EXPORT_SYMBOL(gmnal_cb_map);
-EXPORT_SYMBOL(gmnal_cb_unmap);
-EXPORT_SYMBOL(gmnal_cb_callback);
-EXPORT_SYMBOL(gmnal_cb_free);
-EXPORT_SYMBOL(gmnal_cb_malloc);
list_del (&fwd->kprfd_list);
}
- if (waitqueue_active (&kqswnal_data.kqn_idletxd_waitq)) /* process? */
- {
- /* local sender waiting for tx desc */
- CDEBUG(D_NET,"wakeup process\n");
- wake_up (&kqswnal_data.kqn_idletxd_waitq);
- }
+ wake_up (&kqswnal_data.kqn_idletxd_waitq);
spin_unlock_irqrestore (&kqswnal_data.kqn_idletxd_lock, flags);
spin_lock_irqsave (&kqswnal_data.kqn_sched_lock, flags);
list_add_tail (&fwd->kprfd_list, &kqswnal_data.kqn_delayedfwds);
- if (waitqueue_active (&kqswnal_data.kqn_sched_waitq))
- wake_up (&kqswnal_data.kqn_sched_waitq);
+ wake_up (&kqswnal_data.kqn_sched_waitq);
spin_unlock_irqrestore (&kqswnal_data.kqn_sched_lock, flags);
}
spin_lock_irqsave (&kqswnal_data.kqn_sched_lock, flags);
list_add_tail (&ktx->ktx_delayed_list, &kqswnal_data.kqn_delayedtxds);
- if (waitqueue_active (&kqswnal_data.kqn_sched_waitq))
- wake_up (&kqswnal_data.kqn_sched_waitq);
+ wake_up (&kqswnal_data.kqn_sched_waitq);
spin_unlock_irqrestore (&kqswnal_data.kqn_sched_lock, flags);
return (0);
spin_lock_irqsave (&kqswnal_data.kqn_sched_lock, flags);
list_add_tail (&krx->krx_list, &kqswnal_data.kqn_readyrxds);
- if (waitqueue_active (&kqswnal_data.kqn_sched_waitq))
- wake_up (&kqswnal_data.kqn_sched_waitq);
+ wake_up (&kqswnal_data.kqn_sched_waitq);
spin_unlock_irqrestore (&kqswnal_data.kqn_sched_lock, flags);
}
void
ksocknal_put_route (ksock_route_t *route)
{
- CDEBUG (D_OTHER, "putting route[%p] -> "LPX64" (%d)\n",
- route, route->ksnr_peer->ksnp_nid,
- atomic_read (&route->ksnr_refcount));
+ CDEBUG (D_OTHER, "putting route[%p] (%d)\n",
+ route, atomic_read (&route->ksnr_refcount));
LASSERT (atomic_read (&route->ksnr_refcount) > 0);
if (!atomic_dec_and_test (&route->ksnr_refcount))
spin_lock (&ksocknal_data.ksnd_reaper_lock);
list_add_tail (&conn->ksnc_list, &ksocknal_data.ksnd_deathrow_conns);
- if (waitqueue_active (&ksocknal_data.ksnd_reaper_waitq))
- wake_up (&ksocknal_data.ksnd_reaper_waitq);
+ wake_up (&ksocknal_data.ksnd_reaper_waitq);
spin_unlock (&ksocknal_data.ksnd_reaper_lock);
}
spin_lock_irqsave (&ksocknal_data.ksnd_reaper_lock, flags);
list_add (&conn->ksnc_list, &ksocknal_data.ksnd_zombie_conns);
- if (waitqueue_active (&ksocknal_data.ksnd_reaper_waitq))
- wake_up (&ksocknal_data.ksnd_reaper_waitq);
+ wake_up (&ksocknal_data.ksnd_reaper_waitq);
spin_unlock_irqrestore (&ksocknal_data.ksnd_reaper_lock, flags);
}
# define sk_socket socket
#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
+# define sk_wmem_queued wmem_queued
+#endif
+
typedef struct /* pool of forwarding buffers */
{
spinlock_t fmp_lock; /* serialise */
list_add_tail (<x->ltx_tx.tx_list, ltx->ltx_idle);
/* normal tx desc => wakeup anyone blocking for one */
- if (ltx->ltx_idle == &ksocknal_data.ksnd_idle_ltx_list &&
- waitqueue_active (&ksocknal_data.ksnd_idle_ltx_waitq))
+ if (ltx->ltx_idle == &ksocknal_data.ksnd_idle_ltx_list)
wake_up (&ksocknal_data.ksnd_idle_ltx_waitq);
spin_unlock_irqrestore (&ksocknal_data.ksnd_idle_ltx_lock, flags);
spin_lock_irqsave (&sched->kss_lock, flags);
list_add_tail (&tx->tx_list, &sched->kss_zctxdone_list);
- if (waitqueue_active (&sched->kss_waitq))
- wake_up (&sched->kss_waitq);
+ wake_up (&sched->kss_waitq);
spin_unlock_irqrestore (&sched->kss_lock, flags);
EXIT;
list_add_tail (&route->ksnr_connect_list,
&ksocknal_data.ksnd_autoconnectd_routes);
-
- if (waitqueue_active (&ksocknal_data.ksnd_autoconnectd_waitq))
- wake_up (&ksocknal_data.ksnd_autoconnectd_waitq);
+ wake_up (&ksocknal_data.ksnd_autoconnectd_waitq);
spin_unlock_irqrestore (&ksocknal_data.ksnd_autoconnectd_lock, flags);
}
list_add_tail (&conn->ksnc_tx_list,
&sched->kss_tx_conns);
conn->ksnc_tx_scheduled = 1;
- if (waitqueue_active (&sched->kss_waitq))
- wake_up (&sched->kss_waitq);
+ wake_up (&sched->kss_waitq);
}
spin_unlock_irqrestore (&sched->kss_lock, flags);
spin_lock_irqsave (&sched->kss_lock, flags);
list_add_tail (&conn->ksnc_rx_list, &sched->kss_rx_conns);
-
- if (waitqueue_active (&sched->kss_waitq))
- wake_up (&sched->kss_waitq);
+ wake_up (&sched->kss_waitq);
spin_unlock_irqrestore (&sched->kss_lock, flags);
}
kportal_daemonize (name);
kportal_blockallsigs ();
+ current->flags |= PF_MEMALLOC;
+
#if (CONFIG_SMP && CPU_AFFINITY)
if ((cpu_online_map & (1 << id)) != 0) {
#if 1
/* extra ref for scheduler */
atomic_inc (&conn->ksnc_refcount);
- if (waitqueue_active (&sched->kss_waitq))
- wake_up (&sched->kss_waitq);
+ wake_up (&sched->kss_waitq);
}
spin_unlock_irqrestore (&sched->kss_lock, flags);
/* extra ref for scheduler */
atomic_inc (&conn->ksnc_refcount);
- if (waitqueue_active (&sched->kss_waitq))
- wake_up (&sched->kss_waitq);
+ wake_up (&sched->kss_waitq);
}
spin_unlock_irqrestore (&sched->kss_lock, flags);
}
if ((!list_empty (&conn->ksnc_tx_queue) ||
- conn->ksnc_sock->sk->wmem_queued != 0) &&
+ conn->ksnc_sock->sk->sk_wmem_queued != 0) &&
time_after_eq (jiffies, conn->ksnc_tx_deadline)) {
/* Timed out messages queued for sending, or
* messages buffered in the socket's send buffer */
CERROR ("Timed out TX to "LPX64" %s%d %p\n",
peer->ksnp_nid,
list_empty (&conn->ksnc_tx_queue) ? "" : "Q ",
- conn->ksnc_sock->sk->wmem_queued, conn);
+ conn->ksnc_sock->sk->sk_wmem_queued, conn);
return (conn);
}
}
for (;;)
{
LASSERT (niov <= tx->tx_niov);
- LASSERT (iov->iov_len >= 0);
if (iov->iov_len >= nob)
{
if (!file || IS_ERR(file)) {
CERROR("cannot open %s for logging", debug_daemon_file_path);
GOTO(out1, PTR_ERR(file));
- } else {
- printk(KERN_ALERT "LustreError: daemon dumping log to %s ... writing ...\n",
- debug_daemon_file_path);
}
+ printk(KERN_INFO "daemon dumping log to %s\n", debug_daemon_file_path);
debug_daemon_state.overlapped = 0;
debug_daemon_state.stopped = 0;
rc = file->f_op->write(file, debug_buf+start,
size, &file->f_pos);
if (rc < 0) {
- printk(KERN_ALERT
- "LustreError: Debug_daemon write error %d\n", rc);
+ printk(KERN_ALERT "LustreError: Debug_daemon "
+ "write error %d\n", rc);
goto out;
}
start += rc;
if (force_flush) {
rc = file->f_op->fsync(file, file->f_dentry, 1);
if (rc < 0) {
- printk(KERN_ALERT
- "LustreError: Debug_daemon sync error %d\n", rc);
+ printk(KERN_ALERT "LustreError: Debug_daemon "
+ "sync error %d\n", rc);
goto out;
}
if (debug_daemon_state.stopped)
- break;
+ break;
debug_daemon_state.lctl_event = 1;
wake_up(&debug_daemon_state.lctl);
}
- wait_event(debug_daemon_state.daemon,
+ wait_event(debug_daemon_state.daemon,
debug_daemon_state.daemon_event);
}
out:
return -EINVAL;
CDEBUG(0, "********************************************************\n");
- CERROR("DEBUG MARKER: %s\n", text);
+ CWARN("DEBUG MARKER: %s\n", text);
CDEBUG(0, "********************************************************\n");
return 0;
__s32 portals_debug_copy_to_user(char *buf, unsigned long len)
{
int rc;
- unsigned long debug_off, i, off, copied;
+ unsigned long total, debug_off, i, off, copied;
unsigned long flags;
struct page *page;
LIST_HEAD(my_pages);
}
list_add(&page->list, &my_pages);
}
-
+
spin_lock_irqsave(&portals_debug_lock, flags);
debug_off = atomic_read(&debug_off_a);
-
+
/* Sigh. If the buffer is empty, then skip to the end. */
if (debug_off == 0 && !debug_wrapped) {
spin_unlock_irqrestore(&portals_debug_lock, flags);
goto cleanup;
}
- if (debug_wrapped)
+ if (debug_wrapped) {
off = debug_off + 1;
- else
+ total = debug_size;
+ } else {
off = 0;
+ total = debug_off;
+ }
copied = 0;
list_for_each(pos, &my_pages) {
unsigned long to_copy;
page = list_entry(pos, struct page, list);
- to_copy = min(debug_size - off, PAGE_SIZE);
+ to_copy = min(total - off, PAGE_SIZE);
if (to_copy == 0) {
off = 0;
to_copy = min(debug_size - off, PAGE_SIZE);
memcpy(kmap(page), debug_buf + off, to_copy);
kunmap(page);
copied += to_copy;
- if (copied >= (debug_wrapped ? debug_size : debug_off))
+ if (copied >= total)
break;
-
+
off += to_copy;
if (off >= debug_size) {
off = 0;
break;
}
rc = copied;
-
+
cleanup:
list_for_each_safe(pos, n, &my_pages) {
page = list_entry(pos, struct page, list);
max_nob = debug_size - debug_off + DEBUG_OVERFLOW;
if (max_nob <= 0) {
spin_unlock_irqrestore(&portals_debug_lock, flags);
- printk("LustreError: logic error in portals_debug_msg: <0 bytes"
- " to write\n");
+ printk("LustreError: logic error in portals_debug_msg: "
+ "< 0 bytes to write\n");
return;
}
do_gettimeofday(&tv);
prefix_nob = snprintf(debug_buf + debug_off, max_nob,
- "%06x:%06x:%d:%lu.%06lu :",
+ "%06x:%06x:%d:%lu.%06lu:%lu:%d:",
subsys, mask, smp_processor_id(),
- tv.tv_sec, tv.tv_usec);
+ tv.tv_sec, tv.tv_usec, stack, current->pid);
max_nob -= prefix_nob;
- if(*(format + strlen(format) - 1) == '\n')
- *(format + strlen(format) - 1) = ':';
-
- va_start(ap, format);
- msg_nob = vsnprintf(debug_buf + debug_off + prefix_nob ,
- max_nob, format, ap);
- max_nob -= msg_nob;
- va_end(ap);
+ if(*(format + strlen(format) - 1) != '\n')
+ *(format + strlen(format)) = '\n';
#if defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20))
- msg_nob += snprintf(debug_buf + debug_off + prefix_nob + msg_nob, max_nob,
- "(%s:%d:%s() %d | %d+%lu)\n",
- file, line, fn, current->pid,
- current->thread.extern_pid, stack);
+ msg_nob = snprintf(debug_buf + debug_off + prefix_nob, max_nob,
+ "%d:(%s:%d:%s()) ",
+ current->thread.extern_pid, file, line, fn);
#elif defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- msg_nob += snprintf(debug_buf + debug_off + prefix_nob + msg_nob, max_nob,
- "(%s:%d:%s() %d | %d+%lu)\n",
- file, line, fn, current->pid,
- current->thread.mode.tt.extern_pid, stack);
+ msg_nob = snprintf(debug_buf + debug_off + prefix_nob, max_nob,
+ "%d:(%s:%d:%s()) ",
+ current->thread.mode.tt.extern_pid, file, line, fn);
#else
- msg_nob += snprintf(debug_buf + debug_off + prefix_nob + msg_nob, max_nob,
- "(%s:%d:%s() %d+%lu)\n",
- file, line, fn, current->pid, stack);
+ msg_nob = snprintf(debug_buf + debug_off + prefix_nob, max_nob,
+ ":(%s:%d:%s()) ",
+ file, line, fn);
#endif
+ va_start(ap, format);
+ msg_nob += vsnprintf(debug_buf + debug_off + prefix_nob + msg_nob,
+ max_nob, format, ap);
+ max_nob -= msg_nob;
+ va_end(ap);
+
/* Print to console, while msg is contiguous in debug_buf */
/* NB safely terminated see above */
if ((mask & D_EMERG) != 0)
printk(KERN_EMERG "LustreError: %s",
debug_buf + debug_off + prefix_nob);
- if ((mask & D_ERROR) != 0)
- printk(KERN_ERR "LustreError: %s",
+ else if ((mask & D_ERROR) != 0)
+ printk(KERN_ERR "LustreError: %s",
+ debug_buf + debug_off + prefix_nob);
+ else if ((mask & D_WARNING) != 0)
+ printk(KERN_WARNING "Lustre: %s",
debug_buf + debug_off + prefix_nob);
else if (portal_printk)
- printk("<%d>LustreError: %s", portal_printk, debug_buf+debug_off+prefix_nob);
+ printk("<%d>Lustre: %s", portal_printk,
+ debug_buf+debug_off+prefix_nob);
base_offset = debug_off & 0xFFFF;
debug_off += prefix_nob + msg_nob;
argc++;
LASSERT(argc >= 2);
-
- rc = call_usermodehelper(argv[0], argv, envp);
+
+ rc = USERMODEHELPER(argv[0], argv, envp);
if (rc < 0) {
CERROR("Error %d invoking portals upcall %s %s%s%s%s%s%s%s%s; "
"check /proc/sys/portals/upcall\n",
int rc;
kpr_control_interface_t *ci;
+ /* No error if router not preset. Sysadmin is allowed to notify
+ * _everywhere_ when a NID boots or crashes, even if they know
+ * nothing of the peer. */
ci = (kpr_control_interface_t *)PORTAL_SYMBOL_GET(kpr_control_interface);
if (ci == NULL)
- return (-ENODEV);
+ return (0);
rc = ci->kprci_notify (gw_nalid, gw_nid, alive, when);
unsigned long flags;
lib_me_t *me;
- if (args->index_in < 0 || args->index_in >= tbl->size)
+ if (args->index_in >= tbl->size)
return ret->rc = PTL_INV_PTINDEX;
/* Should check for valid matchid, but not yet */
ptl_size_t frag_len;
int dst_niov;
- LASSERT (len >= 0);
- LASSERT (offset >= 0);
LASSERT (offset + len <= md->length);
if (len == 0) /* no data => */
ptl_size_t frag_len;
int dst_niov;
- LASSERT (len >= 0);
- LASSERT (offset >= 0);
LASSERT (offset + len <= md->length);
if (len == 0) /* no data => */
#include <portals/lib-p30.h>
#include <portals/arg-blocks.h>
-#define MAX_DIST 18446744073709551615UL
+#define MAX_DIST 18446744073709551615ULL
int do_PtlNIDebug(nal_cb_t * nal, void *private, void *v_args, void *v_ret)
{
int alive, time_t when)
{
unsigned long flags;
- int rc = -ENOENT;
+ int found;
kpr_nal_entry_t *ne = NULL;
kpr_gateway_entry_t *ge = NULL;
struct timeval now;
struct list_head *e;
struct list_head *n;
- CDEBUG (D_ERROR, "%s notifying [%d] "LPX64": %s\n",
+ CDEBUG (D_NET, "%s notifying [%d] "LPX64": %s\n",
byNal ? "NAL" : "userspace",
gateway_nalid, gateway_nid, alive ? "up" : "down");
/* Serialise with lookups (i.e. write lock) */
write_lock_irqsave(&kpr_rwlock, flags);
+ found = 0;
list_for_each_safe (e, n, &kpr_gateways) {
ge = list_entry(e, kpr_gateway_entry_t, kpge_list);
ge->kpge_nid != gateway_nid)
continue;
- rc = 0;
+ found = 1;
break;
}
- if (rc != 0) {
+ if (!found) {
/* gateway not found */
write_unlock_irqrestore(&kpr_rwlock, flags);
CDEBUG (D_NET, "Gateway not found\n");
- return (rc);
+ return (0);
}
if (when < ge->kpge_timestamp) {
}
}
+ found = 0;
if (!byNal) {
/* userland notified me: notify NAL? */
ne = kpr_find_nal_entry_locked (ge->kpge_nalid);
if (ne != NULL) {
- if (ne->kpne_shutdown ||
- ne->kpne_interface.kprni_notify == NULL) {
- /* no need to notify */
- ne = NULL;
- } else {
+ if (!ne->kpne_shutdown &&
+ ne->kpne_interface.kprni_notify != NULL) {
/* take a ref on this NAL until notifying
* it has completed... */
atomic_inc (&ne->kpne_refcount);
+ found = 1;
}
}
}
write_unlock_irqrestore(&kpr_rwlock, flags);
- if (ne != NULL) {
+ if (found) {
ne->kpne_interface.kprni_notify (ne->kpne_interface.kprni_arg,
gateway_nid, alive);
/* 'ne' can disappear now... */
atomic_set (&ge->kpge_weight, 0);
PORTAL_ALLOC (re, sizeof (*re));
- if (re == NULL)
+ if (re == NULL) {
+ PORTAL_FREE (ge, sizeof (*ge));
return (-ENOMEM);
+ }
re->kpre_lo_nid = lo_nid;
re->kpre_hi_nid = hi_nid;
typedef struct
{
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
- struct work_struct kpru_tq;
-#else
- struct tq_struct kpru_tq;
-#endif
+ work_struct_t kpru_tq;
int kpru_nal_id;
ptl_nid_t kpru_nid;
int kpru_alive;
arg = strtok(line, " \t");
if ( arg ) {
- argv[i] = arg;
+ argv[i] = arg;
i++;
} else
return 0;
cmd = Parser_findargcmd(argv[0], cmds);
if ( cmd ) {
- return (cmd->pc_func)(argc, argv);
+ int rc = (cmd->pc_func)(argc, argv);
+ if (rc == CMD_HELP)
+ fprintf(stderr, "%s\n", cmd->pc_help);
+ return rc;
} else {
printf("Try interactive use without arguments or use one of:\n");
for (cmd = cmds; cmd->pc_name; cmd++)
return (0);
memset (&tm, 0, sizeof (tm));
- n = sscanf (str, "%d-%d-%d %d:%d:%d",
+ n = sscanf (str, "%d-%d-%d-%d:%d:%d",
&tm.tm_year, &tm.tm_mon, &tm.tm_mday,
&tm.tm_hour, &tm.tm_min, &tm.tm_sec);
if (n != 6)
when = now.tv_sec;
} else if (ptl_parse_time (&when, argv[3]) != 0) {
fprintf(stderr, "Can't parse time %s\n"
- "Please specify either 'YYYY-MM-DD HH:MM:SS'\n"
+ "Please specify either 'YYYY-MM-DD-HH:MM:SS'\n"
"or an absolute unix time in seconds\n", argv[3]);
return (-1);
} else if (when > now.tv_sec) {
Documentation/filesystems/ext2.txt | 16 ++
- fs/ext3/Makefile | 2
fs/ext3/inode.c | 3
fs/ext3/iopen.c | 239 +++++++++++++++++++++++++++++++++++++
fs/ext3/iopen.h | 15 ++
fs/ext3/namei.c | 13 ++
- fs/ext3/super.c | 11 +
+ fs/ext3/super.c | 17 ++
include/linux/ext3_fs.h | 2
- 8 files changed, 300 insertions(+), 1 deletion(-)
+ 7 files changed, 304 insertions(+), 1 deletion(-)
-Index: linux-2.6.0-test6/Documentation/filesystems/ext2.txt
-===================================================================
---- linux-2.6.0-test6.orig/Documentation/filesystems/ext2.txt 2003-10-07 16:19:10.593048704 +0800
-+++ linux-2.6.0-test6/Documentation/filesystems/ext2.txt 2003-10-07 16:19:49.129190320 +0800
-@@ -35,6 +35,22 @@
+--- linux-2.6.0-test6/Documentation/filesystems/ext2.txt~iopen-2.6.0-test6 2002-11-11 06:28:06.000000000 +0300
++++ linux-2.6.0-test6-alexey/Documentation/filesystems/ext2.txt 2003-10-14 17:03:48.000000000 +0400
+@@ -35,6 +35,22 @@ resgid=n The group ID which may use th
sb=n Use alternate superblock at this location.
grpquota,noquota,quota,usrquota Quota options are silently ignored by ext2.
-Index: linux-2.6.0-test6/fs/ext3/inode.c
-===================================================================
---- linux-2.6.0-test6.orig/fs/ext3/inode.c 2003-10-07 16:19:10.595048400 +0800
-+++ linux-2.6.0-test6/fs/ext3/inode.c 2003-10-07 16:19:49.131190016 +0800
+--- linux-2.6.0-test6/fs/ext3/inode.c~iopen-2.6.0-test6 2003-10-14 17:03:47.000000000 +0400
++++ linux-2.6.0-test6-alexey/fs/ext3/inode.c 2003-10-14 17:03:48.000000000 +0400
@@ -37,6 +37,7 @@
#include <linux/mpage.h>
#include <linux/uio.h>
#include "acl.h"
/*
-@@ -2479,6 +2480,8 @@
+@@ -2479,6 +2480,8 @@ void ext3_read_inode(struct inode * inod
ei->i_acl = EXT3_ACL_NOT_CACHED;
ei->i_default_acl = EXT3_ACL_NOT_CACHED;
#endif
if (ext3_get_inode_loc(inode, &iloc, 0))
goto bad_inode;
bh = iloc.bh;
-Index: linux-2.6.0-test6/fs/ext3/iopen.c
-===================================================================
---- linux-2.6.0-test6.orig/fs/ext3/iopen.c 2003-10-07 16:19:49.109193360 +0800
-+++ linux-2.6.0-test6/fs/ext3/iopen.c 2003-10-07 16:19:49.132189864 +0800
+--- /dev/null 2003-01-30 13:24:37.000000000 +0300
++++ linux-2.6.0-test6-alexey/fs/ext3/iopen.c 2003-10-14 17:03:48.000000000 +0400
@@ -0,0 +1,239 @@
+
+
+
+ return 1;
+}
-Index: linux-2.6.0-test6/fs/ext3/iopen.h
-===================================================================
---- linux-2.6.0-test6.orig/fs/ext3/iopen.h 2003-10-07 16:19:49.109193360 +0800
-+++ linux-2.6.0-test6/fs/ext3/iopen.h 2003-10-07 16:19:49.132189864 +0800
+--- /dev/null 2003-01-30 13:24:37.000000000 +0300
++++ linux-2.6.0-test6-alexey/fs/ext3/iopen.h 2003-10-14 17:03:48.000000000 +0400
@@ -0,0 +1,15 @@
+/*
+ * iopen.h
+extern int ext3_iopen_get_inode(struct inode * inode);
+
+
-Index: linux-2.6.0-test6/fs/ext3/namei.c
-===================================================================
---- linux-2.6.0-test6.orig/fs/ext3/namei.c 2003-10-07 16:19:10.597048096 +0800
-+++ linux-2.6.0-test6/fs/ext3/namei.c 2003-10-07 16:19:49.133189712 +0800
+--- linux-2.6.0-test6/fs/ext3/namei.c~iopen-2.6.0-test6 2003-10-14 17:03:47.000000000 +0400
++++ linux-2.6.0-test6-alexey/fs/ext3/namei.c 2003-10-14 17:03:48.000000000 +0400
@@ -37,6 +37,7 @@
#include <linux/buffer_head.h>
#include <linux/smp_lock.h>
#include "acl.h"
/*
-@@ -970,15 +971,21 @@
+@@ -970,15 +971,21 @@ errout:
}
#endif
bh = ext3_find_entry(dentry, &de);
inode = NULL;
if (bh) {
-@@ -991,6 +998,12 @@
+@@ -991,6 +998,12 @@ static struct dentry *ext3_lookup(struct
}
if (inode)
return d_splice_alias(inode, dentry);
d_add(dentry, inode);
return NULL;
}
-Index: linux-2.6.0-test6/fs/ext3/super.c
-===================================================================
---- linux-2.6.0-test6.orig/fs/ext3/super.c 2003-10-07 16:19:10.599047792 +0800
-+++ linux-2.6.0-test6/fs/ext3/super.c 2003-10-07 16:25:14.799680880 +0800
-@@ -534,7 +534,7 @@
+--- linux-2.6.0-test6/fs/ext3/super.c~iopen-2.6.0-test6 2003-10-14 17:03:47.000000000 +0400
++++ linux-2.6.0-test6-alexey/fs/ext3/super.c 2003-10-14 17:03:48.000000000 +0400
+@@ -534,7 +534,7 @@ enum {
Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl, Opt_noload,
Opt_commit, Opt_journal_update, Opt_journal_inum,
Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback,
};
static match_table_t tokens = {
-@@ -573,6 +573,9 @@
+@@ -573,6 +573,9 @@ static match_table_t tokens = {
{Opt_ignore, "noquota"},
{Opt_ignore, "quota"},
{Opt_ignore, "usrquota"},
{Opt_err, NULL}
};
-@@ -760,6 +763,18 @@
+@@ -760,6 +763,18 @@ static int parse_options (char * options
case Opt_abort:
set_opt(sbi->s_mount_opt, ABORT);
break;
case Opt_ignore:
break;
default:
-Index: linux-2.6.0-test6/include/linux/ext3_fs.h
-===================================================================
---- linux-2.6.0-test6.orig/include/linux/ext3_fs.h 2003-10-07 16:19:10.600047640 +0800
-+++ linux-2.6.0-test6/include/linux/ext3_fs.h 2003-10-07 16:19:49.136189256 +0800
-@@ -324,6 +324,8 @@
+--- linux-2.6.0-test6/include/linux/ext3_fs.h~iopen-2.6.0-test6 2003-10-14 17:03:47.000000000 +0400
++++ linux-2.6.0-test6-alexey/include/linux/ext3_fs.h 2003-10-14 17:03:48.000000000 +0400
+@@ -325,6 +325,8 @@ struct ext3_inode {
#define EXT3_MOUNT_NO_UID32 0x2000 /* Disable 32-bit UIDs */
#define EXT3_MOUNT_XATTR_USER 0x4000 /* Extended user attributes */
#define EXT3_MOUNT_POSIX_ACL 0x8000 /* POSIX Access Control Lists */
/* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
#ifndef _LINUX_EXT2_FS_H
+
+_
--- /dev/null
+ drivers/net/pcnet32.c | 16 ++++++++++++++++
+ 1 files changed, 16 insertions(+)
+
+diff -puN drivers/net/pcnet32.c~kgdbeth-pcnet32-support drivers/net/pcnet32.c
+--- linux-2.6.0-test6-mm/drivers/net/pcnet32.c~kgdbeth-pcnet32-support 2003-10-06 00:45:54.000000000 +0400
++++ linux-2.6.0-test6-mm-alexey/drivers/net/pcnet32.c 2003-10-06 00:54:55.000000000 +0400
+@@ -331,6 +331,9 @@ static int pcnet32_init_ring(struct net
+ static int pcnet32_start_xmit(struct sk_buff *, struct net_device *);
+ static int pcnet32_rx(struct net_device *);
+ static void pcnet32_tx_timeout (struct net_device *dev);
++#ifdef CONFIG_NET_POLL_CONTROLLER
++static void pcnet32_rx_poll(struct net_device *);
++#endif
+ static irqreturn_t pcnet32_interrupt(int, void *, struct pt_regs *);
+ static int pcnet32_close(struct net_device *);
+ static struct net_device_stats *pcnet32_get_stats(struct net_device *);
+@@ -806,6 +809,10 @@ pcnet32_probe1(unsigned long ioaddr, uns
+ dev->tx_timeout = pcnet32_tx_timeout;
+ dev->watchdog_timeo = (5*HZ);
+
++#ifdef CONFIG_NET_POLL_CONTROLLER
++ dev->poll_controller = pcnet32_rx_poll;
++#endif
++
+ lp->next = pcnet32_dev;
+ pcnet32_dev = dev;
+
+@@ -1152,6 +1159,15 @@ pcnet32_start_xmit(struct sk_buff *skb,
+ return 0;
+ }
+
++#ifdef CONFIG_NET_POLL_CONTROLLER
++static void pcnet32_rx_poll(struct net_device *dev)
++{
++ disable_irq(dev->irq);
++ pcnet32_interrupt(dev->irq, (void *)dev, 0);
++ enable_irq(dev->irq);
++}
++#endif
++
+ /* The PCNET32 interrupt handler. */
+ static irqreturn_t
+ pcnet32_interrupt(int irq, void *dev_id, struct pt_regs * regs)
+
+_
--- /dev/null
+ arch/um/kernel/process.c | 2 +-
+ arch/um/kernel/skas/process.c | 26 +++++++++++++-------------
+ arch/um/kernel/skas/syscall_kern.c | 3 ++-
+ arch/um/kernel/trap_user.c | 2 +-
+ arch/um/kernel/tt/syscall_kern.c | 3 ++-
+ arch/um/kernel/tt/uaccess_user.c | 2 +-
+ arch/um/kernel/uaccess_user.c | 2 +-
+ arch/um/link.ld.in | 1 -
+ 8 files changed, 21 insertions(+), 20 deletions(-)
+
+Index: linux-2.4.20/arch/um/link.ld.in
+===================================================================
+--- linux-2.4.20.orig/arch/um/link.ld.in 2003-10-25 00:35:59.000000000 +0400
++++ linux-2.4.20/arch/um/link.ld.in 2003-10-25 00:36:02.000000000 +0400
+@@ -6,7 +6,6 @@
+ {
+ . = START() + SIZEOF_HEADERS;
+
+- . = ALIGN(4096);
+ __binary_start = .;
+ ifdef(`MODE_TT', `
+ .thread_private : {
+Index: linux-2.4.20/arch/um/kernel/process.c
+===================================================================
+--- linux-2.4.20.orig/arch/um/kernel/process.c 2003-10-25 00:35:59.000000000 +0400
++++ linux-2.4.20/arch/um/kernel/process.c 2003-10-25 00:36:02.000000000 +0400
+@@ -232,7 +232,7 @@
+ int n;
+
+ *jmp_ptr = &buf;
+- n = setjmp(buf);
++ n = sigsetjmp(buf, 1);
+ if(n != 0)
+ return(n);
+ (*fn)(arg);
+Index: linux-2.4.20/arch/um/kernel/skas/process.c
+===================================================================
+--- linux-2.4.20.orig/arch/um/kernel/skas/process.c 2003-10-25 00:35:59.000000000 +0400
++++ linux-2.4.20/arch/um/kernel/skas/process.c 2003-10-25 00:36:02.000000000 +0400
+@@ -59,11 +59,11 @@
+ int err, syscall_nr, status;
+
+ syscall_nr = PT_SYSCALL_NR(regs->skas.regs);
++ UPT_SYSCALL_NR(regs) = syscall_nr;
+ if(syscall_nr < 1){
+ relay_signal(SIGTRAP, regs);
+ return;
+ }
+- UPT_SYSCALL_NR(regs) = syscall_nr;
+
+ err = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET, __NR_getpid);
+ if(err < 0)
+@@ -189,7 +189,7 @@
+ *switch_buf_ptr = &switch_buf;
+ *fork_buf_ptr = &fork_buf;
+
+- if(setjmp(fork_buf) == 0)
++ if(sigsetjmp(fork_buf, 1) == 0)
+ new_thread_proc(stack, handler);
+
+ remove_sigstack();
+@@ -201,8 +201,8 @@
+
+ *switch_buf = &buf;
+ fork_buf = fb;
+- if(setjmp(buf) == 0)
+- longjmp(*fork_buf, 1);
++ if(sigsetjmp(buf, 1) == 0)
++ siglongjmp(*fork_buf, 1);
+ }
+
+ static int move_registers(int int_op, int fp_op, union uml_pt_regs *regs,
+@@ -260,8 +260,8 @@
+ jmp_buf my_buf, **me_ptr = me, *next_buf = next;
+
+ *me_ptr = &my_buf;
+- if(setjmp(my_buf) == 0)
+- longjmp(*next_buf, 1);
++ if(sigsetjmp(my_buf, 1) == 0)
++ siglongjmp(*next_buf, 1);
+ }
+
+ static jmp_buf initial_jmpbuf;
+@@ -277,14 +277,14 @@
+ int n;
+
+ *fork_buf_ptr = &initial_jmpbuf;
+- n = setjmp(initial_jmpbuf);
++ n = sigsetjmp(initial_jmpbuf, 1);
+ if(n == 0)
+ new_thread_proc((void *) stack, new_thread_handler);
+ else if(n == 1)
+ remove_sigstack();
+ else if(n == 2){
+ (*cb_proc)(cb_arg);
+- longjmp(*cb_back, 1);
++ siglongjmp(*cb_back, 1);
+ }
+ else if(n == 3){
+ kmalloc_ok = 0;
+@@ -294,7 +294,7 @@
+ kmalloc_ok = 0;
+ return(1);
+ }
+- longjmp(**switch_buf, 1);
++ siglongjmp(**switch_buf, 1);
+ }
+
+ void remove_sigstack(void)
+@@ -316,8 +316,8 @@
+ cb_back = &here;
+
+ block_signals();
+- if(setjmp(here) == 0)
+- longjmp(initial_jmpbuf, 2);
++ if(sigsetjmp(here, 1) == 0)
++ siglongjmp(initial_jmpbuf, 2);
+ unblock_signals();
+
+ cb_proc = NULL;
+@@ -328,13 +328,13 @@
+ void halt_skas(void)
+ {
+ block_signals();
+- longjmp(initial_jmpbuf, 3);
++ siglongjmp(initial_jmpbuf, 3);
+ }
+
+ void reboot_skas(void)
+ {
+ block_signals();
+- longjmp(initial_jmpbuf, 4);
++ siglongjmp(initial_jmpbuf, 4);
+ }
+
+ int new_mm(int from)
+Index: linux-2.4.20/arch/um/kernel/skas/syscall_kern.c
+===================================================================
+--- linux-2.4.20.orig/arch/um/kernel/skas/syscall_kern.c 2003-10-25 00:35:59.000000000 +0400
++++ linux-2.4.20/arch/um/kernel/skas/syscall_kern.c 2003-10-25 00:36:02.000000000 +0400
+@@ -23,7 +23,8 @@
+ nsyscalls++;
+ syscall = UPT_SYSCALL_NR(®s->regs);
+
+- if((syscall >= NR_syscalls) || (syscall < 0))
++ if((syscall >= NR_syscalls) || (syscall < 0) ||
++ (sys_call_table[syscall] == NULL))
+ res = -ENOSYS;
+ else res = EXECUTE_SYSCALL(syscall, regs);
+
+Index: linux-2.4.20/arch/um/kernel/trap_user.c
+===================================================================
+--- linux-2.4.20.orig/arch/um/kernel/trap_user.c 2003-10-25 00:35:59.000000000 +0400
++++ linux-2.4.20/arch/um/kernel/trap_user.c 2003-10-25 00:36:02.000000000 +0400
+@@ -125,7 +125,7 @@
+ {
+ jmp_buf *buf = b;
+
+- longjmp(*buf, val);
++ siglongjmp(*buf, val);
+ }
+
+ /*
+Index: linux-2.4.20/arch/um/kernel/tt/syscall_kern.c
+===================================================================
+--- linux-2.4.20.orig/arch/um/kernel/tt/syscall_kern.c 2003-10-25 00:35:59.000000000 +0400
++++ linux-2.4.20/arch/um/kernel/tt/syscall_kern.c 2003-10-25 00:36:02.000000000 +0400
+@@ -113,7 +113,8 @@
+ nsyscalls++;
+ syscall = UPT_SYSCALL_NR(®s->regs);
+
+- if((syscall >= NR_syscalls) || (syscall < 0))
++ if((syscall >= NR_syscalls) || (syscall < 0) ||
++ (sys_call_table[syscall] == NULL))
+ res = -ENOSYS;
+ else if(honeypot && check_bogosity(regs))
+ res = -EFAULT;
+Index: linux-2.4.20/arch/um/kernel/tt/uaccess_user.c
+===================================================================
+--- linux-2.4.20.orig/arch/um/kernel/tt/uaccess_user.c 2003-10-25 00:35:59.000000000 +0400
++++ linux-2.4.20/arch/um/kernel/tt/uaccess_user.c 2003-10-25 00:36:02.000000000 +0400
+@@ -75,7 +75,7 @@
+ jmp_buf jbuf;
+
+ *fault_catcher = &jbuf;
+- if(setjmp(jbuf) == 0){
++ if(sigsetjmp(jbuf, 1) == 0){
+ ret = strlen(str) + 1;
+ }
+ else {
+Index: linux-2.4.20/arch/um/kernel/uaccess_user.c
+===================================================================
+--- linux-2.4.20.orig/arch/um/kernel/uaccess_user.c 2003-10-25 00:35:59.000000000 +0400
++++ linux-2.4.20/arch/um/kernel/uaccess_user.c 2003-10-25 00:36:02.000000000 +0400
+@@ -20,7 +20,7 @@
+
+ jmp_buf jbuf;
+ *fault_catcher = &jbuf;
+- if(setjmp(jbuf) == 0){
++ if(sigsetjmp(jbuf, 1) == 0){
+ (*op)(to, from, n);
+ ret = 0;
+ *faulted_out = 0;
+Index: linux-2.4.20/arch/um/kernel/tt/ptproxy/sysdep.c
+===================================================================
+--- linux-2.4.20.orig/arch/um/kernel/tt/ptproxy/sysdep.c 2003-10-25 00:35:59.000000000 +0400
++++ linux-2.4.20/arch/um/kernel/tt/ptproxy/sysdep.c 2003-10-25 00:36:23.000000000 +0400
+@@ -9,6 +9,7 @@
+ #include <string.h>
+ #include <stdlib.h>
+ #include <signal.h>
++#include <errno.h>
+ #include <sys/types.h>
+ #include <sys/ptrace.h>
+ #include <asm/ptrace.h>
+++ /dev/null
-fs/ext3/ialloc.c
-fs/ext3/inode.c
-fs/ext3/super.c
-fs/ext3/xattr.c
-include/linux/ext3_fs.h
-include/linux/ext3_fs_i.h
+++ /dev/null
-fs/ext3/dir.c
-fs/ext3/file.c
-fs/ext3/hash.c
-fs/ext3/Makefile
-fs/ext3/namei.c
-fs/ext3/super.c
-include/linux/ext3_fs.h
-include/linux/ext3_fs_sb.h
-include/linux/ext3_jbd.h
-include/linux/rbtree.h
-lib/rbtree.c
+++ /dev/null
-fs/ext3/namei.c
-fs/ext3/namei.c.orig
-fs/ext3/super.c
-include/linux/ext3_fs_sb.h
-include/linux/ext3_fs_sb.h.orig
+++ /dev/null
-fs/ext3/ialloc.c
-fs/ext3/inode.c
-fs/ext3/ioctl.c
-fs/ext3/namei.c
-include/linux/dcache.h
-include/linux/ext3_fs.h
+++ /dev/null
-fs/ext3/ialloc.c
-fs/ext3/inode.c
-fs/ext3/ioctl.c
-fs/ext3/namei.c
-include/linux/dcache.h
-include/linux/ext3_fs.h
+++ /dev/null
-fs/inode.c
-fs/Makefile
-mm/page_alloc.c
+++ /dev/null
-fs/file_table.c
-fs/inode.c
-fs/Makefile
-fs/namei.c
-fs/nfsd/export.c
-fs/nfsd/nfsfh.c
-fs/nfsd/vfs.c
-include/linux/fs.h
-kernel/ksyms.c
+++ /dev/null
-fs/file_table.c
-fs/inode.c
-fs/Makefile
-fs/namei.c
-fs/nfsd/export.c
-fs/nfsd/nfsfh.c
-fs/nfsd/vfs.c
-include/linux/fs.h
-kernel/ksyms.c
+++ /dev/null
-fs/file_table.c
-fs/inode.c
-fs/Makefile
-fs/namei.c
-fs/nfsd/export.c
-fs/nfsd/nfsfh.c
-fs/nfsd/vfs.c
-include/linux/fs.h
-kernel/ksyms.c
+++ /dev/null
-include/linux/socket.h
-net/netsyms.c
-net/socket.c
+++ /dev/null
-include/linux/skbuff.h
-include/net/tcp.h
-net/core/skbuff.c
-net/ipv4/tcp.c
-net/netsyms.c
+++ /dev/null
-fs/dcache.c
-fs/exec.c
-fs/namei.c
-fs/namespace.c
-fs/open.c
-fs/stat.c
-include/linux/dcache.h
-include/linux/fs.h
-include/linux/fs_struct.h
-kernel/exit.c
-kernel/fork.c
-kernel/ksyms.c
+++ /dev/null
-arch/alpha/defconfig
-arch/alpha/kernel/entry.S
-arch/arm/defconfig
-arch/arm/kernel/calls.S
-arch/i386/defconfig
-arch/ia64/defconfig
-arch/m68k/defconfig
-arch/mips64/defconfig
-arch/mips/defconfig
-arch/ppc64/kernel/misc.S
-arch/ppc/defconfig
-arch/s390/defconfig
-arch/s390/kernel/entry.S
-arch/s390x/defconfig
-arch/s390x/kernel/entry.S
-arch/s390x/kernel/wrapper32.S
-arch/sparc64/defconfig
-arch/sparc/defconfig
-Documentation/Configure.help
-fs/Config.in
-fs/ext2/file.c
-fs/ext2/ialloc.c
-fs/ext2/inode.c
-fs/ext2/Makefile
-fs/ext2/namei.c
-fs/ext2/super.c
-fs/ext2/symlink.c
-fs/ext2/xattr.c
-fs/ext2/xattr_user.c
-fs/ext3/ext3-exports.c
-fs/ext3/file.c
-fs/ext3/ialloc.c
-fs/ext3/inode.c
-fs/ext3/Makefile
-fs/ext3/namei.c
-fs/ext3/super.c
-fs/ext3/symlink.c
-fs/ext3/xattr.c
-fs/ext3/xattr_user.c
-fs/jfs/jfs_xattr.h
-fs/jfs/xattr.c
-fs/Makefile
-fs/mbcache.c
-include/asm-arm/unistd.h
-include/asm-ppc64/unistd.h
-include/asm-s390/unistd.h
-include/asm-s390x/unistd.h
-include/linux/cache_def.h
-include/linux/errno.h
-include/linux/ext2_fs.h
-include/linux/ext2_xattr.h
-include/linux/ext3_fs.h
-include/linux/ext3_jbd.h
-include/linux/ext3_xattr.h
-include/linux/fs.h
-include/linux/mbcache.h
-kernel/ksyms.c
-mm/vmscan.c
jbd-commit-tricks.patch
add_page_private.patch
socket-exports-2.4.22-rh.patch
-nfs_export_kernel-2.4.22-rh
+nfs_export_kernel-2.4.22-rh.patch
+ext3-ea-in-inode-2.4.22-rh.patch
+listman-2.4.20.patch
+ext3-trusted_ea-2.4.20.patch
obj-y += mds.o
mds-objs := mds_lov.o handler.o mds_reint.o mds_fs.o lproc_mds.o mds_open.o \
- mds_lib.o mds_unlink_open.o
+ mds_lib.o mds_unlink_open.o mds_log.o
if (current->need_resched)
schedule ();
}
+#define work_struct_t struct tq_struct
#else
{
cond_resched();
}
+#define work_struct_t struct work_struct
+
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) */
#ifdef PORTAL_DEBUG
/* temporary expedient: limit number of entries in discontiguous MDs */
# define PTL_MTU (512<<10)
# define PTL_MD_MAX_IOV 128
+# define PTL_MD_MAX_PAGES min_t(int, PTL_MD_MAX_IOV, PTL_MTU / PAGE_SIZE)
struct lib_msg_t {
struct list_head msg_list;
#ifndef __INCLUDE_GMNAL_H__
#define __INCLUDE_GMNAL_H__
+#ifndef EXPORT_SYMTAB
+# define EXPORT_SYMTAB
+#endif
+
#include "linux/config.h"
#include "linux/module.h"
#include "linux/tty.h"
#include "linux/init.h"
#include "linux/sem.h"
#include "linux/vmalloc.h"
-#ifdef MODVERSIONS
-#include <linux/modversions.h>
-#endif
#define DEBUG_SUBSYSTEM S_GMNAL
#include "gm_internal.h"
+
/*
* Defines for the API NAL
*/
*dist = 27;
return(PTL_OK);
}
-
-
-
-
-EXPORT_SYMBOL(gmnal_cb_send);
-EXPORT_SYMBOL(gmnal_cb_send_pages);
-EXPORT_SYMBOL(gmnal_cb_recv);
-EXPORT_SYMBOL(gmnal_cb_recv_pages);
-EXPORT_SYMBOL(gmnal_cb_read);
-EXPORT_SYMBOL(gmnal_cb_write);
-EXPORT_SYMBOL(gmnal_cb_cli);
-EXPORT_SYMBOL(gmnal_cb_sti);
-EXPORT_SYMBOL(gmnal_cb_dist);
-EXPORT_SYMBOL(gmnal_cb_printf);
-EXPORT_SYMBOL(gmnal_cb_map);
-EXPORT_SYMBOL(gmnal_cb_unmap);
-EXPORT_SYMBOL(gmnal_cb_callback);
-EXPORT_SYMBOL(gmnal_cb_free);
-EXPORT_SYMBOL(gmnal_cb_malloc);
list_del (&fwd->kprfd_list);
}
- if (waitqueue_active (&kqswnal_data.kqn_idletxd_waitq)) /* process? */
- {
- /* local sender waiting for tx desc */
- CDEBUG(D_NET,"wakeup process\n");
- wake_up (&kqswnal_data.kqn_idletxd_waitq);
- }
+ wake_up (&kqswnal_data.kqn_idletxd_waitq);
spin_unlock_irqrestore (&kqswnal_data.kqn_idletxd_lock, flags);
spin_lock_irqsave (&kqswnal_data.kqn_sched_lock, flags);
list_add_tail (&fwd->kprfd_list, &kqswnal_data.kqn_delayedfwds);
- if (waitqueue_active (&kqswnal_data.kqn_sched_waitq))
- wake_up (&kqswnal_data.kqn_sched_waitq);
+ wake_up (&kqswnal_data.kqn_sched_waitq);
spin_unlock_irqrestore (&kqswnal_data.kqn_sched_lock, flags);
}
spin_lock_irqsave (&kqswnal_data.kqn_sched_lock, flags);
list_add_tail (&ktx->ktx_delayed_list, &kqswnal_data.kqn_delayedtxds);
- if (waitqueue_active (&kqswnal_data.kqn_sched_waitq))
- wake_up (&kqswnal_data.kqn_sched_waitq);
+ wake_up (&kqswnal_data.kqn_sched_waitq);
spin_unlock_irqrestore (&kqswnal_data.kqn_sched_lock, flags);
return (0);
spin_lock_irqsave (&kqswnal_data.kqn_sched_lock, flags);
list_add_tail (&krx->krx_list, &kqswnal_data.kqn_readyrxds);
- if (waitqueue_active (&kqswnal_data.kqn_sched_waitq))
- wake_up (&kqswnal_data.kqn_sched_waitq);
+ wake_up (&kqswnal_data.kqn_sched_waitq);
spin_unlock_irqrestore (&kqswnal_data.kqn_sched_lock, flags);
}
void
ksocknal_put_route (ksock_route_t *route)
{
- CDEBUG (D_OTHER, "putting route[%p] -> "LPX64" (%d)\n",
- route, route->ksnr_peer->ksnp_nid,
- atomic_read (&route->ksnr_refcount));
+ CDEBUG (D_OTHER, "putting route[%p] (%d)\n",
+ route, atomic_read (&route->ksnr_refcount));
LASSERT (atomic_read (&route->ksnr_refcount) > 0);
if (!atomic_dec_and_test (&route->ksnr_refcount))
spin_lock (&ksocknal_data.ksnd_reaper_lock);
list_add_tail (&conn->ksnc_list, &ksocknal_data.ksnd_deathrow_conns);
- if (waitqueue_active (&ksocknal_data.ksnd_reaper_waitq))
- wake_up (&ksocknal_data.ksnd_reaper_waitq);
+ wake_up (&ksocknal_data.ksnd_reaper_waitq);
spin_unlock (&ksocknal_data.ksnd_reaper_lock);
}
spin_lock_irqsave (&ksocknal_data.ksnd_reaper_lock, flags);
list_add (&conn->ksnc_list, &ksocknal_data.ksnd_zombie_conns);
- if (waitqueue_active (&ksocknal_data.ksnd_reaper_waitq))
- wake_up (&ksocknal_data.ksnd_reaper_waitq);
+ wake_up (&ksocknal_data.ksnd_reaper_waitq);
spin_unlock_irqrestore (&ksocknal_data.ksnd_reaper_lock, flags);
}
# define sk_socket socket
#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
+# define sk_wmem_queued wmem_queued
+#endif
+
typedef struct /* pool of forwarding buffers */
{
spinlock_t fmp_lock; /* serialise */
list_add_tail (<x->ltx_tx.tx_list, ltx->ltx_idle);
/* normal tx desc => wakeup anyone blocking for one */
- if (ltx->ltx_idle == &ksocknal_data.ksnd_idle_ltx_list &&
- waitqueue_active (&ksocknal_data.ksnd_idle_ltx_waitq))
+ if (ltx->ltx_idle == &ksocknal_data.ksnd_idle_ltx_list)
wake_up (&ksocknal_data.ksnd_idle_ltx_waitq);
spin_unlock_irqrestore (&ksocknal_data.ksnd_idle_ltx_lock, flags);
spin_lock_irqsave (&sched->kss_lock, flags);
list_add_tail (&tx->tx_list, &sched->kss_zctxdone_list);
- if (waitqueue_active (&sched->kss_waitq))
- wake_up (&sched->kss_waitq);
+ wake_up (&sched->kss_waitq);
spin_unlock_irqrestore (&sched->kss_lock, flags);
EXIT;
list_add_tail (&route->ksnr_connect_list,
&ksocknal_data.ksnd_autoconnectd_routes);
-
- if (waitqueue_active (&ksocknal_data.ksnd_autoconnectd_waitq))
- wake_up (&ksocknal_data.ksnd_autoconnectd_waitq);
+ wake_up (&ksocknal_data.ksnd_autoconnectd_waitq);
spin_unlock_irqrestore (&ksocknal_data.ksnd_autoconnectd_lock, flags);
}
list_add_tail (&conn->ksnc_tx_list,
&sched->kss_tx_conns);
conn->ksnc_tx_scheduled = 1;
- if (waitqueue_active (&sched->kss_waitq))
- wake_up (&sched->kss_waitq);
+ wake_up (&sched->kss_waitq);
}
spin_unlock_irqrestore (&sched->kss_lock, flags);
spin_lock_irqsave (&sched->kss_lock, flags);
list_add_tail (&conn->ksnc_rx_list, &sched->kss_rx_conns);
-
- if (waitqueue_active (&sched->kss_waitq))
- wake_up (&sched->kss_waitq);
+ wake_up (&sched->kss_waitq);
spin_unlock_irqrestore (&sched->kss_lock, flags);
}
kportal_daemonize (name);
kportal_blockallsigs ();
+ current->flags |= PF_MEMALLOC;
+
#if (CONFIG_SMP && CPU_AFFINITY)
if ((cpu_online_map & (1 << id)) != 0) {
#if 1
/* extra ref for scheduler */
atomic_inc (&conn->ksnc_refcount);
- if (waitqueue_active (&sched->kss_waitq))
- wake_up (&sched->kss_waitq);
+ wake_up (&sched->kss_waitq);
}
spin_unlock_irqrestore (&sched->kss_lock, flags);
/* extra ref for scheduler */
atomic_inc (&conn->ksnc_refcount);
- if (waitqueue_active (&sched->kss_waitq))
- wake_up (&sched->kss_waitq);
+ wake_up (&sched->kss_waitq);
}
spin_unlock_irqrestore (&sched->kss_lock, flags);
}
if ((!list_empty (&conn->ksnc_tx_queue) ||
- conn->ksnc_sock->sk->wmem_queued != 0) &&
+ conn->ksnc_sock->sk->sk_wmem_queued != 0) &&
time_after_eq (jiffies, conn->ksnc_tx_deadline)) {
/* Timed out messages queued for sending, or
* messages buffered in the socket's send buffer */
CERROR ("Timed out TX to "LPX64" %s%d %p\n",
peer->ksnp_nid,
list_empty (&conn->ksnc_tx_queue) ? "" : "Q ",
- conn->ksnc_sock->sk->wmem_queued, conn);
+ conn->ksnc_sock->sk->sk_wmem_queued, conn);
return (conn);
}
}
for (;;)
{
LASSERT (niov <= tx->tx_niov);
- LASSERT (iov->iov_len >= 0);
if (iov->iov_len >= nob)
{
if (!file || IS_ERR(file)) {
CERROR("cannot open %s for logging", debug_daemon_file_path);
GOTO(out1, PTR_ERR(file));
- } else {
- printk(KERN_ALERT "LustreError: daemon dumping log to %s ... writing ...\n",
- debug_daemon_file_path);
}
+ printk(KERN_INFO "daemon dumping log to %s\n", debug_daemon_file_path);
debug_daemon_state.overlapped = 0;
debug_daemon_state.stopped = 0;
rc = file->f_op->write(file, debug_buf+start,
size, &file->f_pos);
if (rc < 0) {
- printk(KERN_ALERT
- "LustreError: Debug_daemon write error %d\n", rc);
+ printk(KERN_ALERT "LustreError: Debug_daemon "
+ "write error %d\n", rc);
goto out;
}
start += rc;
if (force_flush) {
rc = file->f_op->fsync(file, file->f_dentry, 1);
if (rc < 0) {
- printk(KERN_ALERT
- "LustreError: Debug_daemon sync error %d\n", rc);
+ printk(KERN_ALERT "LustreError: Debug_daemon "
+ "sync error %d\n", rc);
goto out;
}
if (debug_daemon_state.stopped)
- break;
+ break;
debug_daemon_state.lctl_event = 1;
wake_up(&debug_daemon_state.lctl);
}
- wait_event(debug_daemon_state.daemon,
+ wait_event(debug_daemon_state.daemon,
debug_daemon_state.daemon_event);
}
out:
return -EINVAL;
CDEBUG(0, "********************************************************\n");
- CERROR("DEBUG MARKER: %s\n", text);
+ CWARN("DEBUG MARKER: %s\n", text);
CDEBUG(0, "********************************************************\n");
return 0;
__s32 portals_debug_copy_to_user(char *buf, unsigned long len)
{
int rc;
- unsigned long debug_off, i, off, copied;
+ unsigned long total, debug_off, i, off, copied;
unsigned long flags;
struct page *page;
LIST_HEAD(my_pages);
}
list_add(&page->list, &my_pages);
}
-
+
spin_lock_irqsave(&portals_debug_lock, flags);
debug_off = atomic_read(&debug_off_a);
-
+
/* Sigh. If the buffer is empty, then skip to the end. */
if (debug_off == 0 && !debug_wrapped) {
spin_unlock_irqrestore(&portals_debug_lock, flags);
goto cleanup;
}
- if (debug_wrapped)
+ if (debug_wrapped) {
off = debug_off + 1;
- else
+ total = debug_size;
+ } else {
off = 0;
+ total = debug_off;
+ }
copied = 0;
list_for_each(pos, &my_pages) {
unsigned long to_copy;
page = list_entry(pos, struct page, list);
- to_copy = min(debug_size - off, PAGE_SIZE);
+ to_copy = min(total - off, PAGE_SIZE);
if (to_copy == 0) {
off = 0;
to_copy = min(debug_size - off, PAGE_SIZE);
memcpy(kmap(page), debug_buf + off, to_copy);
kunmap(page);
copied += to_copy;
- if (copied >= (debug_wrapped ? debug_size : debug_off))
+ if (copied >= total)
break;
-
+
off += to_copy;
if (off >= debug_size) {
off = 0;
break;
}
rc = copied;
-
+
cleanup:
list_for_each_safe(pos, n, &my_pages) {
page = list_entry(pos, struct page, list);
max_nob = debug_size - debug_off + DEBUG_OVERFLOW;
if (max_nob <= 0) {
spin_unlock_irqrestore(&portals_debug_lock, flags);
- printk("LustreError: logic error in portals_debug_msg: <0 bytes"
- " to write\n");
+ printk("LustreError: logic error in portals_debug_msg: "
+ "< 0 bytes to write\n");
return;
}
do_gettimeofday(&tv);
prefix_nob = snprintf(debug_buf + debug_off, max_nob,
- "%06x:%06x:%d:%lu.%06lu :",
+ "%06x:%06x:%d:%lu.%06lu:%lu:%d:",
subsys, mask, smp_processor_id(),
- tv.tv_sec, tv.tv_usec);
+ tv.tv_sec, tv.tv_usec, stack, current->pid);
max_nob -= prefix_nob;
- if(*(format + strlen(format) - 1) == '\n')
- *(format + strlen(format) - 1) = ':';
-
- va_start(ap, format);
- msg_nob = vsnprintf(debug_buf + debug_off + prefix_nob ,
- max_nob, format, ap);
- max_nob -= msg_nob;
- va_end(ap);
+ if(*(format + strlen(format) - 1) != '\n')
+ *(format + strlen(format)) = '\n';
#if defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20))
- msg_nob += snprintf(debug_buf + debug_off + prefix_nob + msg_nob, max_nob,
- "(%s:%d:%s() %d | %d+%lu)\n",
- file, line, fn, current->pid,
- current->thread.extern_pid, stack);
+ msg_nob = snprintf(debug_buf + debug_off + prefix_nob, max_nob,
+ "%d:(%s:%d:%s()) ",
+ current->thread.extern_pid, file, line, fn);
#elif defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- msg_nob += snprintf(debug_buf + debug_off + prefix_nob + msg_nob, max_nob,
- "(%s:%d:%s() %d | %d+%lu)\n",
- file, line, fn, current->pid,
- current->thread.mode.tt.extern_pid, stack);
+ msg_nob = snprintf(debug_buf + debug_off + prefix_nob, max_nob,
+ "%d:(%s:%d:%s()) ",
+ current->thread.mode.tt.extern_pid, file, line, fn);
#else
- msg_nob += snprintf(debug_buf + debug_off + prefix_nob + msg_nob, max_nob,
- "(%s:%d:%s() %d+%lu)\n",
- file, line, fn, current->pid, stack);
+ msg_nob = snprintf(debug_buf + debug_off + prefix_nob, max_nob,
+ ":(%s:%d:%s()) ",
+ file, line, fn);
#endif
+ va_start(ap, format);
+ msg_nob += vsnprintf(debug_buf + debug_off + prefix_nob + msg_nob,
+ max_nob, format, ap);
+ max_nob -= msg_nob;
+ va_end(ap);
+
/* Print to console, while msg is contiguous in debug_buf */
/* NB safely terminated see above */
if ((mask & D_EMERG) != 0)
printk(KERN_EMERG "LustreError: %s",
debug_buf + debug_off + prefix_nob);
- if ((mask & D_ERROR) != 0)
- printk(KERN_ERR "LustreError: %s",
+ else if ((mask & D_ERROR) != 0)
+ printk(KERN_ERR "LustreError: %s",
+ debug_buf + debug_off + prefix_nob);
+ else if ((mask & D_WARNING) != 0)
+ printk(KERN_WARNING "Lustre: %s",
debug_buf + debug_off + prefix_nob);
else if (portal_printk)
- printk("<%d>LustreError: %s", portal_printk, debug_buf+debug_off+prefix_nob);
+ printk("<%d>Lustre: %s", portal_printk,
+ debug_buf+debug_off+prefix_nob);
base_offset = debug_off & 0xFFFF;
debug_off += prefix_nob + msg_nob;
argc++;
LASSERT(argc >= 2);
-
- rc = call_usermodehelper(argv[0], argv, envp);
+
+ rc = USERMODEHELPER(argv[0], argv, envp);
if (rc < 0) {
CERROR("Error %d invoking portals upcall %s %s%s%s%s%s%s%s%s; "
"check /proc/sys/portals/upcall\n",
int rc;
kpr_control_interface_t *ci;
+ /* No error if router not preset. Sysadmin is allowed to notify
+ * _everywhere_ when a NID boots or crashes, even if they know
+ * nothing of the peer. */
ci = (kpr_control_interface_t *)PORTAL_SYMBOL_GET(kpr_control_interface);
if (ci == NULL)
- return (-ENODEV);
+ return (0);
rc = ci->kprci_notify (gw_nalid, gw_nid, alive, when);
unsigned long flags;
lib_me_t *me;
- if (args->index_in < 0 || args->index_in >= tbl->size)
+ if (args->index_in >= tbl->size)
return ret->rc = PTL_INV_PTINDEX;
/* Should check for valid matchid, but not yet */
ptl_size_t frag_len;
int dst_niov;
- LASSERT (len >= 0);
- LASSERT (offset >= 0);
LASSERT (offset + len <= md->length);
if (len == 0) /* no data => */
ptl_size_t frag_len;
int dst_niov;
- LASSERT (len >= 0);
- LASSERT (offset >= 0);
LASSERT (offset + len <= md->length);
if (len == 0) /* no data => */
#include <portals/lib-p30.h>
#include <portals/arg-blocks.h>
-#define MAX_DIST 18446744073709551615UL
+#define MAX_DIST 18446744073709551615ULL
int do_PtlNIDebug(nal_cb_t * nal, void *private, void *v_args, void *v_ret)
{
int alive, time_t when)
{
unsigned long flags;
- int rc = -ENOENT;
+ int found;
kpr_nal_entry_t *ne = NULL;
kpr_gateway_entry_t *ge = NULL;
struct timeval now;
struct list_head *e;
struct list_head *n;
- CDEBUG (D_ERROR, "%s notifying [%d] "LPX64": %s\n",
+ CDEBUG (D_NET, "%s notifying [%d] "LPX64": %s\n",
byNal ? "NAL" : "userspace",
gateway_nalid, gateway_nid, alive ? "up" : "down");
/* Serialise with lookups (i.e. write lock) */
write_lock_irqsave(&kpr_rwlock, flags);
+ found = 0;
list_for_each_safe (e, n, &kpr_gateways) {
ge = list_entry(e, kpr_gateway_entry_t, kpge_list);
ge->kpge_nid != gateway_nid)
continue;
- rc = 0;
+ found = 1;
break;
}
- if (rc != 0) {
+ if (!found) {
/* gateway not found */
write_unlock_irqrestore(&kpr_rwlock, flags);
CDEBUG (D_NET, "Gateway not found\n");
- return (rc);
+ return (0);
}
if (when < ge->kpge_timestamp) {
}
}
+ found = 0;
if (!byNal) {
/* userland notified me: notify NAL? */
ne = kpr_find_nal_entry_locked (ge->kpge_nalid);
if (ne != NULL) {
- if (ne->kpne_shutdown ||
- ne->kpne_interface.kprni_notify == NULL) {
- /* no need to notify */
- ne = NULL;
- } else {
+ if (!ne->kpne_shutdown &&
+ ne->kpne_interface.kprni_notify != NULL) {
/* take a ref on this NAL until notifying
* it has completed... */
atomic_inc (&ne->kpne_refcount);
+ found = 1;
}
}
}
write_unlock_irqrestore(&kpr_rwlock, flags);
- if (ne != NULL) {
+ if (found) {
ne->kpne_interface.kprni_notify (ne->kpne_interface.kprni_arg,
gateway_nid, alive);
/* 'ne' can disappear now... */
atomic_set (&ge->kpge_weight, 0);
PORTAL_ALLOC (re, sizeof (*re));
- if (re == NULL)
+ if (re == NULL) {
+ PORTAL_FREE (ge, sizeof (*ge));
return (-ENOMEM);
+ }
re->kpre_lo_nid = lo_nid;
re->kpre_hi_nid = hi_nid;
typedef struct
{
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
- struct work_struct kpru_tq;
-#else
- struct tq_struct kpru_tq;
-#endif
+ work_struct_t kpru_tq;
int kpru_nal_id;
ptl_nid_t kpru_nid;
int kpru_alive;
arg = strtok(line, " \t");
if ( arg ) {
- argv[i] = arg;
+ argv[i] = arg;
i++;
} else
return 0;
cmd = Parser_findargcmd(argv[0], cmds);
if ( cmd ) {
- return (cmd->pc_func)(argc, argv);
+ int rc = (cmd->pc_func)(argc, argv);
+ if (rc == CMD_HELP)
+ fprintf(stderr, "%s\n", cmd->pc_help);
+ return rc;
} else {
printf("Try interactive use without arguments or use one of:\n");
for (cmd = cmds; cmd->pc_name; cmd++)
return (0);
memset (&tm, 0, sizeof (tm));
- n = sscanf (str, "%d-%d-%d %d:%d:%d",
+ n = sscanf (str, "%d-%d-%d-%d:%d:%d",
&tm.tm_year, &tm.tm_mon, &tm.tm_mday,
&tm.tm_hour, &tm.tm_min, &tm.tm_sec);
if (n != 6)
when = now.tv_sec;
} else if (ptl_parse_time (&when, argv[3]) != 0) {
fprintf(stderr, "Can't parse time %s\n"
- "Please specify either 'YYYY-MM-DD HH:MM:SS'\n"
+ "Please specify either 'YYYY-MM-DD-HH:MM:SS'\n"
"or an absolute unix time in seconds\n", argv[3]);
return (-1);
} else if (when > now.tv_sec) {
/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ * The companion to ll_sparseness_write; walk all the bytes in the file.
+ * the bytes at the offsets specified on the command line must be '+', as
+ * previously written by ll_sparseness_write. All other bytes must be
+ * 0.
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <stdarg.h>
#define BUFSIZE (1024*1024)
-int compfunc(const void *x, const void *y)
-{
- if (*(unsigned int *)x < *(unsigned int *)y) {
- return -1;
- } else if (*(unsigned int *)x == *(unsigned int *)y) {
- return 0;
- } else {
- return 1;
- }
-}
-
-/* sort offsets and delete redundant data in offsets
- * no return
- */
-void collapse_redundant(unsigned *offsets, int offsetcount)
-{
- int i, j;
- qsort(offsets, offsetcount, sizeof(unsigned int), compfunc);
-
- /* collapse the redundant offsets */
- for (i = 0; i < offsetcount - 1; i++) {
- if (offsets[i] == offsets[i + 1]) {
- for (j = i; j < offsetcount; j++) {
- offsets[j] = offsets[j + 1];
- }
- offsetcount--;
- }
- }
-}
-
-/* verify the sparse pwrite from page(0) to page(filesize / BUFSIZE)
- * if sucess return last verified page number else return (-1)
- */
-int verify_content(int fd, int filesize, unsigned int *offsets,
- int O_number)
+void error(char *fmt, ...)
{
- int i , j;
- char *filebuf;
- int focus = 0;
- int p_number;
-
- filebuf = (char*) malloc(BUFSIZE);
-
- p_number = filesize / BUFSIZE;
- for (j = 0; j < p_number ; j++) {
-
- i = read(fd, filebuf, BUFSIZE);
-
- if (i != BUFSIZE) {
- fprintf(stderr,
- "Reading file fails (%s), returning (%d)\n",
- strerror(errno), i);
- free(filebuf);
- return -1;
- }
-
- /* check the position that should hold '+'
- * If correct, change it to 0 in the buffer */
- for (; focus < O_number; focus++) {
- if (offsets[focus] < (j + 1) * BUFSIZE - 1) {
- if (filebuf[offsets[focus] % BUFSIZE] != '+') {
- fprintf(stderr,
- "Bad content, should \
- be '+' at %d.\n",
- offsets[focus]);
- free(filebuf);
- return -1;
- } else {
- /* '+', change it to 0 for comparison */
- filebuf[offsets[focus] % BUFSIZE] = 0;
- }
- }
- }
-
- /* Hopefully '+' should have been changed to 0
- * Thus, we should not encounter any strange character */
- for (i = 0; i < BUFSIZE; i++) {
- if (filebuf[i] != 0) {
- fprintf(stderr,
- "Bad content, should be 0 at %d.\n",
- i + j * BUFSIZE);
- free(filebuf);
- return -1;
- }
- }
- }
-
- free(filebuf);
- return focus;
+ va_list ap;
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ exit(1);
}
-/* verify the sparse pwrite with last page
- * if sucess return 0 else return 1
- */
-int verify_tail(int fd, int filesize, unsigned int *offsets,
- int O_number, int focus)
+int compare_offsets(const void *a, const void *b)
{
- int i;
- char *filebuf;
- int p_number;
-
- filebuf = (char*) malloc(BUFSIZE);
-
- /* The last page */
- p_number = filesize % BUFSIZE;
- i = read(fd, filebuf, p_number);
- if (i != p_number) {
- fprintf(stderr, "Reading file fails (%s), returning (%d)\n",
- strerror(errno), i);
- free(filebuf);
- return 1;
- }
- for (; focus < O_number; focus++) {
- if (offsets[focus] < filesize) {
- if (filebuf[offsets[focus] % BUFSIZE] != '+') {
- fprintf(stderr,
- "Bad content, should be '+' at %d.\n",
- offsets[focus]);
- free(filebuf);
- return 1;
- } else {
- /* '+', change it to 0 for later comparison */
- filebuf[offsets[focus]%BUFSIZE] = 0;
- }
- } else {
- fprintf(stderr,
- "Error: File size <= offset %d\n",
- offsets[focus]);
- free(filebuf);
- return 1;
- }
- }
-
- for (i = 0; i < p_number; i++) {
- if (filebuf[i] != 0) {
- fprintf(stderr, "Bad content, should be 0 at %d.\n",
- filesize - (p_number - i) - 1);
- free(filebuf);
- return 1;
- }
- }
-
- free(filebuf);
- return 0;
+ off_t *A = (off_t *)a;
+ off_t *B = (off_t *)b;
+ return *A - *B;
}
-/* Function: verify the sparse pwrite (bug 1222): the charaters at
- * <offset> should be '+', and all other characters should be 0
- * Return: 0 success
- * 1 failure*/
-int verify(char *filename, unsigned int *offsets, int O_number)
+int main(int argc, char **argv)
{
- int status;
- unsigned int size;
+ unsigned int num_offsets, cur_off = 0, i;
+ off_t *offsets, pos = 0, end_of_buf = 0;
+ char *end, *buf;
+ struct stat st;
+ ssize_t ret;
int fd;
- struct stat Fstat;
-
- status = stat(filename, &Fstat);
- if (status == -1) {
- fprintf(stderr, "No such file named as %s.\n", filename);
- return 1;
- }
- size = Fstat.st_size;
-
- /* Because we always have '+' just before EOF,
- * qsorted offsets[] should have the (filesize-1) at the end */
- if (size != offsets[O_number - 1] + 1) {
- fprintf(stderr,
- "Error: the final character not in the offset?\n");
- return 1;
- }
-
- /* now we check the integrity of the file */
- fd = open(filename, O_RDONLY);
- if (fd == -1) {
- fprintf(stderr, "Openning %s fails (%s)\n",
- filename, strerror(errno));
- return 1;
- }
- if((status = verify_content(fd, size, offsets, O_number)) < 0) {
- close(fd);
- return status ;
- }
+ if (argc < 3)
+ error("Usage: %s <filename> <offset> [ offset ... ]\n",
+ argv[0]);
- return verify_tail(fd, size, offsets, O_number, status);
-}
+ fd = open(argv[1], O_RDONLY);
+ if (fd < 0)
+ error("couldn't open %s: %s\n", argv[1], strerror(errno));
-/* verify the sparse pwrite file with the charaters at <offset>
- * should be '+', and all other characters should be 0
- */
-int main(int argc, char**argv)
-{
- int i;
- char *filename;
- char *end;
- int O_number;
- unsigned int *offsets;
+ buf = malloc(BUFSIZE);
+ if (buf == NULL)
+ error("can't allocate buffer\n");
- if (argc < 3) {
- fprintf(stderr,
- "Usage: %s <filename> <offset> [ offset ... ]\n",
- argv[0]);
- exit(1);
+ num_offsets = argc - 2;
+ offsets = calloc(sizeof(offsets[0]), num_offsets);
+ for (i = 0; i < num_offsets; i++) {
+ offsets[i] = strtoul(argv[i + 2], &end, 10);
+ if (*end)
+ error("couldn't parse offset '%s'\n", argv[i + 2]);
}
+ qsort(offsets, num_offsets, sizeof(offsets[0]), compare_offsets);
+
+ if (fstat(fd, &st) < 0)
+ error("stat: %s\n", strerror(errno));
+
+ for (i = 0; pos < st.st_size; i++, pos++) {
+ if (pos == end_of_buf) {
+ ret = read(fd, buf, BUFSIZE);
+ if (ret < 0)
+ error("read(): %s\n", strerror(errno));
+ end_of_buf = pos + ret;
+ if (end_of_buf > st.st_size)
+ error("read %d bytes past file size?\n",
+ end_of_buf - st.st_size);
+ i = 0;
+ }
- filename = argv[1];
- O_number = argc - 2;
- offsets = (unsigned int *) malloc(sizeof(unsigned int) * O_number);
- for (i = 0; i < O_number; i++) {
- offsets[i] = strtoul(argv[i + 2], &end, 10);
- if (*end) {
- fprintf(stderr,
- "<offset> parameter should be integer\n");
- exit(1);
+ /* check for 0 when we aren't at a given offset */
+ if (cur_off >= num_offsets || pos != offsets[cur_off]) {
+ if (buf[i] != 0)
+ error("found char 0x%x at pos %lu instead of "
+ "0x0\n", buf[i], (long)pos);
+ continue;
}
- }
- collapse_redundant(offsets, O_number);
+ /* the command line asks us to check for + at this offset */
+ if (buf[i] != '+')
+ error("found char 0x%x at pos %lu instead of "
+ "'.'\n", buf[i], (long)pos);
- return verify(filename,offsets,O_number);
+ /* skip over duplicate offset arguments */
+ while (cur_off < num_offsets && offsets[cur_off] == pos)
+ cur_off++;
+ }
+ /* don't bother freeing or closing.. */
+ return 0;
}
-
--- /dev/null
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ * Each loop does 3 things:
+ * - rank 0 truncates to 0
+ * - all ranks agree on a random chunk size
+ * - all ranks race to write their pattern to their chunk of the file
+ * - rank 0 makes sure that the resulting file size is ranks * chunk size
+ * - rank 0 makes sure that everyone's patterns went to the right place
+ *
+ * compile: mpicc -g -Wall -o write_disjoint write_disjoint.c
+ * run: mpirun -np N -machlist <hostlist file> write_disjoint
+ * or: pdsh -w <N hosts> write_disjoint
+ * or: prun -n N [-N M] write_disjoint
+ */
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include "mpi.h"
+
+
+#define FILENAME "/mnt/lustre/write_disjoint"
+#define CHUNK_MAX_SIZE 123456
+
+int rprintf(int rank, int loop, const char *fmt, ...)
+{
+ va_list ap;
+
+ printf("rank %d, loop %d: ", rank, loop);
+
+ va_start(ap, fmt);
+
+ vprintf(fmt, ap);
+
+ MPI_Finalize();
+ exit(1);
+}
+
+int main (int argc, char *argv[]) {
+ int i, n, fd, chunk_size, file_size;
+ int rank, noProcessors, done;
+ off_t offset;
+ char **chunk_buf;
+ char *read_buf;
+ struct stat stat_buf;
+ ssize_t ret;
+
+ MPI_Init(&argc, &argv);
+ MPI_Comm_size(MPI_COMM_WORLD, &noProcessors);
+ MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+
+ chunk_buf = malloc(noProcessors * sizeof(chunk_buf[0]));
+ for (i=0; i < noProcessors; i++) {
+ chunk_buf[i] = malloc(CHUNK_MAX_SIZE);
+ memset(chunk_buf[i], 'A'+ i, CHUNK_MAX_SIZE);
+ }
+ read_buf = malloc(noProcessors * CHUNK_MAX_SIZE);
+
+ if (rank == 0) {
+ fd = open(FILENAME, O_WRONLY|O_CREAT|O_TRUNC, 0666);
+ if (fd < 0)
+ rprintf(rank, -1, "open() returned %s\n",
+ strerror(errno));
+ }
+ MPI_Barrier(MPI_COMM_WORLD);
+
+ fd = open(FILENAME, O_RDWR);
+ if (fd < 0)
+ rprintf(rank, -1, "open() returned %s\n", strerror(errno));
+
+ for (n=0; n < 1000 ; n++) {
+ /* reset the environment */
+ if (rank == 0) {
+ ret = truncate(FILENAME, 0);
+ if (ret != 0)
+ rprintf(rank, n, "truncate() returned %s\n",
+ strerror(errno) );
+ }
+ chunk_size = rand() % CHUNK_MAX_SIZE;
+
+ if (n % 1000 == 0 && rank == 0)
+ printf("loop %d: chunk_size %d\n", n, chunk_size);
+
+ MPI_Barrier(MPI_COMM_WORLD);
+
+ /* Do the race */
+ offset = rank * chunk_size;
+ lseek(fd, offset, SEEK_SET);
+
+ done = 0;
+ do {
+ ret = write(fd, chunk_buf[rank]+done, chunk_size-done);
+ if (ret < 0)
+ rprintf(rank, n, "write() returned %s\n",
+ strerror(errno));
+ done += ret;
+ } while (done != chunk_size);
+
+ MPI_Barrier(MPI_COMM_WORLD);
+
+ /* Check the result */
+ if (rank == 0) {
+ lseek(fd, 0, SEEK_SET);
+
+ /* quick check */
+ stat(FILENAME, &stat_buf);
+ file_size = stat_buf.st_size;
+ if (file_size != chunk_size * noProcessors)
+ rprintf(rank, n, "invalid file size %d"
+ " instead of %d\n", file_size,
+ chunk_size * noProcessors);
+
+ done = 0;
+ do {
+ ret = read(fd, read_buf + done,
+ (chunk_size * noProcessors) - done);
+ if (ret < 0)
+ rprintf(rank, n, "read returned %s\n",
+ strerror(errno));
+
+ done += ret;
+ } while (done != chunk_size * noProcessors);
+
+ for (i = 0; i < noProcessors; i++) {
+ char command[4096];
+ int j;
+ if (!memcmp(read_buf + (i * chunk_size),
+ chunk_buf[i], chunk_size))
+ continue;
+
+ printf("rank %d, loop %d: chunk %d corrupted "
+ "with chunk_size %d\n", rank, n, i,
+ chunk_size);
+ printf("(ranks: page boundry, chunk boundry, "
+ "page boundry)\n");
+ for (j = 1 ; j < noProcessors; j++) {
+ int b = j * chunk_size;
+ printf("\t%c -> %c: %d %d %d\n",
+ 'A' + j - 1, 'A' + j,
+ b & ~(4096-1), b,
+ (b + 4096) & ~(4096-1));
+ }
+
+ sprintf(command, "od -Ad -a %s", FILENAME);
+ system(command);
+ MPI_Finalize();
+ exit(1);
+ }
+ }
+ }
+
+ printf("Finished after %d loops\n", n);
+ MPI_Finalize();
+ return 0;
+}
--- /dev/null
+#!/bin/bash
+PATH=`dirname $0`:$PATH
+lfs find "$@"
#include "parser.h"
-extern int op_create_file(char *name, long stripe_size, int stripe_offset,
+extern int op_create_file(char *name, long stripe_size, int stripe_offset,
int stripe_count);
-extern int op_find(char *path, struct obd_uuid *obduuid, int recursive,
+extern int op_find(char *path, struct obd_uuid *obduuid, int recursive,
int verbose, int quiet);
/* all functions */
static int lfs_setstripe(int argc, char **argv);
static int lfs_find(int argc, char **argv);
+static int lfs_getstripe(int argc, char **argv);
/* all avaialable commands */
command_t cmdlist[] = {
{"find", lfs_find, 0,
"blah...\n"
"usage: find [--obd <uuid>] [--quiet | --verbose] [--recursive] <dir|file> ..."},
+ {"getstripe", lfs_getstripe, 0,
+ "blah...\n"
+ "usage:getstripe <filename>"},
{"help", Parser_help, 0, "help"},
{"exit", Parser_quit, 0, "quit"},
{"quit", Parser_quit, 0, "quit"},
/* functions */
static int lfs_setstripe(int argc, char **argv)
-{
+{
int result;
long st_size;
int st_offset, st_count;
- char *end;
-
- if (argc != 5)
- return CMD_HELP;
-
- // get the stripe size
- st_size = strtoul(argv[2], &end, 0);
- if (*end != '\0') {
- fprintf(stderr, "error: %s: bad stripe size '%s'\n",
+ char *end;
+
+ if (argc != 5)
+ return CMD_HELP;
+
+ // get the stripe size
+ st_size = strtoul(argv[2], &end, 0);
+ if (*end != '\0') {
+ fprintf(stderr, "error: %s: bad stripe size '%s'\n",
argv[0], argv[2]);
- return CMD_HELP;
- }
- // get the stripe offset
- st_offset = strtoul(argv[3], &end, 0);
- if (*end != '\0') {
- fprintf(stderr, "error: %s: bad stripe offset '%s'\n",
+ return CMD_HELP;
+ }
+ // get the stripe offset
+ st_offset = strtoul(argv[3], &end, 0);
+ if (*end != '\0') {
+ fprintf(stderr, "error: %s: bad stripe offset '%s'\n",
argv[0], argv[3]);
- return CMD_HELP;
- }
- // get the stripe count
- st_count = strtoul(argv[4], &end, 0);
- if (*end != '\0') {
- fprintf(stderr, "error: %s: bad stripe count '%s'\n",
+ return CMD_HELP;
+ }
+ // get the stripe count
+ st_count = strtoul(argv[4], &end, 0);
+ if (*end != '\0') {
+ fprintf(stderr, "error: %s: bad stripe count '%s'\n",
argv[0], argv[4]);
- return CMD_HELP;
- }
+ return CMD_HELP;
+ }
- result = op_create_file(argv[1], st_size, st_offset, st_count);
+ result = op_create_file(argv[1], st_size, st_offset, st_count);
if (result)
fprintf(stderr, "error: %s: create stripe file failed\n",
argv[0]);
- return result;
+ return result;
}
static int lfs_find(int argc, char **argv)
char short_opts[] = "ho:qrv";
int quiet, verbose, recursive, c, rc;
struct obd_uuid *obduuid = NULL;
-
+
optind = 0;
quiet = verbose = recursive = 0;
- while ((c = getopt_long(argc, argv, short_opts,
+ while ((c = getopt_long(argc, argv, short_opts,
long_opts, NULL)) != -1) {
- switch (c) {
- case 'o':
- if (obduuid) {
- fprintf(stderr, "error: %s: only one obduuid allowed",
- argv[0]);
- return CMD_HELP;
- }
- obduuid = (struct obd_uuid *)optarg;
- break;
- case 'q':
- quiet++;
- verbose = 0;
- break;
+ switch (c) {
+ case 'o':
+ if (obduuid) {
+ fprintf(stderr,
+ "error: %s: only one obduuid allowed",
+ argv[0]);
+ return CMD_HELP;
+ }
+ obduuid = (struct obd_uuid *)optarg;
+ break;
+ case 'q':
+ quiet++;
+ verbose = 0;
+ break;
case 'r':
recursive = 1;
break;
- case 'v':
- verbose++;
- quiet = 0;
- break;
- case '?':
+ case 'v':
+ verbose++;
+ quiet = 0;
+ break;
+ case '?':
return CMD_HELP;
break;
- default:
- fprintf(stderr, "error: %s: option '%s' unrecognized\n",
- argv[0], argv[optind - 1]);
+ default:
+ fprintf(stderr, "error: %s: option '%s' unrecognized\n",
+ argv[0], argv[optind - 1]);
return CMD_HELP;
break;
- }
- }
+ }
+ }
- if (optind >= argc)
+ if (optind >= argc)
return CMD_HELP;
do {
rc = op_find(argv[optind], obduuid, recursive, verbose, quiet);
- } while (++optind < argc && !rc);
+ } while (++optind < argc && !rc);
if (rc)
fprintf(stderr, "error: %s: find failed\n", argv[0]);
return rc;
}
+static int lfs_getstripe(int argc, char **argv)
+{
+ struct obd_uuid *obduuid = NULL;
+ int rc;
+
+ if (argc != 2)
+ return CMD_HELP;
+
+ optind = 1;
+
+ do {
+ rc = op_find(argv[optind], obduuid, 0, 0, 0);
+ } while (++optind < argc && !rc);
+
+ if (rc)
+ fprintf(stderr, "error: %s: getstripe failed for %s\n",
+ argv[0], argv[1]);
+
+ return rc;
+}
int main(int argc, char **argv)
{
#include <liblustre.h>
#include <linux/obd.h>
#include <linux/lustre_lib.h>
-#include <linux/lustre_lite.h>
-#include <linux/lustre_idl.h>
+#include <linux/lustre_user.h>
#include <linux/obd_lov.h>
static void err_msg(char *fmt, ...)
{
- va_list args;
- int tmp_errno = errno;
+ va_list args;
+ int tmp_errno = errno;
- va_start(args, fmt);
- vfprintf(stderr, fmt, args);
- va_end(args);
- fprintf(stderr, ": %s (%d)\n", strerror(tmp_errno), tmp_errno);
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+ fprintf(stderr, ": %s (%d)\n", strerror(tmp_errno), tmp_errno);
}
int op_create_file(char *name, long stripe_size, int stripe_offset,
- int stripe_count)
+ int stripe_count)
{
- struct lov_mds_md a_striping;
- int fd, result = 0;
-
- /* Initialize IOCTL striping pattern structure */
- a_striping.lmm_magic = LOV_MAGIC;
- a_striping.lmm_stripe_size = stripe_size;
- a_striping.lmm_stripe_offset = stripe_offset;
- a_striping.lmm_stripe_count = stripe_count;
-
- fd = open(name, O_CREAT | O_RDWR | O_LOV_DELAY_CREATE, 0644);
- if (fd < 0) {
- err_msg("unable to open '%s'",name);
- result = -errno;
- }
- else if (ioctl(fd, LL_IOC_LOV_SETSTRIPE, &a_striping)) {
- char *errmsg = "stripe already set";
- if (errno != EEXIST && errno != EALREADY)
- errmsg = strerror(errno);
-
- fprintf(stderr, "error on ioctl for '%s' (%d): %s\n",
- name, fd, errmsg);
- result = -errno;
- }
- else if (close(fd) < 0) {
- err_msg("error on close for '%s' (%d)", name, fd);
- result = -errno;
- }
- return result;
+ struct lov_user_md lum = { 0 };
+ int fd, rc = 0;
+
+ /* Initialize IOCTL striping pattern structure */
+ lum.lmm_magic = LOV_USER_MAGIC;
+ lum.lmm_stripe_size = stripe_size;
+ lum.lmm_stripe_offset = stripe_offset;
+ lum.lmm_stripe_count = stripe_count;
+
+ fd = open(name, O_CREAT | O_RDWR | O_LOV_DELAY_CREATE, 0644);
+ if (fd < 0) {
+ err_msg("unable to open '%s'",name);
+ rc = -errno;
+ return rc;
+ }
+ if (ioctl(fd, LL_IOC_LOV_SETSTRIPE, &lum)) {
+ char *errmsg = "stripe already set";
+ if (errno != EEXIST && errno != EALREADY)
+ errmsg = strerror(errno);
+
+ fprintf(stderr, "error on ioctl for '%s' (%d): %s\n",
+ name, fd, errmsg);
+ rc = -errno;
+ }
+ if (close(fd) < 0) {
+ err_msg("error on close for '%s' (%d)", name, fd);
+ if (rc == 0)
+ rc = -errno;
+ }
+ return rc;
}
char *buf;
int buflen;
struct obd_uuid *uuids;
- struct lov_mds_md *lmm;
+ struct lov_user_md *lum;
int got_uuids;
int obdindex;
int max_ost_count;
static int prepare_find(struct find_param *param)
{
- int datalen, desclen;
- int cfglen, lmmlen;
+ int datalen, desclen;
+ int cfglen, lumlen;
int max_ost_count = MAX_LOV_UUID_COUNT;
-
- datalen = size_round(sizeof(struct obd_ioctl_data));
- desclen = size_round(sizeof(struct lov_desc));
- param->uuidslen = size_round(max_ost_count * sizeof(struct obd_uuid));
- cfglen = datalen + desclen + param->uuidslen;
- lmmlen = lov_mds_md_size(max_ost_count);
- if (cfglen > lmmlen)
- param->buflen = cfglen;
- else
- param->buflen = lmmlen;
-
- /* XXX max ioctl buffer size currently hardcoded to 8192 */
- if (param->buflen > 8192) {
- int nuuids, remaining, nluoinfos;
-
- param->buflen = 8192;
- nuuids = (param->buflen - datalen - desclen) / sizeof(struct obd_uuid);
- param->uuidslen = size_round(nuuids * sizeof(struct obd_uuid));
- remaining = nuuids * sizeof(struct obd_uuid);
- if (param->uuidslen > remaining)
- nuuids--;
- nluoinfos = (param->buflen - sizeof(struct lov_mds_md)) /
- sizeof(*(param->lmm->lmm_objects));
- if (nuuids > nluoinfos)
- max_ost_count = nluoinfos;
- else
- max_ost_count = nuuids;
-
- cfglen = datalen + desclen + param->uuidslen;
- lmmlen = lov_mds_md_size(max_ost_count);
- }
-
- if ((param->buf = malloc(param->buflen)) == NULL) {
- err_msg("unable to allocate %d bytes of memory for ioctl's",
- param->buflen);
- return 1;
- }
-
- param->lmm = (struct lov_mds_md *)param->buf;
- param->uuids = (struct obd_uuid *)param->buf;
+
+ datalen = size_round(sizeof(param->data));
+ desclen = size_round(sizeof(param->desc));
+ param->uuidslen = size_round(max_ost_count * sizeof(*param->uuids));
+ cfglen = datalen + desclen + param->uuidslen;
+ lumlen = lov_mds_md_size(max_ost_count);
+ if (cfglen > lumlen)
+ param->buflen = cfglen;
+ else
+ param->buflen = lumlen;
+
+ /* XXX max ioctl buffer size currently hardcoded to 8192 */
+ if (param->buflen > 8192) {
+ int nuuids, remaining;
+
+ param->buflen = 8192;
+ nuuids = (param->buflen - datalen - desclen) /
+ sizeof(*param->uuids);
+ param->uuidslen = size_round(nuuids * sizeof(*param->uuids));
+ remaining = nuuids * sizeof(*param->uuids);
+ if (param->uuidslen > remaining)
+ nuuids--;
+ max_ost_count = nuuids;
+ while ((lumlen=lov_mds_md_size(max_ost_count)) > param->buflen)
+ --max_ost_count;
+
+ cfglen = datalen + desclen + param->uuidslen;
+ }
+
+ if ((param->buf = malloc(param->buflen)) == NULL) {
+ err_msg("unable to allocate %d bytes of memory for ioctl's",
+ param->buflen);
+ return ENOMEM;
+ }
+
+ param->lum = (struct lov_user_md *)param->buf;
+ param->uuids = (struct obd_uuid *)param->buf;
param->got_uuids = 0;
param->obdindex = OBD_NOT_FOUND;
param->max_ost_count = max_ost_count;
-
+
return 0;
}
free(param->buf);
}
-static void get_obd_uuids(DIR *dir, char *dname, struct find_param *param)
+static int get_obd_uuids(DIR *dir, char *dname, struct find_param *param)
{
- int obdcount;
- struct obd_uuid *uuidp;
- int rc, i;
+ int obdcount;
+ struct obd_uuid *uuidp;
+ int rc, i;
param->got_uuids = 1;
- memset(¶m->data, 0, sizeof(struct obd_ioctl_data));
+ memset(¶m->data, 0, sizeof(param->data));
param->data.ioc_inllen1 = sizeof(struct lov_desc);
param->data.ioc_inlbuf1 = (char *)¶m->desc;
param->data.ioc_inllen2 = param->uuidslen;
if (obd_ioctl_pack(¶m->data, ¶m->buf, param->buflen)) {
fprintf(stderr, "internal buffer error from %s\n", dname);
- return;
+ return (param->obduuid ? EINVAL : 0);
}
rc = ioctl(dirfd(dir), OBD_IOC_LOV_GET_CONFIG, param->buf);
if (rc) {
err_msg("error getting LOV config from %s", dname);
- return;
+ return (param->obduuid ? errno : 0);
}
if (obd_ioctl_unpack(¶m->data, param->buf, param->buflen)) {
err_msg("invalid reply from ioctl from %s", dname);
- return;
+ return (param->obduuid ? EINVAL : 0);
}
obdcount = param->desc.ld_tgt_count;
if (obdcount == 0)
- return;
+ return 0;
if (param->obduuid) {
for (i = 0, uuidp = param->uuids; i < obdcount; i++, uuidp++) {
break;
}
}
-
- if (param->obdindex == OBD_NOT_FOUND)
- return;
} else if (!param->quiet) {
printf("OBDS:\n");
for (i = 0, uuidp = param->uuids; i < obdcount; i++, uuidp++)
printf("%4d: %s\n", i, uuidp->uuid);
}
+
+ return 0;
}
-static void process_file(DIR *dir, char *dname, char *fname, struct find_param *param)
+void lov_dump_user_lmm_v1(struct lov_user_md_v1 *lum, char *dname, char *fname,
+ int obdindex, int quiet, int header, int body)
{
- int rc, i;
+ int i;
- strncpy((char *)param->lmm, fname, param->buflen);
+ if (obdindex != OBD_NOT_FOUND) {
+ for (i = 0; i < lum->lmm_stripe_count; i++) {
+ if (obdindex == lum->lmm_objects[i].l_ost_idx) {
+ printf("%s/%s\n", dname, fname);
+ break;
+ }
+ }
+ } else if (!quiet) {
+ printf("%s/%s\n", dname, fname);
+ }
- rc = ioctl(dirfd(dir), IOC_MDC_GETSTRIPE, (void *)param->lmm);
- if (rc) {
- if (errno == ENODATA) {
- if (!param->obduuid && !param->quiet)
- fprintf(stderr,
- "%s/%s has no stripe info\n",
- dname, fname);
- } else if (errno == EISDIR) {
- fprintf(stderr, "process_file on directory %s/%s!\n",
- dname, fname);
- /*
- add fname to directory list;
- */
- } else {
- err_msg("IOC_MDC_GETSTRIPE ioctl failed");
- }
- return;
- }
+ if (header) {
+ printf("lmm_magic: 0x%80X\n", lum->lmm_magic);
+ printf("lmm_object_gr: "LPX64"\n", lum->lmm_object_gr);
+ printf("lmm_object_id: "LPX64"\n", lum->lmm_object_id);
+ printf("lmm_stripe_count: %u\n", (int)lum->lmm_stripe_count);
+ printf("lmm_stripe_size: %u\n", lum->lmm_stripe_size);
+ printf("lmm_stripe_pattern: %x\n", lum->lmm_pattern);
+ }
- if ((param->obduuid && param->lmm->lmm_objects[param->obdindex].l_object_id) ||
- (!param->obduuid && !param->quiet))
- printf("%s/%s\n", dname, fname);
+ if (body) {
+ long long oid;
- if (param->verbose) {
- printf("lmm_magic: 0x%x\n", param->lmm->lmm_magic);
- printf("lmm_object_id: "LPX64"\n", param->lmm->lmm_object_id);
- printf("lmm_stripe_offset: %u\n", (int)param->lmm->lmm_stripe_offset);
- printf("lmm_stripe_count: %u\n", (int)param->lmm->lmm_stripe_count);
- printf("lmm_stripe_size: %u\n", (int)param->lmm->lmm_stripe_size);
- printf("lmm_ost_count: %u\n", param->lmm->lmm_ost_count);
- printf("lmm_stripe_pattern: %d\n", param->lmm->lmm_magic & 0xf);
+ if (!quiet)
+ printf("\tobdidx\t\t objid\t\tobjid\t\t group\n");
+
+ for (i = 0; i < lum->lmm_stripe_count; i++) {
+ int idx = lum->lmm_objects[i].l_ost_idx;
+ oid = lum->lmm_objects[i].l_object_id;
+ printf("\t%6u\t%14llu\t%#13llx\t%14lld%s\n", idx, oid,
+ oid, lum->lmm_objects[i].l_object_gr,
+ obdindex == idx ? " *" : "");
+ }
+ printf("\n");
}
+}
- if (param->verbose || !param->obduuid) {
- long long oid;
- int ost = param->lmm->lmm_stripe_offset;
- int header = !param->quiet;
-
- /* FIXME: temporary fix for bug 1612 */
- if (param->lmm->lmm_ost_count == 0) {
- oid = param->lmm->lmm_object_id;
- if (header)
- printf("\tobdidx\t\t objid\t\tobjid\n");
- printf("\t%6u\t%14llu\t%#13llx\n", 0, oid, oid);
- } else
- for (i = 0; i < param->lmm->lmm_ost_count; i++, ost++) {
- ost %= param->lmm->lmm_ost_count;
- if ((oid = param->lmm->lmm_objects[ost].l_object_id)) {
- if (header) {
- printf("\tobdidx\t\t objid\t\tobjid\n");
- header = 0;
- }
- printf("\t%6u\t%14llu\t%#13llx%s\n", ost,
- oid, oid, param->obdindex == ost ? " *" : "");
- }
- }
- printf("\n");
- }
+void lov_dump_user_lmm(struct find_param *param, char *dname, char *fname)
+{
+ switch(*(__u32 *)param->lum) { /* lum->lmm_magic */
+ case LOV_USER_MAGIC_V1:
+ lov_dump_user_lmm_v1(param->lum, dname, fname, param->obdindex,
+ param->quiet, param->verbose,
+ (param->verbose || !param->obduuid));
+ break;
+ default:
+ printf("unknown lmm_magic: 0x%08X\n", *(__u32 *)param->lum);
+ return;
+ }
}
+static int process_file(DIR *dir, char *dname, char *fname,
+ struct find_param *param)
+{
+ int rc;
-static void process_dir(DIR *dir, char *dname, struct find_param *param)
+ strncpy((char *)param->lum, fname, param->buflen);
+
+ rc = ioctl(dirfd(dir), IOC_MDC_GETSTRIPE, (void *)param->lum);
+ if (rc) {
+ if (errno == ENODATA) {
+ if (!param->obduuid && !param->quiet)
+ fprintf(stderr,
+ "%s/%s has no stripe info\n",
+ dname, fname);
+ rc = 0;
+ } else if (errno == EISDIR) {
+ fprintf(stderr, "process_file on directory %s/%s!\n",
+ dname, fname);
+ /* add fname to directory list; */
+ rc = errno;
+ } else {
+ err_msg("IOC_MDC_GETSTRIPE ioctl failed");
+ rc = errno;
+ }
+ return rc;
+ }
+
+ lov_dump_user_lmm(param, dname, fname);
+
+ return 0;
+}
+
+
+static int process_dir(DIR *dir, char *dname, struct find_param *param)
{
- struct dirent64 *dirp;
+ struct dirent64 *dirp;
DIR *subdir;
- char path[1024];
+ char path[1024];
+ int rc;
- if (!param->got_uuids)
- get_obd_uuids(dir, dname, param);
+ if (!param->got_uuids) {
+ rc = get_obd_uuids(dir, dname, param);
+ if (rc)
+ return rc;
+ }
- /* Handle the contents of the directory */
+ /* Handle the contents of the directory */
while ((dirp = readdir64(dir)) != NULL) {
if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
continue;
switch (dirp->d_type) {
case DT_UNKNOWN:
err_msg("\"%s\" is UNKNOWN type %d", dirp->d_name,
- dirp->d_type);
+ dirp->d_type);
/* If we cared we could stat the file to determine
* type and continue on here, but we don't since we
* know d_type should be valid for lustre and this
* tool only makes sense for lustre filesystems. */
- return;
+ return EINVAL;
break;
case DT_DIR:
if (!param->recursive)
subdir = opendir(path);
if (subdir == NULL) {
err_msg("\"%.40s\" opendir failed", path);
- break;
+ return errno;
}
- process_dir(subdir, path, param);
+ rc = process_dir(subdir, path, param);
closedir(subdir);
+ if (rc)
+ return rc;
break;
case DT_REG:
- process_file(dir, dname, dirp->d_name, param);
+ rc = process_file(dir, dname, dirp->d_name, param);
+ if (rc)
+ return rc;
break;
default:
break;
}
}
+
+ return 0;
}
-static void process_path(char *path, struct find_param *param)
+static int process_path(char *path, struct find_param *param)
{
char *fname, *dname;
DIR *dir;
+ int rc = 0;
fname = strrchr(path, '/');
if (fname != NULL && fname[1] == '\0') {
dir = opendir(path);
if (dir == NULL) {
err_msg("\"%.40s\" opendir failed", path);
+ rc = errno;
} else {
- process_dir(dir, path, param);
+ rc = process_dir(dir, path, param);
closedir(dir);
}
} else if ((dir = opendir(path)) != NULL) {
/* No trailing '/', but it is still a dir */
- process_dir(dir, path, param);
+ rc = process_dir(dir, path, param);
closedir(dir);
} else {
/* It must be a file (or other non-directory) */
dir = opendir(dname);
if (dir == NULL) {
err_msg("\"%.40s\" opendir failed", dname);
+ rc = errno;
} else {
if (!param->got_uuids)
- get_obd_uuids(dir, dname, param);
- process_file(dir, dname, fname, param);
+ rc = get_obd_uuids(dir, dname, param);
+ if (rc == 0)
+ rc = process_file(dir, dname, fname, param);
closedir(dir);
}
}
+
+ return rc;
}
-int op_find(char *path, struct obd_uuid *obduuid, int recursive,
- int verbose, int quiet)
+int op_find(char *path, struct obd_uuid *obduuid, int recursive,
+ int verbose, int quiet)
{
struct find_param param;
int ret = 0;
param.verbose = verbose;
param.quiet = quiet;
if (obduuid) {
- param.obduuid = (struct obd_uuid*)malloc(sizeof(struct obd_uuid));
+ param.obduuid = malloc(sizeof(*obduuid));
if (param.obduuid == NULL) {
- ret = 1;
+ ret = ENOMEM;
goto out;
}
- memcpy(param.obduuid, obduuid, sizeof(struct obd_uuid));
+ memcpy(param.obduuid, obduuid, sizeof(*obduuid));
}
ret = prepare_find(¶m);
cleanup_find(¶m);
return ret;
}
-
+
--- /dev/null
+#!/bin/bash
+PATH=`dirname $0`:$PATH
+lfs setstripe "$@"
return 1
}
-# read line from stdin
-read_ln()
-{
- local substr=$1
- local default_value
- local answer
-
- unset ANS
-
- [ $# -gt 1 ] && default_value=$2
- [ $# -gt 2 ] && answer=$3
-
- while [ -z "$ANS" ]; do
- echo -n "$substr"
- [ "$default_value" ] && echo -n " ($default_value)"
- echo -n ": "
- read ANS
- [ -z "$ANS" -a "$default_value" ] && ANS=$default_value
- if [ "$ANS" -a "$answer" ] ; then
- in_list "$ANS" "$ANSWER" || ANS=""
- fi
- done
-
- return 0
-}
#ask user some questions to add a device
add_device()
{
- local first
- local hostname
-
- [ $# -gt 2 ] && first=$3
-
- if [ -z "$first" ] ; then
- read_ln "Do you want to add another $1 (yes/no)?" "no" "$ANSWER"
- else
- ANS="yes"
- fi
-
- [ "$ANS" = "no" ] && return 1
+ local hostnames
+ local device
echo "Creating $1 \"$1$2\"..."
- read_ln "Please enter $1$2's hostname"
- hostname=$ANS
- read_ln "Please enter $1$2's device"
-
- device=$ANS
-
- DEVICE="$hostname:$device:$2:$1$2"
+ echo -n "Please enter the hostname(s) for $1$2: "
+ read hostnames
+
+ if [ -z "$hostnames" ] ; then
+ return 1
+ fi
+
+ for hostname in $hostnames ; do
+ device=
+ while [ -z "$device" ] ; do
+ echo -n "Please enter the $1$2 device for ${hostname}: "
+ read device
+ done
+ newdev="$hostname:$device:$2:$1$2:$CURRENT_MDS:$CURRENT_LOV"
+ DEVICE_LIST="$DEVICE_LIST $newdev"
+ done
return 0
}
+cur_mds_id=1
+
# get mds information
add_mds()
{
- local id=1
- local host_name
-
- while :; do
- add_device "mds" "$id" "first" || break
- in_list "$DEVICE" "$MDS_LIST" && continue
- MDS_LIST="$MDS_LIST $DEVICE" #add mds to MDS_LIST
- ((id++))
- break
- done
+ CURRENT_LOV=
+ CURRENT_MDS=
+ add_device "mds" "$cur_mds_id" || return 1
+ CURRENT_LOV="lov$cur_mds_id"
+ CURRENT_MDS="mds$cur_mds_id"
+ DEVICE_LIST="$DEVICE_LIST *:*:lov:$CURRENT_LOV:$CURRENT_MDS:"
+
+ (( cur_mds_id++ ))
return 0
}
+cur_ost_id=1
+
# ask user to add ost
add_ost()
{
- local first="first"
- local id=1
-
- while :; do
- add_device "ost" "$id" "$first" || break
- in_list "$DEVICE" "$OST_LIST" && continue
- OST_LIST="$OST_LIST $DEVICE" #add ost to MDS_LIST
- ((id++))
- first=""
- done
+ # We have to add one...
+ while ! add_device "ost" "$cur_ost_id" ; do
+ true
+ done
+ (( cur_ost_id++ ))
+
+ # ...and maybe more
+ while add_device "ost" "$cur_ost_id" ; do
+ (( cur_ost_id++ ))
+ done
return 0
}
+cur_cli_id=1
+
# ask user to add client to lustre
add_client()
{
- read_ln "Please enter the mountpoint for your clients" "$DEFAULT_MNTPT"
- CLIENT_LIST="*:$ANS:client:client"
+ echo -n "Please enter the clients' mountpoint (/mnt/lustre): "
+ read mtpt
+ [ -z "$mtpt" ] && mtpt="/mnt/lustre"
+ newdev="*:$mtpt:client:client$cur_cli_id:$CURRENT_MDS:$CURRENT_LOV"
+ DEVICE_LIST="$DEVICE_LIST $newdev"
+ (( cur_cli_id++ ))
return 0
}
DEVICE=$(echo $1 | awk -F: '{ print $2 }')
DEVICE_ID=$(echo $1 | awk -F: '{ print $3 }')
DEVICE_NAME=$(echo $1 | awk -F: '{ print $4 }')
+ DEVICE_MDS=$(echo $1 | awk -F: '{ print $5 }')
+ DEVICE_LOV=$(echo $1 | awk -F: '{ print $6 }')
}
# following user input to create xml config file
create_config()
{
- local mds_name
local config_file=$1
- for mds in $MDS_LIST ; do
- get_name_in_list $mds
- echo -n " $DEVICE_NAME"
- add_node "$HOST_NAME" "$config_file" || return 1
- $LMC -m "$config_file" --add mds --node "$HOST_NAME" \
- --mds "$DEVICE_NAME" \
- --nid "$HOST_NAME" --fstype "$DEFAULT_FSTYPE" \
- --dev "$DEVICE" || return 1
-
- mds_name="$DEVICE_NAME"
- done
-
- #add lov information FIXME --stripe_sz and
- #--stripe_cnt should be input by user
- echo -n " lov1"
- $LMC -m "$config_file" --add lov --lov lov1 --mds "$mds_name" \
- --stripe_sz "$STRIPE_SIZE" --stripe_cnt "$STRIPE_CNT" \
- --stripe_pattern "$STRIPE_PATTERN" || return 1
-
- for ost in $OST_LIST ; do
- get_name_in_list $ost
+ for device in $DEVICE_LIST ; do
+ get_name_in_list $device
echo -n " $DEVICE_NAME"
- add_node "$HOST_NAME" "$config_file" || return 1
- $LMC -m "$config_file" --add ost --node "$HOST_NAME" \
- --ost "$DEVICE_NAME" \
- --lov lov1 --fstype "$DEFAULT_FSTYPE" \
- --dev "$DEVICE" || return 1
- done
-
- for client in $CLIENT_LIST ; do
- get_name_in_list $client
- echo -n " $DEVICE_NAME"
- add_node "client" "$config_file" || return 1
- $LMC -m "$config_file" --add mtpt --nod client \
- --mds "$mds_name" --lov lov1 --path "$DEVICE" || return 1
+ case $DEVICE_NAME in
+ mds*)
+ add_node "$HOST_NAME" "$config_file" || return 1
+ $LMC -m "$config_file" --add mds --node "$HOST_NAME" \
+ --mds "$DEVICE_NAME" \
+ --nid "$HOST_NAME" --fstype "$DEFAULT_FSTYPE" \
+ --dev "$DEVICE" || return 1
+ ;;
+ lov*)
+ $LMC -m "$config_file" --add lov \
+ --lov "$DEVICE_NAME" \
+ --mds "$DEVICE_MDS" \
+ --stripe_sz "$STRIPE_SIZE" \
+ --stripe_cnt "$STRIPE_CNT" \
+ --stripe_pattern "$STRIPE_PATTERN" || return 1
+ ;;
+ ost*)
+ add_node "$HOST_NAME" "$config_file" || return 1
+ $LMC -m "$config_file" --add ost --node "$HOST_NAME" \
+ --ost "$DEVICE_NAME" \
+ --lov "$DEVICE_LOV" --fstype "$DEFAULT_FSTYPE" \
+ --dev "$DEVICE" || return 1
+ ;;
+ client*)
+ add_node "$DEVICE_NAME" "$config_file" || return 1
+ $LMC -m "$config_file" --add mtpt \
+ --node "$DEVICE_NAME" \
+ --mds "$DEVICE_MDS" \
+ --lov "$DEVICE_LOV" --path "$DEVICE" || return 1
+ ;;
+ esac
done
echo
return 0
EOF
-#add mds to lustre
-unset $MDS_LIST
-add_mds || fatal 1 "Cannot add mds to your lustre"
-
-#add ost to lustre
-unset $OST_LIST
-add_ost || fatal 1 "Cannot add ost to your lustre"
+CURRENT_LOV=
+MDS_LIST=
+OST_LIST=
+CLIENT_LIST=
-#add client to lustre
-unset $CLIENT_LIST
-add_client || fatal 1 "Cannot add client to your lustre"
+while add_mds ; do
+ add_ost
+ add_client
+done
rm -f "$TMP_CONFIG_FILE"
echo -n "Saving configuration to $CONFIG_FILE:"