From nobody Tue Mar 14 16:16:06 2023 X-Original-To: dev-commits-src-branches@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 4PbdtZ3lC2z3yRVN; Tue, 14 Mar 2023 16:16:06 +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 4PbdtZ394Hz4HTZ; Tue, 14 Mar 2023 16:16:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678810566; 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=MmmzsjHw0u+sqSBttloTH+dHjcMoObKbi55LTsK3CsQ=; b=m6r27sAq0lMfOdap7zJYq7gfbTeZT6FzrezE+pwZGie5LVEVm1njOYng/+Iv4fqQVcDBDb tYXOjxFShVp2hsRuQRDA8Cyqgy243j8ZJiWWmMy382nW9VD0d+dOlu0qadAM/rzlljAbAm yitMYstd+S3beQon9ZCS8JNJ+4FsGopVqWhIaTOjCo9UaZUkrLz0F7dIToGics/5JHRVIl twkl8Okz+AFY2O55t31Cd2NO5ipWonj++MmknUPUe6p5JwoiKJmmW756ZqA7q8yRytRRh3 n10upafh1wecPqDAX0VtEkrrOEA/50K6OCTKHJVFWfP9qIAkXO2Zow8k8m34GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678810566; 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=MmmzsjHw0u+sqSBttloTH+dHjcMoObKbi55LTsK3CsQ=; b=iCiT9I1FCUys31bU1ZehhtYwlkuMxLvDQxfJFMsmdl9x4iml6luMKx/fiTrNcSZLSoI0SP 2ATuKMIIa3vf/MuA/9Z0qfWj+iGS5D88jnTkGYJR8Pv4/+jse8Vn8UQJYNR6t/eZvf1Jwk 30AZIMgBqKsHZ4yvEw4PtPgDHw1CwzOap/xEEPJ9WJjJDaPWSIhkuKwyiEOv62eurLe5s5 WEwUvheyTpamA1eia54pR7NJ+4BCv6sLmtnH9ZKuXIkDfqQbqDQg9+sxdh3oxvKFYPVj2W pts4N9F85qvSu6U7KGcQxJNLGCGMcRobU4zihr8/m19LpYPFv/K6Hv+8sjCbvA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678810566; a=rsa-sha256; cv=none; b=pMDp3bEV2rZlLXoOosv2/iI8t8WjmcDwsGMkZ/wPWrbwc+GJ78iKnrYrwY+5Yx6AZ+R+Cw QYpS7uij44i5mcbvSsCn0DFlTh9O1bDQssrE3IXDpAzyZUnNKkdwzxqaPu52iquhirY8Cv BsLR7fi0s2dVCof3kwhkUeyqSFU8bGTnWkvvJH0LL8uOKHZSDVdctY9casZ7pupwMjD42W T1Wt49yYYum38t+XMsmTV8GN73AjK7D5bng5gzmoQA7pGatx9UZVlG+hrX+1+BEA1kiA2E /mGlr88Wx3UaXpRWOJiMCbKHMFEkFQbHMrzD+XFH7rbFGShS7wjqeP8KFj6tkA== 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 4PbdtZ26bqzj0j; Tue, 14 Mar 2023 16:16:06 +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 32EGG6pR040275; Tue, 14 Mar 2023 16:16:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32EGG6MQ040274; Tue, 14 Mar 2023 16:16:06 GMT (envelope-from git) Date: Tue, 14 Mar 2023 16:16:06 GMT Message-Id: <202303141616.32EGG6MQ040274@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: aa1e6a4f4c28 - stable/13 - makefs: make msdos creation go fast List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: aa1e6a4f4c28c7051ee9431ecb7802309cc1bf96 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=aa1e6a4f4c28c7051ee9431ecb7802309cc1bf96 commit aa1e6a4f4c28c7051ee9431ecb7802309cc1bf96 Author: Warner Losh AuthorDate: 2023-03-13 20:28:51 +0000 Commit: Warner Losh CommitDate: 2023-03-14 15:47:46 +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 (cherry picked from commit 370e009188ba90c3290b1479aa06ec98b66e140a) --- 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; }