Project

General

Profile

Bug #1356 » zfs_prefetch.patch

Martin Matuška, 2011-08-10 06:31 PM

View differences:

usr/src/uts/common/fs/zfs/dmu_objset.c Fri Jul 22 09:27:57 2011 -0700 → usr/src/uts/common/fs/zfs/dmu_objset.c Wed Aug 10 20:22:50 2011 +0200
1748 1748
dmu_objset_prefetch(const char *name, void *arg)
1749 1749
{
1750 1750
	dsl_dataset_t *ds;
1751
	char *cp;
1752

  
1753
	/*
1754
	 * If the objset starts with a '%', then ignore it.
1755
	 * These hidden datasets are always inconsistent and by not opening
1756
	 * them here, we can avoid a race with dsl_dir_destroy_check().
1757
	 */
1758
	cp = strrchr(name, '/');
1759
	if (cp && cp[1] == '%')
1760
		return (0);
1751 1761

  
1752 1762
	if (dsl_dataset_hold(name, FTAG, &ds))
1753 1763
		return (0);
1754 1764

  
1765
	/*
1766
	 * If the objset is in an inconsistent state (eg, in the process
1767
	 * of being destroyed), don't prefetch it.
1768
	 */
1769
	if (ds->ds_phys->ds_flags & DS_FLAG_INCONSISTENT) {
1770
		dsl_dataset_rele(ds, FTAG);
1771
		return (0);
1772
	}
1773

  
1755 1774
	if (!BP_IS_HOLE(&ds->ds_phys->ds_bp)) {
1756 1775
		mutex_enter(&ds->ds_opening_lock);
1757 1776
		if (ds->ds_objset == NULL) {
usr/src/uts/common/fs/zfs/zfs_ioctl.c Fri Jul 22 09:27:57 2011 -0700 → usr/src/uts/common/fs/zfs/zfs_ioctl.c Wed Aug 10 20:22:50 2011 +0200
1944 1944
		int len = sizeof (zc->zc_name) - (p - zc->zc_name);
1945 1945

  
1946 1946
		while (dmu_dir_list_next(os, len, p, NULL, &cookie) == 0)
1947
			(void) dmu_objset_prefetch(p, NULL);
1947
			(void) dmu_objset_prefetch(zc->zc_name, NULL);
1948 1948
	}
1949 1949

  
1950 1950
	do {
(1-1/3)