View | Details | Raw Unified | Return to bug 155749
Collapse All | Expand All

(-)copy/xfs_copy.c (-14 / +18 lines)
Lines 344-355 static xfs_off_t source_position = -1; Link Here
344
wbuf *
344
wbuf *
345
wbuf_init(wbuf *buf, int data_size, int data_align, int min_io_size, int id)
345
wbuf_init(wbuf *buf, int data_size, int data_align, int min_io_size, int id)
346
{
346
{
347
	buf->id = id;
347
	ASSERT(data_size % BBSIZE == 0);
348
	if ((buf->data = memalign(data_align, data_size)) == NULL)
348
	while ((buf->data = memalign(data_align, data_size)) == NULL) {
349
		return NULL;
349
		data_size >>= 1;
350
		if (data_size < min_io_size)
351
			return NULL;
352
	}
350
	ASSERT(min_io_size % BBSIZE == 0);
353
	ASSERT(min_io_size % BBSIZE == 0);
351
	buf->min_io_size = min_io_size;
354
	buf->min_io_size = min_io_size;
352
	buf->size = MAX(data_size, 2*min_io_size);
355
	buf->size = data_size;
356
	buf->id = id;
353
	return buf;
357
	return buf;
354
}
358
}
355
359
Lines 424-430 read_ag_header(int fd, xfs_agnumber_t ag Link Here
424
	off = XFS_AG_DADDR(mp, agno, XFS_SB_DADDR);
428
	off = XFS_AG_DADDR(mp, agno, XFS_SB_DADDR);
425
	buf->position = (xfs_off_t) off * (xfs_off_t) BBSIZE;
429
	buf->position = (xfs_off_t) off * (xfs_off_t) BBSIZE;
426
	length = buf->length = first_agbno * blocksize;
430
	length = buf->length = first_agbno * blocksize;
427
	
431
428
	/* handle alignment stuff */
432
	/* handle alignment stuff */
429
433
430
	newpos = rounddown(buf->position, (xfs_off_t) buf->min_io_size);
434
	newpos = rounddown(buf->position, (xfs_off_t) buf->min_io_size);
Lines 618-630 main(int argc, char **argv) Link Here
618
		}
622
		}
619
623
620
		wbuf_align = d.d_mem;
624
		wbuf_align = d.d_mem;
621
		wbuf_size = d.d_maxiosz;
625
		wbuf_size = MIN(d.d_maxiosz, 1 * 1024 * 1024);
622
		wbuf_miniosize = d.d_miniosz;
626
		wbuf_miniosize = d.d_miniosz;
623
	} else  {
627
	} else  {
624
		/* set arbitrary I/O params, miniosize at least 1 disk block */
628
		/* set arbitrary I/O params, miniosize at least 1 disk block */
625
629
626
		wbuf_align = 4096*4;
630
		wbuf_align = getpagesize();
627
		wbuf_size = 1024 * 4000;
631
		wbuf_size = 1 * 1024 * 1024;
628
		wbuf_miniosize = -1;	/* set after mounting source fs */
632
		wbuf_miniosize = -1;	/* set after mounting source fs */
629
	}
633
	}
630
634
Lines 726-732 main(int argc, char **argv) Link Here
726
730
727
	for (i = 0; i < num_targets; i++)  {
731
	for (i = 0; i < num_targets; i++)  {
728
		int	write_last_block = 0;
732
		int	write_last_block = 0;
729
	
733
730
		if (stat64(target[i].name, &statbuf) < 0)  {
734
		if (stat64(target[i].name, &statbuf) < 0)  {
731
			/* ok, assume it's a file and create it */
735
			/* ok, assume it's a file and create it */
732
736
Lines 833-839 main(int argc, char **argv) Link Here
833
		exit(1);
837
		exit(1);
834
	}
838
	}
835
	/* need to start out blocking */
839
	/* need to start out blocking */
836
	pthread_mutex_lock(&mainwait); 
840
	pthread_mutex_lock(&mainwait);
837
841
838
	/* set up sigchild signal handler */
842
	/* set up sigchild signal handler */
839
843
Lines 860-866 main(int argc, char **argv) Link Here
860
			exit(1);
864
			exit(1);
861
		}
865
		}
862
		/* need to start out blocking */
866
		/* need to start out blocking */
863
		pthread_mutex_lock(&tcarg->wait); 
867
		pthread_mutex_lock(&tcarg->wait);
864
	}
868
	}
865
869
866
	for (i = 0, tcarg = targ; i < num_targets; i++, tcarg++)  {
870
	for (i = 0, tcarg = targ; i < num_targets; i++, tcarg++)  {
Lines 1153-1159 main(int argc, char **argv) Link Here
1153
1157
1154
	check_errors();
1158
	check_errors();
1155
	killall();
1159
	killall();
1156
	pthread_exit(NULL);		
1160
	pthread_exit(NULL);
1157
	/*NOTREACHED*/
1161
	/*NOTREACHED*/
1158
	return 0;
1162
	return 0;
1159
}
1163
}
Lines 1176-1182 next_log_chunk(xfs_caddr_t p, int offset Link Here
1176
/*
1180
/*
1177
 * Writes a log header at the start of the log (with the real
1181
 * Writes a log header at the start of the log (with the real
1178
 * filesystem UUID embedded into it), and writes to all targets.
1182
 * filesystem UUID embedded into it), and writes to all targets.
1179
 * 
1183
 *
1180
 * Returns the next buffer-length-aligned disk address.
1184
 * Returns the next buffer-length-aligned disk address.
1181
 */
1185
 */
1182
xfs_off_t
1186
xfs_off_t
Lines 1203-1209 write_log_header(int fd, wbuf *buf, xfs_ Link Here
1203
			next_log_chunk, buf);
1207
			next_log_chunk, buf);
1204
	do_write(buf->owner);
1208
	do_write(buf->owner);
1205
1209
1206
	return logstart + roundup(offset, buf->length);
1210
	return roundup(logstart + offset, buf->length);
1207
}
1211
}
1208
1212
1209
/*
1213
/*

Return to bug 155749