Skip to contentSkip to conversation

xfsdump: enable support for multiple streams

PATCH In review Bill Kendall 3 participants 19 messages Nov 7, 2011 – Nov 10, 2011

lore
Share & tools
lore
#0 lore raw

v2 cover xfsdump: enable support for multiple streams

Version 2 of this series changes only patch #3. POSIX semaphores are now used instead of rolling our own, as suggested by Christoph. We lose the ability to count the number of waiting threads, which was used in some asserts. There was adequate coverage in related asserts, so this was deemed acceptable.

This series resurrects the IRIX multi-stream support for splitting a backup among several output files/tapes. This offers some nice performance improvements, particularly in xfsrestore where a single stream often cannot keep the filesystem/disks busy. I've observed a 1.7x improvement on a backup and a 5x improvement on restore.

I have a couple of xfstests for this, and will submit those once a few outstanding xfsdump test patches have been reviewed.

There's a bit more work to do:

- Now that xfsdump has threads once again, the tape I/O ring buffer support can be enabled. This series leaves it disabled so that more testing can be done in that area.

- Currently the stream split points are determined by doing an extra inode scan. This is unchanged from how it was done on IRIX. I'd like to change this so that enough info is kept from the initial inode scan to determine appropriate split points without an additional scan.

- You may notice in the last patch of this series that a lot of "miniroot" references also look at whether or not the dump is to a pipe. Now that the "miniroot" checks are gone, it's possible to clean up the pipe-related code too. I've got a separate patch series for that which I'll submit later.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw

PATCH v2 1/8 xfsdump: link with libpthread

This patch changes xfsdump/xfsrestore to link with libpthread in preparation for enabling multi-stream support. The libpthread checks are the same as those used in xfsprogs.

---
 configure.in          |    3 +++
 dump/Makefile         |    2 +-
 include/builddefs.in  |    1 +
 m4/Makefile           |    1 +
 m4/package_pthread.m4 |   19 +++++++++++++++++++
 restore/Makefile      |    2 +-
 6 files changed, 26 insertions(+), 2 deletions(-)
 create mode 100644 m4/package_pthread.m4
configure.in +3 -0
index b7ea1eb..8d4a256 100644
@@ -67,6 +67,9 @@ AC_MULTILIB($enable_lib64)
 AC_PACKAGE_NEED_UUID_H
 AC_PACKAGE_NEED_UUIDCOMPARE
 
+AC_PACKAGE_NEED_PTHREAD_H
+AC_PACKAGE_NEED_PTHREADMUTEXINIT
+
 AC_PACKAGE_NEED_NCURSES_H
 AC_PACKAGE_WANT_WORKING_LIBNCURSES
 
dump/Makefile +1 -1
index ce964a0..d193f68 100644
@@ -89,7 +89,7 @@ HFILES = $(LOCALINCL)
 LHFILES = $(COMMINCL) $(INVINCL)
 LINKS = $(COMMINCL) $(COMMON) $(INVINCL) $(INVCOMMON)
 LDIRT = $(LINKS)
-LLDLIBS = $(LIBUUID) $(LIBHANDLE) $(LIBATTR) $(LIBRMT)
+LLDLIBS = $(LIBUUID) $(LIBHANDLE) $(LIBATTR) $(LIBRMT) $(LIBPTHREAD)
 LTDEPENDENCIES = $(LIBRMT)
 
 LCFLAGS = -DDUMP
include/builddefs.in +1 -0
index f69c038..d5cc8d3 100644
@@ -16,6 +16,7 @@ CFLAGS = @CFLAGS@
 LIBRMT = $(TOPDIR)/librmt/librmt.la
 LIBXFS = @libxfs@
 LIBATTR = @libattr@
+LIBPTHREAD = @libpthread@
 LIBUUID = @libuuid@
 LIBCURSES = @libcurses@
 LIBHANDLE = @libhdl@
m4/Makefile +1 -0
index 8ce63f8..9a35056 100644
@@ -17,6 +17,7 @@ LSRCFILES = \
 	package_attrdev.m4 \
 	package_globals.m4 \
 	package_ncurses.m4 \
+	package_pthread.m4 \
 	package_utilies.m4 \
 	package_uuiddev.m4 \
 	package_xfslibs.m4 \
m4/package_pthread.m4 new file +19 -0
new file mode 100644
index 0000000..be21d29
@@ -0,0 +1,19 @@
+AC_DEFUN([AC_PACKAGE_NEED_PTHREAD_H],
+  [ AC_CHECK_HEADERS(pthread.h)
+    if test $ac_cv_header_pthread_h = no; then
+	AC_CHECK_HEADERS(pthread.h,, [
+	echo
+	echo 'FATAL ERROR: could not find a valid pthread header.'
+	exit 1])
+    fi
+  ])
+
+AC_DEFUN([AC_PACKAGE_NEED_PTHREADMUTEXINIT],
+  [ AC_CHECK_LIB(pthread, pthread_mutex_init,, [
+	echo
+	echo 'FATAL ERROR: could not find a valid pthread library.'
+	exit 1
+    ])
+    libpthread=-lpthread
+    AC_SUBST(libpthread)
+  ])
restore/Makefile +1 -1
index 003ea16..ce3d6b4 100644
@@ -99,7 +99,7 @@ HFILES = $(LOCALINCL)
 LHFILES = $(COMMINCL) $(INVINCL)
 LINKS = $(COMMINCL) $(COMMON) $(INVINCL) $(INVCOMMON)
 LDIRT = $(LINKS)
-LLDLIBS = $(LIBUUID) $(LIBHANDLE) $(LIBATTR) $(LIBRMT)
+LLDLIBS = $(LIBUUID) $(LIBHANDLE) $(LIBATTR) $(LIBRMT) $(LIBPTHREAD)
 LTDEPENDENCIES = $(LIBRMT)
 
 LCFLAGS = -DRESTORE
Signature · 6 lines
1.7.0.4

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v2 1/8
#2 lore raw

Re: [PATCH v2 1/8] xfsdump: link with libpthread

Quoted 6 lines · Bill Kendall

This patch changes xfsdump/xfsrestore to link with libpthread in preparation for enabling multi-stream support. The libpthread checks are the same as those used in xfsprogs.

Looks good to me.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw

PATCH v2 2/8 xfsdump: remove multi-stream synchronous dir dump

In reply to Bill Kendall

When doing multi-stream dumps, the directories are dumped by each stream in lock-step fashion. A stream backs up a given directory, then waits for all others to finish that directory, then they all move on to the next one. During restore a single stream is chosen to apply the directory dump.

This patch changes xfsdump so that only one stream dumps the directories. The other streams begin dumping files immediately. This results in a faster backup, which is presumably why multiple streams are being used in the first place.

It also removes the barrier routines in qlock.c as they were only used by the "SYNCDIR" code.

---
 common/qlock.c    |   37 ----------
 common/qlock.h    |   11 ---
 dump/content.c    |  193 ++++++++++++-----------------------------------------
 restore/content.c |   33 +++++++++
 4 files changed, 75 insertions(+), 199 deletions(-)
common/qlock.c +0 -37
index fd0e98d..6c9ee16 100644
@@ -568,43 +568,6 @@ return 0;
 #endif /* HIDDEN */
 }
 
-qbarrierh_t
-qbarrier_alloc( void )
-{
-#ifdef HIDDEN
-	barrier_t *barrierp;
-
-	/* sanity checks
-	 */
-	ASSERT( qlock_inited );
-	ASSERT( qlock_usp );
-
-	/* allocate a us barrier
-	 */
-	barrierp = new_barrier( qlock_usp );
-	ASSERT( barrierp );
-
-	return ( qbarrierh_t )barrierp;
-#else
-return 0;
-#endif /* HIDDEN */
-}
-
-void
-qbarrier( qbarrierh_t qbarrierh, size_t thrdcnt )
-{
-#ifdef HIDDEN
-	barrier_t *barrierp = ( barrier_t * )qbarrierh;
-
-	/* sanity checks
-	 */
-	ASSERT( qlock_inited );
-	ASSERT( qlock_usp );
-
-	barrier( barrierp, thrdcnt );
-#endif /* HIDDEN */
-}
-
 /* internal ordinal map abstraction
  */
 #ifdef HIDDEN
common/qlock.h +0 -11
index 54469ea..1880aff 100644
@@ -102,15 +102,4 @@ extern size_t qsemPblocked( qsemh_t qsemh );
 	/* number of threads currently blocked on this semaphore
 	 */
 
-typedef void *qbarrierh_t;
-#define QBARRIERH_NULL	0
-	/* opaque handle
-	 */
-extern qbarrierh_t qbarrier_alloc( void );
-	/* allocates a rendezvous barrier
-	 */
-extern void qbarrier( qbarrierh_t barrierh, size_t thrdcnt );
-	/* causes thrdcnt threads to rendezvous
-	 */
-
 #endif /* QLOCK_H */
dump/content.c +42 -151

270 lines not on this page · raw message

restore/content.c +33 -0
index 34fc4a0..2228a7f 100644
@@ -625,6 +625,9 @@ struct tran {
 	intgen_t t_persfd;
 		/* file descriptor of the persistent state file
 		 */
+	size64_t t_dirdumps;
+		/* bitset of streams which contain a directory dump
+		 */
 	sync_t t_sync1;
 		/* to single-thread attempt to validate command line
 		 * selection of dump with online inventory
@@ -1184,6 +1187,12 @@ content_init( intgen_t argc, char *argv[ ], size64_t vmsz )
 		return BOOL_FALSE;
 	}
 
+	/* assume all streams contain a directory dump. streams will remove
+	 * themselves from this bitset if they do not contain a directory dump.
+	 */
+	ASSERT( drivecnt <= sizeof(tranp->t_dirdumps) * NBBY );
+	tranp->t_dirdumps = ( 1ULL << drivecnt ) - 1;
+
 	/* the user may specify stdin as the restore source stream,
 	 * by a single dash ('-') with no option letter. This must
 	 * appear between the last lettered argument and the destination
@@ -2237,6 +2246,30 @@ content_stream_restore( ix_t thrdix )
 			unlock( );
 			continue;
 		}
+		if ( !(scrhdrp->cih_dumpattr & CIH_DUMPATTR_DIRDUMP) ) {
+			/* if no streams have a directory dump, issue a
+			 * message and exit. first set SYNC_BUSY to prevent
+			 * other threads from coming through here and issuing
+			 * the same message.
+			 */
+			tranp->t_dirdumps &= ~(1ULL << thrdix);
+			if ( !tranp->t_dirdumps ) {
+				tranp->t_sync3 = SYNC_BUSY;
+			}
+			unlock( );
+			if ( !tranp->t_dirdumps ) {
+				mlog( MLOG_VERBOSE | MLOG_ERROR, _(
+					"no directory dump found\n") );
+				Media_end( Mediap );
+				return mlog_exit(EXIT_NORMAL, RV_ERROR);
+			}
+			sleep( 1 );
+			if ( cldmgr_stop_requested( )) {
+				Media_end( Mediap );
+				return mlog_exit(EXIT_NORMAL, RV_INTR);
+			}
+			continue;
+		}
 		tranp->t_sync3 = SYNC_BUSY;
 		unlock( );
 		if ( ! tranp->t_dirattrinitdonepr ) {
Signature · 6 lines
1.7.0.4

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v2 2/8
#4 lore raw

Re: [PATCH v2 2/8] xfsdump: remove multi-stream synchronous dir dump

Quoted 11 lines · Bill Kendall

When doing multi-stream dumps, the directories are dumped by each stream in lock-step fashion. A stream backs up a given directory, then waits for all others to finish that directory, then they all move on to the next one. During restore a single stream is chosen to apply the directory dump.

This patch changes xfsdump so that only one stream dumps the directories. The other streams begin dumping files immediately. This results in a faster backup, which is presumably why multiple streams are being used in the first place.

Quoted 5 lines

It also removes the barrier routines in qlock.c as they were only used by the "SYNCDIR" code.

Nice change.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#5 lore raw

PATCH v2 3/8 xfsdump: implement lock abstraction with pthreads

In reply to Bill Kendall

This patch implements xfsdump's locking abstraction using pthread locking primitives. The obsolete IRIX locking code has been removed.

The POSIX semaphore implementation on Linux does not provide a count of threads waiting to decrement the semaphore, so qsemPblocked() has been removed. It was called from a few asserts, but the current count of the semaphore was also checked in adjacent asserts, so it was deemed acceptable to remove the qsemPblocked() asserts.

A few debug-level log calls had to be changed to use the "no lock" flag to prevent locks from being acquired out of order. This is used in various debug messages throughout xfsdump.

---
Changes in v2:
- Use POSIX semaphores (sem_t) instead of rolling our own with a pthread mutex and condition, as suggested by Christoph.

 common/main.c     |    2 +-
 common/qlock.c    |  355 +++++++++++------------------------------------------
 common/qlock.h    |   13 +--
 common/ring.c     |    4 -
 restore/content.c |   17 ++-
 5 files changed, 88 insertions(+), 303 deletions(-)
common/main.c +1 -1
index 08be16e..be8a921 100644
@@ -359,7 +359,7 @@ main( int argc, char *argv[] )
 
 	/* initialize the spinlock allocator
 	 */
-	ok = qlock_init( miniroot );
+	ok = qlock_init( );
 	if ( ! ok ) {
 		return mlog_exit(EXIT_ERROR, RV_INIT);
 	}
common/qlock.c +74 -281

606 lines not on this page · raw message

common/qlock.h +2 -11
index 1880aff..ae411bb 100644
@@ -21,19 +21,13 @@
 /* qlock - quick locks abstraction
  *
  * threads may allocate quick locks using qlock_alloc, and free them with
- * qlock_free. the abstraction is initialized with qlock_init. the underlying
- * mechanism is the IRIX us lock primitive. in order to use this, a temporary
- * shared arena is created in /tmp. this will be automatically unlinked
- * when the last thread exits.
+ * qlock_free. the abstraction is initialized with qlock_init.
  *
  * deadlock detection is accomplished by giving an ordinal number to each
  * lock allocated, and record all locks held by each thread. locks may not
  * be acquired out of order. that is, subsequently acquired locks must have
  * a lower ordinal than all locks currently held. for convenience, the ordinals
  * of all locks to be allocated will be defined in this file.
- *
- * ADDITION: added counting semaphores. simpler to do here since same
- * shared arena can be used.
  */
 
 #define QLOCK_ORD_CRIT	0
@@ -54,7 +48,7 @@ typedef void *qlockh_t;
 	/* opaque handle
 	 */
 
-extern bool_t qlock_init( bool_t miniroot );
+extern bool_t qlock_init( void );
 	/* called by main to initialize abstraction. returns FALSE if
 	 * utility should abort.
 	 */
@@ -98,8 +92,5 @@ extern bool_t qsemPwouldblock( qsemh_t qsemh );
 extern size_t qsemPavail( qsemh_t qsemh );
 	/* number of resources available
 	 */
-extern size_t qsemPblocked( qsemh_t qsemh );
-	/* number of threads currently blocked on this semaphore
-	 */
 
 #endif /* QLOCK_H */
common/ring.c +0 -4
index e1dddba..b6074d1 100644
@@ -258,9 +258,7 @@ ring_reset( ring_t *ringp, ring_msg_t *msgp )
 	/* re-initialize the ring
 	 */
 	ASSERT( qsemPavail( ringp->r_ready_qsemh ) == 0 );
-	ASSERT( qsemPblocked( ringp->r_ready_qsemh ) == 0 );
 	ASSERT( qsemPavail( ringp->r_active_qsemh ) == 0 );
-	ASSERT( qsemPblocked( ringp->r_active_qsemh ) <= 1 );
 	ringp->r_ready_in_ix = 0;
 	ringp->r_ready_out_ix = 0;
 	ringp->r_active_in_ix = 0;
@@ -277,9 +275,7 @@ ring_reset( ring_t *ringp, ring_msg_t *msgp )
 		qsemV( ringp->r_ready_qsemh );
 	}
 	ASSERT( qsemPavail( ringp->r_ready_qsemh ) == ringp->r_len );
-	ASSERT( qsemPblocked( ringp->r_ready_qsemh ) == 0 );
 	ASSERT( qsemPavail( ringp->r_active_qsemh ) == 0 );
-	ASSERT( qsemPblocked( ringp->r_active_qsemh ) <= 1 );
 }
 
 void
restore/content.c +11 -6
index 2228a7f..8dfa456 100644
@@ -8911,7 +8911,8 @@ partial_reg( ix_t d_index,
 
 	/* If not found, find a free one, fill it in and return */
 	if ( ! isptr ) {
-		mlog(MLOG_NITTY, "partial_reg: no entry found for %llu\n", ino);
+		mlog(MLOG_NITTY | MLOG_NOLOCK,
+			"partial_reg: no entry found for %llu\n", ino);
 		/* find a free one */
 		for (i=0; i < partialmax; i++ ) {
 			if (persp->a.parrest[i].is_ino == 0) {
@@ -8950,8 +8951,10 @@ found:
 		/* no existing entry for this drive, fill in the values */
 		bsptr->offset = offset;
 		bsptr->endoffset = endoffset;
-		mlog(MLOG_NITTY, "partial_reg: update entry [%d]: "
-		     "<off = %lld, end = %lld>\n", d_index, offset, endoffset);
+		mlog(MLOG_NITTY | MLOG_NOLOCK,
+			"partial_reg: update entry [%d]: "
+			"<off = %lld, end = %lld>\n",
+			d_index, offset, endoffset);
 	} else {
 		bool_t ret;
 
@@ -8960,9 +8963,11 @@ found:
 		 */
 		bsptr->endoffset = endoffset;
 		ret = partial_check2(isptr, fsize);
-		mlog(MLOG_NITTY, "partial_reg: extend entry [%d]: "
-		     "<end = %lld>\n", d_index, endoffset);
-		mlog(MLOG_NITTY, "partial_reg: partial_check returns: %d\n", ret);
+		mlog(MLOG_NITTY | MLOG_NOLOCK,
+			"partial_reg: extend entry [%d]: <end = %lld>\n",
+			d_index, endoffset);
+		mlog(MLOG_NITTY | MLOG_NOLOCK,
+			"partial_reg: partial_check returns: %d\n", ret);
 	}
 
 	pi_unlock();
Signature · 6 lines
1.7.0.4

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#6 lore raw

Re: [PATCH v2 3/8] xfsdump: implement lock abstraction with pthreads

Quoted 9 lines · Bill Kendall

This patch implements xfsdump's locking abstraction using pthread locking primitives. The obsolete IRIX locking code has been removed.

The POSIX semaphore implementation on Linux does not provide a count of threads waiting to decrement the semaphore, so qsemPblocked() has been removed. It was called from a few asserts, but the current count of the semaphore was also checked in adjacent asserts, so it was deemed acceptable to remove the qsemPblocked() asserts.

Quoted 5 lines

A few debug-level log calls had to be changed to use the "no lock" flag to prevent locks from being acquired out of order. This is used in various debug messages throughout xfsdump.

I have not done a very thorough review, but this
looks OK to me.

-Alex

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#7 lore raw

PATCH v2 4/8 xfsdump: simplify qlock ordinal bitmap

In reply to Bill Kendall

The qlock abstraction manages an array of ordinal bitmaps, one bitmap for each thread. The bitmap indicates which locks a thread is holding and is used to verify that the locks are obtained in the correct order.

There is no need to use an array to store the bitmaps, and in fact adding entries to the array is broken because qlock_thrdcnt is not protected by a lock. A simpler approach is to create a per-thread bitmap using thread local storage.

With this change, there is no need for each new thread to register with the qlock abstraction, so qlock_thrdinit() goes away. Remove qlock_init() since it can be statically initialized, and that means there's no need for a flag (qlock_inited) indicating that the module has been initialized. Also there's no longer a need to track or limit the number of threads that the qlock abstraction can handle.

---
 common/cldmgr.c |    4 -
 common/main.c   |    7 --
 common/qlock.c  |  191 ++++---------------------------------------------------
 common/qlock.h  |   11 +---
 4 files changed, 14 insertions(+), 199 deletions(-)
common/cldmgr.c +0 -4
index 7784a15..d327bab 100644
@@ -213,12 +213,8 @@ cldmgr_entry( void *arg1 )
 {
 	cld_t *cldp = ( cld_t * )arg1;
 	pid_t pid = getpid( );
-	/* REFERENCED */
-	bool_t ok;
 
 	cldp->c_pid = pid;
-	ok = qlock_thrdinit( );
-	ASSERT( ok );
 	if ( ( intgen_t )( cldp->c_streamix ) >= 0 ) {
 		stream_register( pid, ( intgen_t )cldp->c_streamix );
 	}
common/main.c +0 -7
index be8a921..25c0838 100644
@@ -357,13 +357,6 @@ main( int argc, char *argv[] )
 		miniroot = BOOL_TRUE;
 	}
 
-	/* initialize the spinlock allocator
-	 */
-	ok = qlock_init( );
-	if ( ! ok ) {
-		return mlog_exit(EXIT_ERROR, RV_INIT);
-	}
-
 	/* initialize message logging (stage 2) - allocate the message lock
 	 */
 	ok = mlog_init2( );
common/qlock.c +13 -178

298 lines not on this page · raw message

common/qlock.h +1 -10
index ae411bb..6c2dd18 100644
@@ -21,7 +21,7 @@
 /* qlock - quick locks abstraction
  *
  * threads may allocate quick locks using qlock_alloc, and free them with
- * qlock_free. the abstraction is initialized with qlock_init.
+ * qlock_free.
  *
  * deadlock detection is accomplished by giving an ordinal number to each
  * lock allocated, and record all locks held by each thread. locks may not
@@ -48,15 +48,6 @@ typedef void *qlockh_t;
 	/* opaque handle
 	 */
 
-extern bool_t qlock_init( void );
-	/* called by main to initialize abstraction. returns FALSE if
-	 * utility should abort.
-	 */
-
-extern bool_t qlock_thrdinit( void );
-	/* called by each thread to prepare it for participation
-	 */
-
 extern qlockh_t qlock_alloc( ix_t ord );
 	/* allocates a qlock with the specified ordinal. returns
 	 * NULL if lock can't be allocated.
Signature · 6 lines
1.7.0.4

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v2 4/8
#8 lore raw

Re: [PATCH v2 4/8] xfsdump: simplify qlock ordinal bitmap

Quoted 16 lines · Bill Kendall

The qlock abstraction manages an array of ordinal bitmaps, one bitmap for each thread. The bitmap indicates which locks a thread is holding and is used to verify that the locks are obtained in the correct order.

There is no need to use an array to store the bitmaps, and in fact adding entries to the array is broken because qlock_thrdcnt is not protected by a lock. A simpler approach is to create a per-thread bitmap using thread local storage.

With this change, there is no need for each new thread to register with the qlock abstraction, so qlock_thrdinit() goes away. Remove qlock_init() since it can be statically initialized, and that means there's no need for a flag (qlock_inited) indicating that the module has been initialized. Also there's no longer a need to track or limit the number of threads that the qlock abstraction can handle.

Quoted 2 lines

Wow, nice cleanup.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#9 lore raw

PATCH v2 5/8 xfsdump: convert IRIX sproc threads to pthreads

In reply to Bill Kendall

The existing (disabled) threading code in xfsdump is based on IRIX sprocs. This patch converts the code to use pthreads. The threading code remains disabled at this point.

Changes:
- pid_t to pthread_t
- getpid() to pthread_self()
- "pid1 == pid2" to pthread_equal(tid1, tid2)
- sigprocmask() to pthread_sigmask()
- sproc() to pthread_create()

Also the following are not referenced and have been removed:
- cldmgr_pid2streamix()
- PROCMAX
- r_slavepid
- sproc.c and sproc.h

---
 common/Makefile         |    2 +-
 common/cldmgr.c         |   56 ++++++++++++++--------------
 common/cldmgr.h         |    8 +---
 common/dlog.c           |    4 +-
 common/drive_minrmt.c   |    2 +-
 common/drive_scsitape.c |    2 +-
 common/main.c           |   20 +++++-----
 common/mlog.c           |   44 +++++++++++-----------
 common/ring.c           |    9 +---
 common/ring.h           |    1 -
 common/sproc.c          |   42 ---------------------
 common/sproc.h          |   23 -----------
 common/stream.c         |   94 +++++++++++++++++++++--------------------------
 common/stream.h         |   22 +++++-----
 dump/Makefile           |    4 +-
 dump/content.c          |    4 +-
 restore/Makefile        |    2 -
 restore/content.c       |    5 +-
 18 files changed, 127 insertions(+), 217 deletions(-)
 delete mode 100644 common/sproc.c
 delete mode 100644 common/sproc.h
common/Makefile +1 -1
index 8d9d868..ad3d61a 100644
@@ -13,7 +13,7 @@ LSRCFILES = arch_xlate.c arch_xlate.h \
 	hsmapi.c hsmapi.h inventory.c inventory.h lock.c lock.h \
 	main.c media.c media.h media_rmvtape.h mlog.c mlog.h \
 	openutil.c openutil.h path.c path.h qlock.c qlock.h \
-	rec_hdr.h ring.c ring.h sproc.c sproc.h stream.c \
+	rec_hdr.h ring.c ring.h stream.c \
 	stream.h timeutil.c timeutil.h ts_mtio.h types.h util.c util.h
 
 default install install-dev :
common/cldmgr.c +28 -28

150 lines not on this page · raw message

common/cldmgr.h +1 -7
index bb3f612..e393b82 100644
@@ -30,7 +30,6 @@ extern bool_t cldmgr_init( void );
  * encountered
  */
 extern bool_t cldmgr_create( int ( * entry )( void *arg1 ),
-			     u_intgen_t inh,
 			     ix_t streamix,
 			     char *descstr,
 			     void *arg1 );
@@ -42,18 +41,13 @@ extern void cldmgr_stop( void );
 
 /* cldmgr_died - tells the child manager that the child died
  */
-extern void cldmgr_died( pid_t pid );
+extern void cldmgr_died( pthread_t tid );
 
 /* cldmgr_stop_requested - returns TRUE if the child should gracefully
  * terminate.
  */
 extern bool_t cldmgr_stop_requested( void );
 
-/* cldmgr_pid2streamix - retrieves the stream index. returns -1 if
- * not associated with any stream.
- */
-extern intgen_t cldmgr_pid2streamix( pid_t pid );
-
 /* cldmgr_remainingcnt - returns number of children remaining
  */
 extern size_t cldmgr_remainingcnt( void );
common/dlog.c +2 -2
index 8cf9a65..51666cf 100644
@@ -429,7 +429,7 @@ promptinput( char *buf,
 		sigaddset( &dlog_registered_sigs, SIGQUIT );
 	}
 
-	sigprocmask( SIG_UNBLOCK, &dlog_registered_sigs, &orig_set );
+	pthread_sigmask( SIG_UNBLOCK, &dlog_registered_sigs, &orig_set );
 
 	/* wait for input, timeout, or interrupt.
 	 * note we come out of the select() frequently in order to
@@ -455,7 +455,7 @@ promptinput( char *buf,
 
 	/* restore signal handling
 	 */
-	sigprocmask( SIG_SETMASK, &orig_set, NULL );
+	pthread_sigmask( SIG_SETMASK, &orig_set, NULL );
 	sigemptyset( &dlog_registered_sigs );
 	
 	/* check for timeout or interrupt
common/drive_minrmt.c +1 -1
index 836b663..3ff4d0f 100644
@@ -577,7 +577,7 @@ ds_instantiate( int argc, char *argv[], drive_t *drivep, bool_t singlethreaded )
 	drivep->d_cap_est  = -1;
 	drivep->d_rate_est = -1;
 
-	/* if sproc not allowed, allocate a record buffer. otherwise
+	/* if threads not allowed, allocate a record buffer. otherwise
 	 * create a ring, from which buffers will be taken.
 	 */
 	if ( singlethreaded ) {
common/drive_scsitape.c +1 -1
index 8c1bd49..f24d604 100644
@@ -667,7 +667,7 @@ ds_instantiate( int argc, char *argv[], drive_t *drivep, bool_t singlethreaded )
 	drivep->d_cap_est  = -1;
 	drivep->d_rate_est = -1;
 
-	/* if sproc not allowed, allocate a record buffer. otherwise
+	/* if threads not allowed, allocate a record buffer. otherwise
 	 * create a ring, from which buffers will be taken.
 	 */
 	if ( singlethreaded ) {
common/main.c +10 -10
index 25c0838..d4dbe28 100644
@@ -32,6 +32,7 @@
 #include <getopt.h>
 #include <stdint.h>
 #include <sched.h>
+#include <pthread.h>
 
 #include "exit.h"
 #include "types.h"
@@ -117,7 +118,7 @@ bool_t miniroot = BOOL_TRUE;
 #endif /* HIDDEN */
 bool_t pipeline = BOOL_FALSE;
 bool_t stdoutpiped = BOOL_FALSE;
-pid_t parentpid;
+pthread_t parenttid;
 char *sistr;
 size_t pgsz;
 size_t pgmask;
@@ -195,10 +196,10 @@ main( int argc, char *argv[] )
 	*/
 	mlog_init0();
 
-	/* Get the parent's pid. will be used in signal handling
+	/* Get the parent's pthread id. will be used
 	 * to differentiate parent from children.
 	 */
-	parentpid = getpid( );
+	parenttid = pthread_self( );
 	rval = atexit(mlog_exit_flush);
 	assert(rval == 0);
 
@@ -395,11 +396,11 @@ main( int argc, char *argv[] )
 	ASSERT( ( intgen_t )pgsz > 0 );
 	pgmask = pgsz - 1;
 
-	/* report parent pid
+	/* report parent tid
          */
 	mlog( MLOG_DEBUG | MLOG_PROC,
-	      "parent pid is %d\n",
-	      parentpid );
+	      "parent tid is %lu\n",
+	      parenttid );
 
 	/* get the current working directory: this is where we will dump
 	 * core, if necessary. some tmp files may be placed here as well.
@@ -572,7 +573,7 @@ main( int argc, char *argv[] )
 		sigaddset( &blocked_set, SIGTERM );
 		sigaddset( &blocked_set, SIGQUIT );
 		sigaddset( &blocked_set, SIGALRM );
-		sigprocmask( SIG_SETMASK, &blocked_set, NULL );
+		pthread_sigmask( SIG_SETMASK, &blocked_set, NULL );
 
 		sa.sa_handler = sighandler;
 		sigaction( SIGINT, &sa, NULL );
@@ -676,7 +677,6 @@ main( int argc, char *argv[] )
 	if ( ! init_error ) {
 		for ( stix = 0 ; stix < drivecnt ; stix++ ) {
 			ok = cldmgr_create( childmain,
-					    CLONE_VM,
 					    stix,
 					    "child",
 					    ( void * )stix );
@@ -895,7 +895,7 @@ main( int argc, char *argv[] )
 	if ( coredump_requested ) {
 		mlog( MLOG_DEBUG | MLOG_PROC,
 		      "core dump requested, aborting (pid %d)\n",
-		      parentpid );
+		      getpid() );
 		abort();
 	}
 
@@ -1560,7 +1560,7 @@ childmain( void *arg1 )
 	drivep = drivepp[ stix ];
 	( * drivep->d_opsp->do_quit )( drivep );
 
-	exit( exitcode );
+	return exitcode;
 }
 
 
common/mlog.c +22 -22

143 lines not on this page · raw message

common/ring.c +2 -7
index b6074d1..0d2feb0 100644
@@ -123,7 +123,6 @@ ring_create( size_t ringlen,
 	/* kick off the slave thread
 	 */
 	ok = cldmgr_create( ring_slave_entry,
-			    CLONE_VM,
 			    drive_index,
 			    _("slave"),
 			    ringp );
@@ -417,11 +416,7 @@ ring_slave_entry( void *ringctxp )
 	sigaddset( &blocked_set, SIGTERM );
 	sigaddset( &blocked_set, SIGQUIT );
 	sigaddset( &blocked_set, SIGALRM );
-	sigprocmask( SIG_SETMASK, &blocked_set, NULL );
-
-	/* record slave pid to be used to kill slave
-	 */
-	ringp->r_slavepid = getpid( );
+	pthread_sigmask( SIG_SETMASK, &blocked_set, NULL );
 
 	/* loop reading and precessing messages until told to die
 	 */
@@ -494,5 +489,5 @@ ring_slave_entry( void *ringctxp )
 		ring_slave_put( ringp, msgp );
 	}
 
-	exit( 0 );
+	return 0;
 }
common/ring.h +0 -1
index 56e3924..caa505c 100644
@@ -134,7 +134,6 @@ struct ring {
 	time32_t r_first_io_time;
 	off64_t r_all_io_cnt;
 /* ALL BELOW PRIVATE!!! */
-	pid_t r_slavepid;
 	size_t r_len;
 	ring_msg_t *r_msgp;
 	size_t r_ready_in_ix;
common/sproc.c deleted +0 -42

42 lines not on this page · raw message

common/sproc.h deleted +0 -23
deleted file mode 100644
index 46111ff..0000000
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2000-2001 Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would 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 this program; if not, write the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-#ifndef SPROC_H
-#define SPROC_H
-
-int sproc (int (*) (void *), int, void *);
-
-#endif /* SPROC_H */
common/stream.c +42 -52

246 lines not on this page · raw message

common/stream.h +11 -11
index 984634c..292792e 100644
@@ -42,19 +42,19 @@
 typedef enum { S_FREE, S_RUNNING, S_ZOMBIE } stream_state_t;
 
 extern void stream_init( void );
-extern void stream_register( pid_t pid, intgen_t streamix );
-extern void stream_dead( pid_t pid );
-extern void stream_free( pid_t pid );
+extern void stream_register( pthread_t tid, intgen_t streamix );
+extern void stream_dead( pthread_t tid );
+extern void stream_free( pthread_t tid );
 extern int stream_find_all( stream_state_t states[],
 			    int nstates,
-			    pid_t pids[],
-			    int npids );
-extern intgen_t stream_getix( pid_t pid );
-extern void stream_set_code( pid_t pid, int code );
-extern void stream_set_return( pid_t pid, rv_t rv );
-extern void stream_set_hint( pid_t pid, rv_t rv );
-extern bool_t stream_exists( pid_t pid );
-extern bool_t stream_get_exit_status( pid_t pid,
+			    pthread_t tids[],
+			    int ntids );
+extern intgen_t stream_getix( pthread_t tid );
+extern void stream_set_code( pthread_t tid, int code );
+extern void stream_set_return( pthread_t tid, rv_t rv );
+extern void stream_set_hint( pthread_t tid, rv_t rv );
+extern bool_t stream_exists( pthread_t tid );
+extern bool_t stream_get_exit_status( pthread_t tid,
 				      stream_state_t states[],
 				      int nstates,
 				      stream_state_t *state,
dump/Makefile +1 -3
index d193f68..97879fa 100644
@@ -30,7 +30,6 @@ COMMINCL = \
 	ts_mtio.h \
 	types.h \
 	util.h \
-	sproc.h \
 	rec_hdr.h
 
 INVINCL = \
@@ -68,8 +67,7 @@ COMMON = \
 	ring.c \
 	stream.c \
 	timeutil.c \
-	util.c \
-	sproc.c
+	util.c
 
 LOCALS = \
 	content.c \
dump/content.c +2 -2
index 64bfe54..33f1166 100644
@@ -1666,12 +1666,12 @@ baseuuidbypass:
 		sigaddset( &tty_set, SIGINT );
 		sigaddset( &tty_set, SIGQUIT );
 		sigaddset( &tty_set, SIGHUP );
-		sigprocmask( SIG_BLOCK, &tty_set, &orig_set );
+		pthread_sigmask( SIG_BLOCK, &tty_set, &orig_set );
 
 		result = create_inv_session( gwhdrtemplatep, &fsid, mntpnt,
 					     fsdevice, subtreecnt, strmix );
 
-		sigprocmask( SIG_SETMASK, &orig_set, NULL );
+		pthread_sigmask( SIG_SETMASK, &orig_set, NULL );
 
 		if ( !result ) {
 			return BOOL_FALSE;
restore/Makefile +0 -2
index ce3d6b4..c6f3f25 100644
@@ -25,7 +25,6 @@ COMMINCL = \
 	qlock.h \
 	rec_hdr.h \
 	ring.h \
-	sproc.h \
 	stream.h \
 	timeutil.h \
 	ts_mtio.h \
@@ -64,7 +63,6 @@ COMMON = \
 	path.c \
 	qlock.c \
 	ring.c \
-	sproc.c \
 	stream.c \
 	timeutil.c \
 	util.c
restore/content.c +3 -2
index 8dfa456..0108a40 100644
@@ -33,6 +33,7 @@
 #include <dirent.h>
 #include <utime.h>
 #include <malloc.h>
+#include <pthread.h>
 
 #include "types.h"
 #include "timeutil.h"
@@ -2227,7 +2228,7 @@ content_stream_restore( ix_t thrdix )
 #if DEBUG_DUMPSTREAMS
 			{
 			    static int count[STREAM_MAX] = {0};
-			    intgen_t streamix = stream_getix( getpid() );
+			    intgen_t streamix = stream_getix( pthread_self() );
 			    if (++(count[streamix]) == 30) {
 				mlog( MLOG_TRACE,
 					"still waiting for dirs to be restored\n");
@@ -2390,7 +2391,7 @@ content_stream_restore( ix_t thrdix )
 #if DEBUG_DUMPSTREAMS
 			{
 			static int count[STREAM_MAX] = {0};
-			intgen_t streamix = stream_getix( getpid() );
+			intgen_t streamix = stream_getix( pthread_self() );
 			    if (++(count[streamix]) == 30) {
 				mlog( MLOG_NORMAL,
 				      "still waiting for dirs post-processing\n");
Signature · 6 lines
1.7.0.4

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v2 5/8
#10 lore raw

Re: [PATCH v2 5/8] xfsdump: convert IRIX sproc threads to pthreads

Quoted 11 lines · Bill Kendall

The existing (disabled) threading code in xfsdump is based on IRIX sprocs. This patch converts the code to use pthreads. The threading code remains disabled at this point.

Changes:
- pid_t to pthread_t
- getpid() to pthread_self()
- "pid1 == pid2" to pthread_equal(tid1, tid2)
- sigprocmask() to pthread_sigmask()
- sproc() to pthread_create()

Quoted 8 lines

Also the following are not referenced and have been removed:
- cldmgr_pid2streamix()
- PROCMAX
- r_slavepid
- sproc.c and sproc.h

Looks good.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#11 lore raw

PATCH v2 6/8 xfsdump: process thread exit status

In reply to Bill Kendall

When IRIX sprocs were in use, the main thread was notified of a thread exit just as if a child process exited -- it received SIGCHLD. The main thread would grab the pid and exit status, then call cldmgr_died() to inform it that the child was gone so the slot in the child array could be freed up for reuse.

This patch implements a similar mechanism for pthreads. The "c_busy" field in struct cld has been replaced with a "c_state" field that indicates whether the array slot is free (C_AVAIL), in use (C_ALIVE), or is waiting to be joined (C_EXITED). Additionally a "c_exit_code" field has been added to store the thread's exit value. Normally this is set when the thread entry function returns, but it is initialized to EXIT_INTERRUPT in case the thread is cancelled or calls pthread_exit() rather than returning (neither of which happens in the code today).

When the child thread starts, it registers a pthread cleanup handler which takes care of marking the child as C_EXITED and notifies the main thread that a child is gone. Doing this in a cleanup handler ensures that it's done regardless of how the thread exits. The main thread's loop is based around sigsuspsend(), so the notification is done by sending SIGUSR1. The main thread will then call cldmgr_join() to join all exited threads and obtain their exit status.

Additional changes:
* cldmgr_findbypid() has been removed, it's no longer referenced.
* stream_dead() no longer grabs the lock(), because it's called only from cldmgr_join() which already holds the lock().

---
 common/cldmgr.c |   88 +++++++++++++++++++++++++++++++++++-------------------
 common/cldmgr.h |    7 +++-
 common/main.c   |   33 +++++---------------
 common/stream.c |    3 +-
 common/stream.h |    1 +
 5 files changed, 73 insertions(+), 59 deletions(-)
common/cldmgr.c +57 -31
index 4574834..be7de34 100644
@@ -26,6 +26,7 @@
 #include <errno.h>
 #include <pthread.h>
 
+#include "exit.h"
 #include "types.h"
 #include "lock.h"
 #include "qlock.h"
@@ -36,8 +37,12 @@
 extern size_t pgsz;
 
 #define CLD_MAX	( STREAM_SIMMAX * 2 )
+
+typedef enum { C_AVAIL, C_ALIVE, C_EXITED } state_t;
+
 struct cld {
-	bool_t c_busy;
+	state_t c_state;
+	intgen_t c_exit_code;
 	pthread_t c_tid;
 	ix_t c_streamix;
 	int ( * c_entry )( void *arg1 );
@@ -50,8 +55,8 @@ static cld_t cld[ CLD_MAX ];
 static bool_t cldmgr_stopflag;
 
 static cld_t *cldmgr_getcld( void );
-static cld_t * cldmgr_findbytid( pthread_t );
 static void *cldmgr_entry( void * );
+static void cldmgr_cleanup( void * );
 /* REFERENCED */
 static pthread_t cldmgr_parenttid;
 
@@ -87,6 +92,7 @@ cldmgr_create( int ( * entry )( void *arg1 ),
 		return BOOL_FALSE;
 	}
 
+	cldp->c_exit_code = EXIT_INTERRUPT;
 	cldp->c_streamix = streamix;
 	cldp->c_entry = entry;
 	cldp->c_arg1 = arg1;
@@ -117,18 +123,37 @@ cldmgr_stop( void )
 	cldmgr_stopflag = BOOL_TRUE;
 }
 
-void
-cldmgr_died( pthread_t tid )
+intgen_t
+cldmgr_join( void )
 {
-	cld_t *cldp = cldmgr_findbytid( tid );
+	cld_t *p = cld;
+	cld_t *ep = cld + sizeof( cld ) / sizeof( cld[ 0 ] );
+	intgen_t xc = EXIT_NORMAL;
 
-	if ( ! cldp ) {
-		return;
-	}
-	cldp->c_busy = BOOL_FALSE;
-	if ( ( intgen_t )( cldp->c_streamix ) >= 0 ) {
-		stream_dead( tid );
+	lock();
+	for ( ; p < ep ; p++ ) {
+		if ( p->c_state == C_EXITED ) {
+			if ( ( intgen_t )( p->c_streamix ) >= 0 ) {
+				stream_dead( p->c_tid );
+			}
+			pthread_join( p->c_tid, NULL );
+			if ( p->c_exit_code != EXIT_NORMAL && xc != EXIT_FAULT )
+				xc = p->c_exit_code;
+			if ( p->c_exit_code != EXIT_NORMAL ) {
+				mlog( MLOG_DEBUG | MLOG_PROC | MLOG_NOLOCK,
+					"child (thread %lu) requested stop: "
+					"exit code %d (%s)\n",
+					p->c_tid, p->c_exit_code,
+					exit_codestring( p->c_exit_code ));
+			}
+
+			// reinit this child for reuse
+			memset( ( void * )p, 0, sizeof( cld_t ));
+		}
 	}
+	unlock();
+
+	return xc;
 }
 
 bool_t
@@ -147,7 +172,7 @@ cldmgr_remainingcnt( void )
 	cnt = 0;
 	lock( );
 	for ( ; p < ep ; p++ ) {
-		if ( p->c_busy ) {
+		if ( p->c_state == C_ALIVE ) {
 			cnt++;
 		}
 	}
@@ -164,7 +189,7 @@ cldmgr_otherstreamsremain( ix_t streamix )
 
 	lock( );
 	for ( ; p < ep ; p++ ) {
-		if ( p->c_busy && p->c_streamix != streamix ) {
+		if ( p->c_state == C_ALIVE && p->c_streamix != streamix ) {
 			unlock( );
 			return BOOL_TRUE;
 		}
@@ -182,8 +207,8 @@ cldmgr_getcld( void )
 
 	lock();
 	for ( ; p < ep ; p++ ) {
-		if ( ! p->c_busy ) {
-			p->c_busy = BOOL_TRUE;
+		if ( p->c_state == C_AVAIL ) {
+			p->c_state = C_ALIVE;
 			break;
 		}
 	}
@@ -192,27 +217,14 @@ cldmgr_getcld( void )
 	return ( p < ep ) ? p : 0;
 }
 
-static cld_t *
-cldmgr_findbytid( pthread_t tid )
-{
-	cld_t *p = cld;
-	cld_t *ep = cld + sizeof( cld ) / sizeof( cld[ 0 ] );
-
-	for ( ; p < ep ; p++ ) {
-		if ( p->c_busy && pthread_equal( p->c_tid, tid )) {
-			break;
-		}
-	}
-
-	return ( p < ep ) ? p : 0;
-}
-
 static void *
 cldmgr_entry( void *arg1 )
 {
 	cld_t *cldp = ( cld_t * )arg1;
 	pthread_t tid = pthread_self( );
 
+	pthread_cleanup_push( cldmgr_cleanup, arg1 );
+
 	if ( ( intgen_t )( cldp->c_streamix ) >= 0 ) {
 		stream_register( tid, ( intgen_t )cldp->c_streamix );
 	}
@@ -220,7 +232,21 @@ cldmgr_entry( void *arg1 )
 	      "thread %lu created for stream %d\n",
 	      tid,
 	      cldp->c_streamix );
+	cldp->c_exit_code = ( * cldp->c_entry )( cldp->c_arg1 );
+
+	pthread_cleanup_pop( 1 );
 
-	( * cldp->c_entry )( cldp->c_arg1 );
 	return NULL;
 }
+
+static void
+cldmgr_cleanup( void *arg1 )
+{
+	cld_t *cldp = ( cld_t * )arg1;
+
+	lock();
+	cldp->c_state = C_EXITED;
+	// signal the main thread to look for exited threads
+	kill( getpid( ), SIGUSR1 );
+	unlock();
+}
common/cldmgr.h +5 -2
index e393b82..1df0c0c 100644
@@ -39,9 +39,12 @@ extern bool_t cldmgr_create( int ( * entry )( void *arg1 ),
  */
 extern void cldmgr_stop( void );
 
-/* cldmgr_died - tells the child manager that the child died
+/* cldmgr_join - join child threads that have exited.
+ * returns EXIT_NORMAL if all exited normally (or no threads have exited),
+ * EXIT_FAULT if any threads requested a core dump, or another EXIT_*
+ * value if any threads exited abnormally.
  */
-extern void cldmgr_died( pthread_t tid );
+extern intgen_t cldmgr_join( void );
 
 /* cldmgr_stop_requested - returns TRUE if the child should gracefully
  * terminate.
common/main.c +9 -24
index d4dbe28..38b3889 100644
@@ -137,10 +137,6 @@ static bool_t sighup_received;
 static bool_t sigterm_received;
 static bool_t sigquit_received;
 static bool_t sigint_received;
-static size_t prbcld_cnt;
-static pid_t prbcld_pid;
-static intgen_t prbcld_xc;
-static intgen_t prbcld_signo;
 /* REFERENCED */
 static intgen_t sigstray_received;
 static bool_t progrpt_enabledpr;
@@ -168,6 +164,8 @@ main( int argc, char *argv[] )
 	intgen_t exitcode;
 	rlim64_t tmpstacksz;
 	struct sigaction sa;
+	intgen_t prbcld_xc = EXIT_NORMAL;
+	intgen_t xc;
 	bool_t ok;
 	/* REFERENCED */
 	int rval;
@@ -563,7 +561,6 @@ main( int argc, char *argv[] )
 		sigint_received = BOOL_FALSE;
 		sigquit_received = BOOL_FALSE;
 		sigstray_received = BOOL_FALSE;
-		prbcld_cnt = 0;
 
 		alarm( 0 );
 
@@ -573,6 +570,7 @@ main( int argc, char *argv[] )
 		sigaddset( &blocked_set, SIGTERM );
 		sigaddset( &blocked_set, SIGQUIT );
 		sigaddset( &blocked_set, SIGALRM );
+		sigaddset( &blocked_set, SIGUSR1 );
 		pthread_sigmask( SIG_SETMASK, &blocked_set, NULL );
 
 		sa.sa_handler = sighandler;
@@ -581,6 +579,7 @@ main( int argc, char *argv[] )
 		sigaction( SIGTERM, &sa, NULL );
 		sigaction( SIGQUIT, &sa, NULL );
 		sigaction( SIGALRM, &sa, NULL );
+		sigaction( SIGUSR1, &sa, NULL );
 	}
 
 	/* do content initialization.
@@ -710,31 +709,16 @@ main( int argc, char *argv[] )
 		 * stop. furthermore, note that core should be dumped if
 		 * the child explicitly exited with EXIT_FAULT.
 		 */
-		if ( prbcld_cnt ) {
-			if ( prbcld_xc == EXIT_FAULT || prbcld_signo != 0 ) {
+		xc = cldmgr_join( );
+		if ( xc ) {
+			if ( xc == EXIT_FAULT ) {
 				coredump_requested = BOOL_TRUE;
 				stop_timeout = ABORT_TIMEOUT;
 			} else {
 				stop_timeout = STOP_TIMEOUT;
 			}
+			prbcld_xc = xc;
 			stop_requested = BOOL_TRUE;
-			if ( prbcld_xc != EXIT_NORMAL ) {
-				mlog( MLOG_DEBUG | MLOG_PROC,
-				      "child (pid %d) requested stop: "
-				      "exit code %d (%s)\n",
-				      prbcld_pid,
-				      prbcld_xc,
-				      exit_codestring( prbcld_xc ));
-			} else if ( prbcld_signo ) {
-				ASSERT( prbcld_signo );
-				mlog( MLOG_NORMAL | MLOG_ERROR | MLOG_PROC,
-				      _("child (pid %d) faulted: "
-				      "signal number %d (%s)\n"),
-				      prbcld_pid,
-				      prbcld_signo,
-				      sig_numstring( prbcld_signo ));
-			}
-			prbcld_cnt = 0;
 		}
 			
 		/* all children died normally. break out.
@@ -1528,6 +1512,7 @@ sighandler( int signo )
 		sigquit_received = BOOL_TRUE;
 		break;
 	case SIGALRM:
+	case SIGUSR1:
 		break;
 	default:
 		sigstray_received = signo;
common/stream.c +1 -2
index 48e25ee..6704661 100644
@@ -86,19 +86,18 @@ stream_register( pthread_t tid, intgen_t streamix )
 	p->s_exit_hint = RV_NONE;
 }
 
+/* NOTE: lock() must be held when calling stream_dead() */
 void
 stream_dead( pthread_t tid )
 {
 	spm_t *p = spm;
 	spm_t *ep = spm + N(spm);
 
-	lock();
 	for ( ; p < ep ; p++ )
 		if ( pthread_equal( p->s_tid, tid ) ) {
 			p->s_state = S_ZOMBIE;
 			break;
 		}
-	unlock();
 	ASSERT( p < ep );
 }
 
common/stream.h +1 -0
index 292792e..4b3799f 100644
@@ -43,6 +43,7 @@ typedef enum { S_FREE, S_RUNNING, S_ZOMBIE } stream_state_t;
 
 extern void stream_init( void );
 extern void stream_register( pthread_t tid, intgen_t streamix );
+/* NOTE: lock() must be held when calling stream_dead */
 extern void stream_dead( pthread_t tid );
 extern void stream_free( pthread_t tid );
 extern int stream_find_all( stream_state_t states[],
Signature · 6 lines
1.7.0.4

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v2 6/8
#12 lore raw

Re: [PATCH v2 6/8] xfsdump: process thread exit status

Quoted 23 lines · Bill Kendall

When IRIX sprocs were in use, the main thread was notified of a thread exit just as if a child process exited -- it received SIGCHLD. The main thread would grab the pid and exit status, then call cldmgr_died() to inform it that the child was gone so the slot in the child array could be freed up for reuse.

This patch implements a similar mechanism for pthreads. The "c_busy" field in struct cld has been replaced with a "c_state" field that indicates whether the array slot is free (C_AVAIL), in use (C_ALIVE), or is waiting to be joined (C_EXITED). Additionally a "c_exit_code" field has been added to store the thread's exit value. Normally this is set when the thread entry function returns, but it is initialized to EXIT_INTERRUPT in case the thread is cancelled or calls pthread_exit() rather than returning (neither of which happens in the code today).

When the child thread starts, it registers a pthread cleanup handler which takes care of marking the child as C_EXITED and notifies the main thread that a child is gone. Doing this in a cleanup handler ensures that it's done regardless of how the thread exits. The main thread's loop is based around sigsuspsend(), so the notification is done by sending SIGUSR1. The main thread will then call cldmgr_join() to join all exited threads and obtain their exit status.

Quoted 7 lines

Additional changes:
* cldmgr_findbypid() has been removed, it's no longer referenced.
* stream_dead() no longer grabs the lock(), because it's called only from cldmgr_join() which already holds the lock().

Looks OK to me. Again, I've looked over this
pretty closely, but have not been as thorough
as I often am.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#13 lore raw

PATCH v2 7/8 xfsdump: path lookup cache must be thread specific

In reply to Bill Kendall

The xfsrestore path lookup routine (maps an ino + generation number to a pathname) contains a cache for fast lookups of consecutive files in the same parent directory. This cache either needs to be protected by a lock or a cache is needed per thread. I took the latter approach since it doesn't add lock contention and it increases the cache hit rate (it's relatively unlikely that each stream is processing files in the same directory).

---
 restore/tree.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
restore/tree.c +1 -1
index 7bddddf..9e4e83c 100644
@@ -3441,7 +3441,7 @@ Node2path( nh_t nh, char *path, char *errmsg )
 static intgen_t
 Node2path_recurse( nh_t nh, char *buf, intgen_t bufsz, intgen_t level )
 {
-	static path_cache_t cache = { NH_NULL, 0, "" };
+	static __thread path_cache_t cache = { NH_NULL, 0, "" };
 	node_t *np;
 	nh_t parh;
 	xfs_ino_t ino;
Signature · 6 lines
1.7.0.4

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v2 7/8
#14 lore raw

Re: [PATCH v2 7/8] xfsdump: path lookup cache must be thread specific

Quoted 10 lines · Bill Kendall

The xfsrestore path lookup routine (maps an ino + generation number to a pathname) contains a cache for fast lookups of consecutive files in the same parent directory. This cache either needs to be protected by a lock or a cache is needed per thread. I took the latter approach since it doesn't add lock contention and it increases the cache hit rate (it's relatively unlikely that each stream is processing files in the same directory).

So you're fixing a bug, and making it work
better at the same time, by simply adding one
keyword.

Looks good.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#15 lore raw

PATCH v2 8/8 xfsdump: enable multiple streams

In reply to Bill Kendall

IRIX contained an environment referred to as "miniroot" where sproc threads were either not available, or at least not used in xfsdump. Throughout xfsdump there's a "miniroot" variable which indicates whether or not thread support is enabled. On Linux this variable has always been false in order to disable support for multiple streams.

Now that the threading infracstructure has been converted over to pthreads, this patch removes the "miniroot" variable and enables the option of using multiple streams.

Note that another feature in xfsdump, using a ring buffer for I/O to tapes, also depends on thread support. I'm leaving that disabled for now until more testing has been done.

---
 common/drive.c          |   20 +------
 common/drive.h          |    8 +--
 common/drive_minrmt.c   |   15 +++---
 common/drive_scsitape.c |   15 +++---
 common/drive_simple.c   |    8 ++--
 common/main.c           |  124 +++++-----------------------------------------
 dump/content.c          |   35 ++++++-------
 dump/getopt.h           |    4 +-
 man/man8/xfsdump.8      |    8 +--
 man/man8/xfsrestore.8   |    4 +-
 restore/content.c       |   23 ++++-----
 restore/getopt.h        |    4 +-
 12 files changed, 74 insertions(+), 194 deletions(-)
common/drive.c +3 -17
index 227fecd..32a7191 100644
@@ -81,7 +81,7 @@ static drive_strategy_t *strategypp[] = {
  * specified on the command line.
  */
 bool_t
-drive_init1( int argc, char *argv[ ], bool_t singlethreaded )
+drive_init1( int argc, char *argv[ ] )
 {
 	intgen_t c;
 	ix_t driveix;
@@ -103,18 +103,6 @@ drive_init1( int argc, char *argv[ ], bool_t singlethreaded )
 		}
 	}
 
-	/* validate drive count
-	 */
-	if ( singlethreaded && drivecnt > 1 ) {
-		mlog( MLOG_NORMAL, _(
-		      "too many -%c arguments: "
-		      "maximum is %d when running in miniroot\n"),
-		      GETOPT_DUMPDEST,
-		      1 );
-		usage( );
-		return BOOL_FALSE;
-	}
-
 	/* allocate an array to hold ptrs to drive descriptors
 	 */
 	if (drivecnt > 0) {
@@ -221,8 +209,7 @@ drive_init1( int argc, char *argv[ ], bool_t singlethreaded )
 			intgen_t score;
 			score = ( * sp->ds_match )( argc,
 						    argv,
-						    drivep,
-						    singlethreaded );
+						    drivep );
 			if ( ! bestsp || score > bestscore ) {
 				bestsp = sp;
 				bestscore = score;
@@ -237,8 +224,7 @@ drive_init1( int argc, char *argv[ ], bool_t singlethreaded )
 		      bestsp->ds_description );
 		ok = ( * bestsp->ds_instantiate )( argc,
 						   argv,
-						   drivep,
-						   singlethreaded );
+						   drivep );
 		if ( ! ok ) {
 			return BOOL_FALSE;
 		}
common/drive.h +3 -5
index 4dc4270..f693976 100644
@@ -140,15 +140,13 @@ struct drive_strategy {
 		     */
 	intgen_t ( * ds_match )( intgen_t argc,
 				 char *argv[ ],
-				 struct drive *drivep,
-				 bool_t singlethreaded );
+				 struct drive *drivep );
 		    /* returns degree of match. drivep has been pre-allocated
 		     * and initialized with generic info.
 		     */
 	bool_t ( * ds_instantiate )( intgen_t argc,
 				     char *argv[ ],
-				     struct drive *drivep,
-				     bool_t singlethreaded );
+				     struct drive *drivep );
 		    /* creates a drive manager instance, by filling in the
 		     * blanks of the pre-allocated drive descriptor
 		     * returns FALSE on failure.
@@ -648,7 +646,7 @@ extern size_t partialmax;
  *
  * Returns FALSE if utility should be aborted.
  */
-extern bool_t drive_init1( int argc, char *argv[], bool_t singlethreaded );
+extern bool_t drive_init1( int argc, char *argv[] );
 
 
 /* drive_init2 - allocate and initialize read and write hdr buffers,
common/drive_minrmt.c +8 -7
index 3ff4d0f..5f5f96c 100644
@@ -257,8 +257,8 @@ extern int rmtwrite( int, const void *, uint);
 
 /* strategy functions
  */
-static intgen_t ds_match( int, char *[], drive_t *, bool_t );
-static intgen_t ds_instantiate( int, char *[], drive_t *, bool_t );
+static intgen_t ds_match( int, char *[], drive_t * );
+static intgen_t ds_instantiate( int, char *[], drive_t * );
 
 /* manager operations
  */
@@ -404,7 +404,7 @@ static u_int32_t cmdlineblksize = 0;
  */
 /* ARGSUSED */
 static intgen_t
-ds_match( int argc, char *argv[], drive_t *drivep, bool_t singlethreaded )
+ds_match( int argc, char *argv[], drive_t *drivep )
 {
 	intgen_t fd;
 	intgen_t c;
@@ -464,7 +464,7 @@ ds_match( int argc, char *argv[], drive_t *drivep, bool_t singlethreaded )
  */
 /*ARGSUSED*/
 static bool_t
-ds_instantiate( int argc, char *argv[], drive_t *drivep, bool_t singlethreaded )
+ds_instantiate( int argc, char *argv[], drive_t *drivep )
 {
 	drive_context_t *contextp;
 	intgen_t c;
@@ -487,9 +487,10 @@ ds_instantiate( int argc, char *argv[], drive_t *drivep, bool_t singlethreaded )
 	ASSERT( contextp );
 	memset( ( void * )contextp, 0, sizeof( *contextp ));
 
-	/* transfer indication of singlethreadedness to context
+	/* do not enable a separate I/O thread,
+	 * more testing to be done first...
 	 */
-	contextp->dc_singlethreadedpr = singlethreaded;
+	contextp->dc_singlethreadedpr = BOOL_TRUE;
 
 	/* scan the command line for the I/O buffer ring length
 	 * and record checksum request
@@ -580,7 +581,7 @@ ds_instantiate( int argc, char *argv[], drive_t *drivep, bool_t singlethreaded )
 	/* if threads not allowed, allocate a record buffer. otherwise
 	 * create a ring, from which buffers will be taken.
 	 */
-	if ( singlethreaded ) {
+	if ( contextp->dc_singlethreadedpr ) {
 		contextp->dc_bufp = ( char * )memalign( PGSZ, STAPE_MAX_RECSZ );
 		ASSERT( contextp->dc_bufp );
 	} else {
common/drive_scsitape.c +8 -7
index f24d604..71b809f 100644
@@ -299,8 +299,8 @@ extern int rmtwrite( int, const void *, uint);
 
 /* strategy functions
  */
-static intgen_t ds_match( int, char *[], drive_t *, bool_t );
-static intgen_t ds_instantiate( int, char *[], drive_t *, bool_t );
+static intgen_t ds_match( int, char *[], drive_t * );
+static intgen_t ds_instantiate( int, char *[], drive_t * );
 
 /* manager operations
  */
@@ -506,7 +506,7 @@ is_scsi_driver(char *pathname)
  */
 /* ARGSUSED */
 static intgen_t
-ds_match( int argc, char *argv[], drive_t *drivep, bool_t singlethreaded )
+ds_match( int argc, char *argv[], drive_t *drivep )
 {
 	struct mtget mt_stat;
 	intgen_t fd;
@@ -544,7 +544,7 @@ ds_match( int argc, char *argv[], drive_t *drivep, bool_t singlethreaded )
  */
 /*ARGSUSED*/
 static bool_t
-ds_instantiate( int argc, char *argv[], drive_t *drivep, bool_t singlethreaded )
+ds_instantiate( int argc, char *argv[], drive_t *drivep )
 {
 	drive_context_t *contextp;
 	intgen_t c;
@@ -567,9 +567,10 @@ ds_instantiate( int argc, char *argv[], drive_t *drivep, bool_t singlethreaded )
 	ASSERT( contextp );
 	memset( ( void * )contextp, 0, sizeof( *contextp ));
 
-	/* transfer indication of singlethreadedness to context
+	/* do not enable a separate I/O thread,
+	 * more testing to be done first...
 	 */
-	contextp->dc_singlethreadedpr = singlethreaded;
+	contextp->dc_singlethreadedpr = BOOL_TRUE;
 
 	/* scan the command line for the I/O buffer ring length
 	 * and record checksum request
@@ -670,7 +671,7 @@ ds_instantiate( int argc, char *argv[], drive_t *drivep, bool_t singlethreaded )
 	/* if threads not allowed, allocate a record buffer. otherwise
 	 * create a ring, from which buffers will be taken.
 	 */
-	if ( singlethreaded ) {
+	if ( contextp->dc_singlethreadedpr ) {
 		contextp->dc_bufp = ( char * )memalign( PGSZ, STAPE_MAX_RECSZ );
 		ASSERT( contextp->dc_bufp );
 	} else {
common/drive_simple.c +4 -4
index cb88aa8..086d162 100644
@@ -98,8 +98,8 @@ extern size_t pgsz;
 
 /* strategy functions
  */
-static intgen_t ds_match( int, char *[], drive_t *, bool_t );
-static intgen_t ds_instantiate( int, char *[], drive_t *, bool_t );
+static intgen_t ds_match( int, char *[], drive_t * );
+static intgen_t ds_instantiate( int, char *[], drive_t * );
 
 /* declare manager operators
  */
@@ -178,7 +178,7 @@ static drive_ops_t drive_ops = {
  */
 /* ARGSUSED */
 static intgen_t
-ds_match( int argc, char *argv[], drive_t *drivep, bool_t singlethreaded )
+ds_match( int argc, char *argv[], drive_t *drivep )
 {
 	bool_t isrmtpr;
 	struct stat64 statbuf;
@@ -221,7 +221,7 @@ ds_match( int argc, char *argv[], drive_t *drivep, bool_t singlethreaded )
  */
 /*ARGSUSED*/
 static bool_t
-ds_instantiate( int argc, char *argv[], drive_t *drivep, bool_t singlethreaded )
+ds_instantiate( int argc, char *argv[], drive_t *drivep )
 {
 	drive_context_t *contextp;
 
common/main.c +14 -110

221 lines not on this page · raw message

dump/content.c +16 -19
index 33f1166..3a7f508 100644
@@ -244,7 +244,6 @@ typedef struct pds pds_t;
 extern void usage( void );
 extern bool_t preemptchk( int );
 extern char *homedir;
-extern bool_t miniroot;
 extern bool_t pipeline;
 extern bool_t stdoutpiped;
 extern char *sistr;
@@ -2352,7 +2351,7 @@ content_stream_dump( ix_t strmix )
 					     inomap_next_nondir,
 					     inomap_contextp,
 					     ( intgen_t * )&rv,
-					     ( miniroot || pipeline ) ?
+					     pipeline ?
 					       (bool_t (*)(int))preemptchk : 0,
 					     bstatbufp,
 					     bstatbuflen );
@@ -2586,24 +2585,22 @@ decision_more:
 	 * from all streams have been registered.
 	 */
 	if ( drivep->d_capabilities & DRIVE_CAP_FILES ) {
-		if ( ! miniroot ) {
-			if ( stream_cnt( ) > 1 ) {
-				mlog( MLOG_VERBOSE, _(
-				      "waiting for synchronized "
-				      "session inventory dump\n") );
-				sc_stat_pds[ strmix ].pds_phase = PDS_INVSYNC;
-			}
+		if ( stream_cnt( ) > 1 ) {
+			mlog( MLOG_VERBOSE, _(
+			      "waiting for synchronized "
+			      "session inventory dump\n") );
+			sc_stat_pds[ strmix ].pds_phase = PDS_INVSYNC;
+		}
 
-			/* first be sure all threads have begun
-			 */
-			while ( sc_thrdsarrivedcnt < drivecnt ) {
-				sleep( 1 );
-			}
-			/* now wait for survivors to checkin
-			 */
-			while ( sc_thrdsdonecnt < stream_cnt( )) {
-				sleep( 1 );
-			}
+		/* first be sure all threads have begun
+		*/
+		while ( sc_thrdsarrivedcnt < drivecnt ) {
+			sleep( 1 );
+		}
+		/* now wait for survivors to checkin
+		*/
+		while ( sc_thrdsdonecnt < stream_cnt( )) {
+			sleep( 1 );
 		}
 		/* proceeed
 		 */
dump/getopt.h +2 -2
index 8a55631..ba26c93 100644
@@ -27,7 +27,7 @@
  * facilitating easy changes.
  */
 
-#define GETOPT_CMDSTRING	"ab:c:d:ef:hl:mop:qs:t:v:z:AB:CDEFG:H:I:JL:M:NO:PRSTUVWY:Z"
+#define GETOPT_CMDSTRING	"ab:c:d:ef:hl:mop:qs:t:v:z:AB:CDEFG:H:I:JL:M:NO:PRSTUVWY:"
 
 #define GETOPT_DUMPASOFFLINE	'a'	/* dump DMF dualstate files as offline */
 #define	GETOPT_BLOCKSIZE	'b'	/* blocksize for rmt */
@@ -80,6 +80,6 @@
 #define	GETOPT_SHOWLOGLEVEL	'W'	/* show level of log messages */
 /*				'X'	*/
 #define	GETOPT_RINGLEN		'Y'	/* specify I/O buffer ring length */
-#define	GETOPT_MINIROOT		'Z'	/* apply miniroot restrictions */
+/*				'Z'	   used on irix for miniroot */
 
 #endif /* GETOPT_H */
man/man8/xfsdump.8 +2 -6
index 46e6bd5..5360378 100644
@@ -66,10 +66,6 @@ option. Other techniques, such as making a second copy of the dump
 image, provide more protection against media failures than multiple
 media files will.
 .P
-However, the current implementation in Linux only supports one destination
-and running single threaded. Therefore, the above comments
-regarding multiple streams describe the possible future capabilities.
-.P
 .I xfsdump
 maintains an online dump inventory in \f2/var/lib/xfsdump/inventory\f1.
 The
@@ -391,8 +387,8 @@ Specify I/O buffer ring length.
 uses a ring of output buffers to achieve maximum throughput
 when dumping to tape drives.
 The default ring length is 3.
-However, this is only supported when running multi-threaded
-which has not been done for Linux yet - making this option benign.
+However, this is not currently enabled on
+Linux yet, making this option benign.
 .TP 5
 .B \-
 A lone
man/man8/xfsrestore.8 +2 -2
index 8e33ee9..aad97fa 100644
@@ -426,8 +426,8 @@ Specify I/O buffer ring length.
 uses a ring of input buffers to achieve maximum throughput
 when restoring from tape drives.
 The default ring length is 3.
-However, this is only supported when running multi-threaded
-which has not been done for Linux yet - making this option benign.
+However, this is not currently enabled on
+Linux yet, making this option benign.
 .TP 5
 .B \-
 A lone
restore/content.c +10 -13
index 0108a40..a9e0b20 100644
@@ -660,7 +660,6 @@ typedef struct tran tran_t;
 extern void usage( void );
 extern bool_t preemptchk( void );
 extern char *homedir;
-extern bool_t miniroot;
 extern bool_t pipeline;
 extern bool_t stdoutpiped;
 extern char *sistr;
@@ -2544,14 +2543,12 @@ content_stream_restore( ix_t thrdix )
 	}
 	tranp->t_sync5 = SYNC_BUSY;
 	unlock( );
-	if ( ! miniroot ) {
-		if ( drivecnt > 1 ) {
-			mlog( MLOG_TRACE,
-			      "waiting for other streams to exit\n" );
-		}
-		while ( cldmgr_otherstreamsremain( thrdix )) {
-			sleep( 1 );
-		}
+	if ( drivecnt > 1 ) {
+		mlog( MLOG_TRACE,
+		      "waiting for other streams to exit\n" );
+	}
+	while ( cldmgr_otherstreamsremain( thrdix )) {
+		sleep( 1 );
 	}
 
 	mlog( MLOG_DEBUG,
@@ -3006,10 +3003,10 @@ applydirdump( drive_t *drivep,
 				return RV_INTR;
 			}
 
-			/* if miniroot or pipeline , call preemptchk( ) to
+			/* if in a pipeline , call preemptchk( ) to
 			 * print status reports
 			 */
-			if ( miniroot || pipeline )
+			if ( pipeline )
 			{
 				mlog( MLOG_DEBUG ,
 					"preemptchk( )\n");
@@ -3543,10 +3540,10 @@ applynondirdump( drive_t *drivep,
 				       fhdrp->fh_offset );
 		}
 
-		/* if miniroot or pipeline , call preemptchk( ) to
+		/* if in a pipeline , call preemptchk( ) to
 		 * print status reports
 		 */
-		if ( miniroot || pipeline )
+		if ( pipeline )
 		{
 			mlog( MLOG_DEBUG ,
 				"preemptchk( )\n");
restore/getopt.h +2 -2
index 4ee865d..63568de 100644
@@ -26,7 +26,7 @@
  * purpose is to contain that command string.
  */
 
-#define GETOPT_CMDSTRING	"a:b:c:def:himn:op:qrs:tv:wABCDEFG:H:I:JL:M:NO:PQRS:TUVWX:Y:Z"
+#define GETOPT_CMDSTRING	"a:b:c:def:himn:op:qrs:tv:wABCDEFG:H:I:JL:M:NO:PQRS:TUVWX:Y:"
 
 #define GETOPT_WORKSPACE	'a'	/* workspace dir (content.c) */
 #define GETOPT_BLOCKSIZE        'b'     /* blocksize for rmt */
@@ -79,6 +79,6 @@
 #define	GETOPT_SHOWLOGLEVEL	'W'	/* show level of log messages */
 #define	GETOPT_NOSUBTREE	'X'	/* subtree to exclude */
 #define	GETOPT_RINGLEN		'Y'	/* specify I/O buffer ring length */
-#define	GETOPT_MINIROOT		'Z'	/* apply miniroot restrictions */
+/*				'Z'	   used on irix for miniroot */
 
 #endif /* GETOPT_H */
Signature · 6 lines
1.7.0.4

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v2 8/8
#16 lore raw

Re: [PATCH v2 8/8] xfsdump: enable multiple streams

Quoted 11 lines · Bill Kendall

IRIX contained an environment referred to as "miniroot" where sproc threads were either not available, or at least not used in xfsdump. Throughout xfsdump there's a "miniroot" variable which indicates whether or not thread support is enabled. On Linux this variable has always been false in order to disable support for multiple streams.

Now that the threading infracstructure has been converted over to pthreads, this patch removes the "miniroot" variable and enables the option of using multiple streams.

Quoted 6 lines

Note that another feature in xfsdump, using a ring buffer for I/O to tapes, also depends on thread support. I'm leaving that disabled for now until more testing has been done.

Really, really nice work Bill.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#17 lore raw
In reply to Bill Kendall

I've put these changes, and Mike's path.c fix in. It seems like the whole autoconf/aclocal foo needs to be regenerated to make the libpthread substitution to work.

What is your schedule for turning on the tap ring buffer, and redoing the stream split scan? Should we wait for them or aim for a release with the current improvements relatively quickly?

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#18 lore raw
Quoted 7 lines · Christoph Hellwig

I've put these changes, and Mike's path.c fix in. It seems like the whole autoconf/aclocal foo needs to be regenerated to make the libpthread substitution to work.

What is your schedule for turning on the tap ring buffer, and redoing the stream split scan? Should we wait for them or aim for a release with the current improvements relatively quickly?

I haven't started working on any of that yet, and will be side tracked with other work for a while. It's probably best not to hold a release for those changes.

Bill

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs