public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* REVIEW: Enhance xfs_repair -P option to disable libxfs xfs_buf_t locking
@ 2008-05-30  0:49 Barry Naujok
  2008-05-30  0:52 ` Eric Sandeen
  0 siblings, 1 reply; 5+ messages in thread
From: Barry Naujok @ 2008-05-30  0:49 UTC (permalink / raw)
  To: xfs@oss.sgi.com

[-- Attachment #1: Type: text/plain, Size: 4478 bytes --]

I hope the subject is explanation enough :)

Tested successfully by Sebastian on his filesystem reported in
http://oss.sgi.com/archives/xfs/2008-05/msg00410.html

===========================================================================
xfsprogs/include/libxfs.h
===========================================================================

--- a/xfsprogs/include/libxfs.h	2008-05-28 18:10:03.000000000 +1000
+++ b/xfsprogs/include/libxfs.h	2008-05-28 17:47:13.956576883 +1000
@@ -69,11 +69,14 @@ typedef struct {
  	char            *rtname;        /* pathname of realtime "subvolume" */
  	int             isreadonly;     /* filesystem is only read in applic */
  	int             isdirect;       /* we can attempt to use direct I/O */
-	int             disfile;        /* data "subvolume" is a regular file  
*/        int             dcreat;         /* try to create data subvolume  
*/
+	int             disfile;        /* data "subvolume" is a regular file */
+	int             dcreat;         /* try to create data subvolume */
  	int             lisfile;        /* log "subvolume" is a regular file */
  	int             lcreat;         /* try to create log subvolume */
-	int             risfile;        /* realtime "subvolume" is a reg file  
*/        int             rcreat;         /* try to create realtime  
subvolume */
+	int             risfile;        /* realtime "subvolume" is a reg file */
+	int             rcreat;         /* try to create realtime subvolume */
  	int		setblksize;	/* attempt to set device blksize */
+	int		nobuflock;	/* don't lock xfs_buf_t's */
  				/* output results */
  	dev_t           ddev;           /* device for data subvolume */
  	dev_t           logdev;         /* device for log subvolume */

===========================================================================
xfsprogs/libxfs/init.c
===========================================================================

--- a/xfsprogs/libxfs/init.c	2008-05-28 18:10:03.000000000 +1000
+++ b/xfsprogs/libxfs/init.c	2008-05-28 17:50:48.105195527 +1000
@@ -28,6 +28,8 @@ int libxfs_ihash_size;		/* #buckets in i
  struct cache *libxfs_bcache;	/* global buffer cache */
  int libxfs_bhash_size;		/* #buckets in bcache */

+int	no_xfs_buf_lock;	/* global don't use xfs_buf_t lock flag */
+
  static void manage_zones(int);	/* setup global zones */

  /*
@@ -335,6 +337,7 @@ libxfs_init(libxfs_init_t *a)
  	if (!libxfs_bhash_size)
  		libxfs_bhash_size = LIBXFS_BHASHSIZE(sbp);
  	libxfs_bcache = cache_init(libxfs_bhash_size, &libxfs_bcache_operations);
+	no_xfs_buf_lock = a->nobuflock;
  	manage_zones(0);
  	rval = 1;
  done:

===========================================================================
xfsprogs/libxfs/rdwr.c
===========================================================================

--- a/xfsprogs/libxfs/rdwr.c	2008-05-28 18:10:03.000000000 +1000
+++ b/xfsprogs/libxfs/rdwr.c	2008-05-28 18:01:29.735224868 +1000
@@ -375,6 +375,8 @@ struct list_head	lock_buf_list = {&lock_
  int			lock_buf_count = 0;
  #endif

+extern int     no_xfs_buf_lock;
+
  xfs_buf_t *
  libxfs_getbuf(dev_t device, xfs_daddr_t blkno, int len)
  {
@@ -388,7 +390,8 @@ libxfs_getbuf(dev_t device, xfs_daddr_t

  	miss = cache_node_get(libxfs_bcache, &key, (struct cache_node **)&bp);
  	if (bp) {
-		pthread_mutex_lock(&bp->b_lock);
+		if (!no_xfs_buf_lock)
+			pthread_mutex_lock(&bp->b_lock);
  		cache_node_set_priority(libxfs_bcache, (struct cache_node *)bp,
  			cache_node_get_priority((struct cache_node *)bp) - 4);
  #ifdef XFS_BUF_TRACING
@@ -417,7 +420,8 @@ libxfs_putbuf(xfs_buf_t *bp)
  	list_del_init(&bp->b_lock_list);
  	pthread_mutex_unlock(&libxfs_bcache->c_mutex);
  #endif
-	pthread_mutex_unlock(&bp->b_lock);
+	if (!no_xfs_buf_lock)
+		pthread_mutex_unlock(&bp->b_lock);
  	cache_node_put((struct cache_node *)bp);
  }


===========================================================================
xfsprogs/repair/init.c
===========================================================================

--- a/xfsprogs/repair/init.c	2008-05-28 18:10:03.000000000 +1000
+++ b/xfsprogs/repair/init.c	2008-05-28 17:52:26.024674072 +1000
@@ -135,6 +135,7 @@ xfs_init(libxfs_init_t *args)
  		/* XXX assume data file also means rt file */
  	}

+	args->nobuflock = !do_prefetch;
  	args->setblksize = !dangerously;
  	args->isdirect = LIBXFS_DIRECT;
  	if (no_modify)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: no_xfs_buf_t_lock_repair.patch --]
[-- Type: text/x-patch; name=no_xfs_buf_t_lock_repair.patch, Size: 4171 bytes --]


===========================================================================
xfsprogs/include/libxfs.h
===========================================================================

--- a/xfsprogs/include/libxfs.h	2008-05-28 18:10:03.000000000 +1000
+++ b/xfsprogs/include/libxfs.h	2008-05-28 17:47:13.956576883 +1000
@@ -69,11 +69,14 @@ typedef struct {
 	char            *rtname;        /* pathname of realtime "subvolume" */
 	int             isreadonly;     /* filesystem is only read in applic */
 	int             isdirect;       /* we can attempt to use direct I/O */
-	int             disfile;        /* data "subvolume" is a regular file */        int             dcreat;         /* try to create data subvolume */
+	int             disfile;        /* data "subvolume" is a regular file */
+	int             dcreat;         /* try to create data subvolume */
 	int             lisfile;        /* log "subvolume" is a regular file */
 	int             lcreat;         /* try to create log subvolume */
-	int             risfile;        /* realtime "subvolume" is a reg file */        int             rcreat;         /* try to create realtime subvolume */
+	int             risfile;        /* realtime "subvolume" is a reg file */
+	int             rcreat;         /* try to create realtime subvolume */
 	int		setblksize;	/* attempt to set device blksize */
+	int		nobuflock;	/* don't lock xfs_buf_t's */
 				/* output results */
 	dev_t           ddev;           /* device for data subvolume */
 	dev_t           logdev;         /* device for log subvolume */

===========================================================================
xfsprogs/libxfs/init.c
===========================================================================

--- a/xfsprogs/libxfs/init.c	2008-05-28 18:10:03.000000000 +1000
+++ b/xfsprogs/libxfs/init.c	2008-05-28 17:50:48.105195527 +1000
@@ -28,6 +28,8 @@ int libxfs_ihash_size;		/* #buckets in i
 struct cache *libxfs_bcache;	/* global buffer cache */
 int libxfs_bhash_size;		/* #buckets in bcache */
 
+int	no_xfs_buf_lock;	/* global don't use xfs_buf_t lock flag */
+
 static void manage_zones(int);	/* setup global zones */
 
 /*
@@ -335,6 +337,7 @@ libxfs_init(libxfs_init_t *a)
 	if (!libxfs_bhash_size)
 		libxfs_bhash_size = LIBXFS_BHASHSIZE(sbp);
 	libxfs_bcache = cache_init(libxfs_bhash_size, &libxfs_bcache_operations);
+	no_xfs_buf_lock = a->nobuflock;
 	manage_zones(0);
 	rval = 1;
 done:

===========================================================================
xfsprogs/libxfs/rdwr.c
===========================================================================

--- a/xfsprogs/libxfs/rdwr.c	2008-05-28 18:10:03.000000000 +1000
+++ b/xfsprogs/libxfs/rdwr.c	2008-05-28 18:01:29.735224868 +1000
@@ -375,6 +375,8 @@ struct list_head	lock_buf_list = {&lock_
 int			lock_buf_count = 0;
 #endif
 
+extern int     no_xfs_buf_lock;
+
 xfs_buf_t *
 libxfs_getbuf(dev_t device, xfs_daddr_t blkno, int len)
 {
@@ -388,7 +390,8 @@ libxfs_getbuf(dev_t device, xfs_daddr_t 
 
 	miss = cache_node_get(libxfs_bcache, &key, (struct cache_node **)&bp);
 	if (bp) {
-		pthread_mutex_lock(&bp->b_lock);
+		if (!no_xfs_buf_lock)
+			pthread_mutex_lock(&bp->b_lock);
 		cache_node_set_priority(libxfs_bcache, (struct cache_node *)bp,
 			cache_node_get_priority((struct cache_node *)bp) - 4);
 #ifdef XFS_BUF_TRACING
@@ -417,7 +420,8 @@ libxfs_putbuf(xfs_buf_t *bp)
 	list_del_init(&bp->b_lock_list);
 	pthread_mutex_unlock(&libxfs_bcache->c_mutex);
 #endif
-	pthread_mutex_unlock(&bp->b_lock);
+	if (!no_xfs_buf_lock)
+		pthread_mutex_unlock(&bp->b_lock);
 	cache_node_put((struct cache_node *)bp);
 }
 

===========================================================================
xfsprogs/repair/init.c
===========================================================================

--- a/xfsprogs/repair/init.c	2008-05-28 18:10:03.000000000 +1000
+++ b/xfsprogs/repair/init.c	2008-05-28 17:52:26.024674072 +1000
@@ -135,6 +135,7 @@ xfs_init(libxfs_init_t *args)
 		/* XXX assume data file also means rt file */
 	}
 
+	args->nobuflock = !do_prefetch;
 	args->setblksize = !dangerously;
 	args->isdirect = LIBXFS_DIRECT;
 	if (no_modify)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-05-30  1:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-30  0:49 REVIEW: Enhance xfs_repair -P option to disable libxfs xfs_buf_t locking Barry Naujok
2008-05-30  0:52 ` Eric Sandeen
2008-05-30  1:03   ` Barry Naujok
2008-05-30  1:13   ` Barry Naujok
2008-05-30  1:17     ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox