From nobody Thu Mar 16 00:12:16 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PcSPX3f1gz3y1Vp; Thu, 16 Mar 2023 00:12:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PcSPX2rPTz4HW9; Thu, 16 Mar 2023 00:12:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678925536; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8LPXVLWvQEGzcZbOATrqFPkXJZmfHcU9IpljzgZEyQ8=; b=tLLN+i1GnWKarqyie4hx0UMOvwyFLcZPE0BBZHF3bNRdeNoOrtbsarPbwBPQAJOiLpP5FA nHgGrZ945TJC8YYDualbu0tHaabkHf2hK1lHZybtj1p0WKm9YFkZvMnu0wxUqPLnHYtJQ5 6sFz/GGSvgF5uRnOMDb6NT7aIgIJuV+1/Zw87wmfjrtK4b4dPLuDtbFdFZDffI1Kxdww98 QvIFTDAM+tpUUs5JkH+yTtB1s+CsmQyPSLZhspU4PUl4tgPd+lMloIPft7v5Fwxz3fFhxA mQ34VMhahxt54HXAsa5xT/jkzz0YK+5hySInTT4cpSYY6YJ06Pwh1QtoYq16nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678925536; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8LPXVLWvQEGzcZbOATrqFPkXJZmfHcU9IpljzgZEyQ8=; b=k8DUDavQLiSwabzzoUqmkN3iVzqNJRHSFrGKUVr9MR9DIMvMd7IUhT0glci2DG50Jzlb9y qqKEvlfCuwLndVJ4UkXcTL11J1pwTa9+ISHCLdDA5XxiQqbVKMer9AhNi7lujdiPLECBnk 6+CNjqEFz8/FuPEmqUxkt+yB4YBsXCsUhexIcs+lWgO4VUWUfTlElaOp2El8WBx/jjA+XP /T1+YwVzHM7sMX+og6qlDSM7o6PqwLhI0Rdlq6EIGm9LRdiIeahoLVGvdbxJFre5j3Qj7F 5DwI35TeVwQTphrL1C5aLub++Qkl+6cOD1M/TMHIq+uzryxaKv0ivOfhm8npPQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678925536; a=rsa-sha256; cv=none; b=K9af3w8ZeSGSOhLbDssX/eAuczk34IgnCWxNz8fg7EsqpVHZzn0KcVgSRqbSPiGa29CZVU vKX8kM0AQruoR+3OwrHLSt5HpbNcrELvbFfibvUGGknecm+HTiMhEw8dLQ9KQ6S+UAbTc+ cT/wtYHtzcJznXvY436C05XHNsDnI5DaV19nQRH94swzbu88t1x5+iUOaM2ZD3irj0VzKH SM5OqJ2BxEDACgxRUKl3cWCT1T7zLcGSSLcT8eJ3D6FmWszKA3aT0RP6OzqkqiNiYvBFQ5 KhwyqgBMhMOLEsm35O0Q6DBAVgQaccEcxMVcLQidR5tL1hlmx8VAQrirgFJqfQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PcSPX1w5vzM1R; Thu, 16 Mar 2023 00:12:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32G0CG95096384; Thu, 16 Mar 2023 00:12:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32G0CGFH096383; Thu, 16 Mar 2023 00:12:16 GMT (envelope-from git) Date: Thu, 16 Mar 2023 00:12:16 GMT Message-Id: <202303160012.32G0CGFH096383@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 3a60f9c605a2 - releng/13.2 - makefs: make msdos creation go fast List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 3a60f9c605a26784607e2b44f4fc184dca414445 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3a60f9c605a26784607e2b44f4fc184dca414445 commit 3a60f9c605a26784607e2b44f4fc184dca414445 Author: Warner Losh AuthorDate: 2023-03-13 20:28:51 +0000 Commit: Warner Losh CommitDate: 2023-03-15 23:14:12 +0000 makefs: make msdos creation go fast Add missing brelse(bp). Without it the cache grows and we have a n^2 lookup. I'm not entirely sure why we read the block before we write it back out, since the only side effect of that is to allocate memory, clear the memory, read it in from disk, throw it away with the contents of the file being written out. We likely should just do a getblk() here instead, but even with all that, this takes the time it takes to create a 150MB msdos fs image down from 5 minutes to 30 seconds. Old: 317.663u 0.685s 5:18.34 100.0% 198+360k 0+19io 1009pf+0w New: 7.330u 23.841s 0:31.17 100.0% 198+360k 0+250522io 4pf+0w See code review for how we got this. tl;dr: netbsd move brelse into bwrite and we picked up msdos code after that, but not the move. That change should be picked up later. Sponsored by: Netflix Reviewed by: emaste MFC After: 1 day (13.2 is coming fast) Differential Revision: https://reviews.freebsd.org/D39025 Approved by: re@ (cperciva) (cherry picked from commit 370e009188ba90c3290b1479aa06ec98b66e140a) (cherry picked from commit aa1e6a4f4c28c7051ee9431ecb7802309cc1bf96) --- usr.sbin/makefs/msdos/msdosfs_vnops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.sbin/makefs/msdos/msdosfs_vnops.c b/usr.sbin/makefs/msdos/msdosfs_vnops.c index ff470576ee79..198efae31a0e 100644 --- a/usr.sbin/makefs/msdos/msdosfs_vnops.c +++ b/usr.sbin/makefs/msdos/msdosfs_vnops.c @@ -501,6 +501,7 @@ msdosfs_wfile(const char *path, struct denode *dep, fsnode *node) cpsize = MIN((nsize - offs), blsize - on); memcpy(bp->b_data + on, dat + offs, cpsize); bwrite(bp); + brelse(bp); offs += cpsize; }