Merge of master-melb:xfs-cmds:31256a by kenmcd.
Add "usebuflock" field to xfs_init
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 usebuflock; /* lock xfs_buf_t's - for MT usage */
/* output results */
dev_t ddev; /* device for data subvolume */
dev_t logdev; /* device for log subvolume */
struct cache *libxfs_bcache; /* global buffer cache */
int libxfs_bhash_size; /* #buckets in bcache */
+int use_xfs_buf_lock; /* global flag: use xfs_buf_t locks for MT */
+
static void manage_zones(int); /* setup global zones */
/*
if (!libxfs_bhash_size)
libxfs_bhash_size = LIBXFS_BHASHSIZE(sbp);
libxfs_bcache = cache_init(libxfs_bhash_size, &libxfs_bcache_operations);
+ use_xfs_buf_lock = a->usebuflock;
manage_zones(0);
rval = 1;
done:
int lock_buf_count = 0;
#endif
+extern int use_xfs_buf_lock;
+
xfs_buf_t *
libxfs_getbuf(dev_t device, xfs_daddr_t blkno, int len)
{
miss = cache_node_get(libxfs_bcache, &key, (struct cache_node **)&bp);
if (bp) {
- pthread_mutex_lock(&bp->b_lock);
+ if (use_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
list_del_init(&bp->b_lock_list);
pthread_mutex_unlock(&libxfs_bcache->c_mutex);
#endif
- pthread_mutex_unlock(&bp->b_lock);
+ if (use_xfs_buf_lock)
+ pthread_mutex_unlock(&bp->b_lock);
cache_node_put((struct cache_node *)bp);
}
should not modify the filesystem but should only scan the
filesystem and indicate what repairs would have been made.
.TP
+.B \-P
+Disable prefetching of inode and directory blocks. Use this option if
+you find
+.B xfs_repair
+gets stuck and stops proceeding. Interrupting a stuck
+.B xfs_repair
+is safe.
+.TP
.BI \-m " maxmem"
Specifies the approximate maximum amount of memory, in megabytes, to use for
.BR xfs_repair .
outputs its progress every 15 minutes. Reporting is only activated when
ag_stride is enabled.
.TP
-.B \-P
-Disable prefetching of inode and directory blocks.
-.TP
.B \-v
Verbose output.
.TP
/* XXX assume data file also means rt file */
}
+ args->usebuflock = do_prefetch;
args->setblksize = !dangerously;
args->isdirect = LIBXFS_DIRECT;
if (no_modify)