From owner-freebsd-fs@FreeBSD.ORG Fri Jul 4 02:41:38 2014 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 29352538; Fri, 4 Jul 2014 02:41:38 +0000 (UTC) Received: from mail-wi0-x22c.google.com (mail-wi0-x22c.google.com [IPv6:2a00:1450:400c:c05::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 91F2C220B; Fri, 4 Jul 2014 02:41:37 +0000 (UTC) Received: by mail-wi0-f172.google.com with SMTP id hi2so12300134wib.5 for ; Thu, 03 Jul 2014 19:41:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=O3U0lY1sS/JXZ9ZwhFuagjCTQtWQ1fDjz/2+PLAvpk8=; b=cd0N93eMGkpYcJRpKCSlW9/Z0oQ+wb65DDHDWiXnukZnYZlaRHxEUolK8lpA651/35 se4TXNw+tsDFbvK7NAyM2vh4VuJzHpFLV4kss7Q3uh/x5HPiVRdz4sl7DoRbXvMv1dMY PH4mS05RLAzXfXj8C1BCEIOHijsjahXhoV8291NkdPFbZNSp0G7eR5G9/KU7r9PR52Ri Rz431CDy4vy+6LrSDN5yEBkM/Y/fx2nPYfXZluQUHJBBMkLUiKbgWcVluPHjF/WyErln BghdnDurq96WhOOONn4x/5W385pJBjvDaGAKXMU5NA2aordsEgE5PH0fqhnuN1bUfEYI urKg== X-Received: by 10.180.74.9 with SMTP id p9mr14723281wiv.39.1404441695713; Thu, 03 Jul 2014 19:41:35 -0700 (PDT) Received: from mavbook.mavhome.dp.ua ([134.249.139.101]) by mx.google.com with ESMTPSA id nc19sm19330251wic.4.2014.07.03.19.41.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Jul 2014 19:41:34 -0700 (PDT) Sender: Alexander Motin Message-ID: <53B6145D.1090405@FreeBSD.org> Date: Fri, 04 Jul 2014 05:41:33 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Pawel Jakub Dawidek Subject: Re: zfs_setextattr() synchronicity References: <53B5FD02.5030700@FreeBSD.org> In-Reply-To: <53B5FD02.5030700@FreeBSD.org> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: FreeBSD Filesystems X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jul 2014 02:41:38 -0000 On 04.07.2014 04:01, Alexander Motin wrote: > Doing some Samba benchmarks, creating many small files on ZFS, I've > noticed that it's performance heavily depends on dedicated ZIL presence. > Looking deeper I've noticed that most of time is spent in > extattr_set_file() syscall. Deeper look brought me to zfs_vnops.c, where > in zfs_setextattr() I found: > VOP_WRITE(vp, ap->a_uio, IO_UNIT | IO_SYNC, ap->a_cred); > > I guess that IO_SYNC here is what causes ZIL commit for every created > file, when Samba sets some DOSATTRIB attribute. I've tried to find that > code in Solaris, but failed. Is it FreeBSD specific? Same time, looking > on UFS code, I see that it does not synchronizes those calls by default. > Same as not synchronized by default (unless sync=always is set) > zfs_setattr() calls for ZFS. Why is zfs_setextattr() synchronized > heavier then zfs_setattr()? I've found that such single-line patch improves results of file creation benchmark on Samba by several times: --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -6710,7 +6710,7 @@ vop_setextattr { va.va_size = 0; error = VOP_SETATTR(vp, &va, ap->a_cred); if (error == 0) - VOP_WRITE(vp, ap->a_uio, IO_UNIT | IO_SYNC, ap->a_cred); + VOP_WRITE(vp, ap->a_uio, IO_UNIT, ap->a_cred); VOP_UNLOCK(vp, 0); vn_close(vp, flags, ap->a_cred, td); Can anybody tell me why setting extended attributes on ZFS require zil_commit(), while otherwise it is possible to create and write files, change their permissions, etc. without ever doing zil_commit(). It looks at least strange to me. -- Alexander Motin