From nobody Mon Mar 13 20:39:52 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 4Pb7nN4txxz3y9jl; Mon, 13 Mar 2023 20:39:52 +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 4Pb7nN48K1z3CR8; Mon, 13 Mar 2023 20:39:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678739992; 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=IfsRD/4ZvNXas7h5ShHiP2YYfSTwOg57ExBbQU6c96U=; b=QYDHQEo2DSY8BBNWt3FkEzFzcikA0U52gLpGNHhooUXLbizMrpBE6+of99DRkEeN0tgvA6 hJJ6hEf2dQpxkCUDIVDhlg1JQxVL1RfD9hbS5k0OKC0ZByO1bigz8ktzm05Ou9cufh8L7U j/aNuOESlRVzTs93t0cAfl6jQ0nsb59GDe6hIaf4So61INh9R6HmeF3eAnvOwr/jzOcZXM dzgpLXtSkJbk7GEjejfDsLk9hluQs5PNeZIiiN4ix+jqezVxwrAbA9ZnQe9oxfDjRW6Lp+ b7V3k4Q3oW7n/mc6GyXkM9AKTBYWiwPZ7lttpEM1HlCaIoTGEqwWUpNVetKV/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678739992; 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=IfsRD/4ZvNXas7h5ShHiP2YYfSTwOg57ExBbQU6c96U=; b=q/MOhP1nXNesPyGBGIDgz59jcSZNq/1T+LnRD+z0+/FotmWVzCMz6MGgiZ1lykRMQcs8Ke VSp8NKf5olzXVkPCbsKq9TjKZhrt8lXyoncF4rQOiw+T8jIQe6nYUG7QqTNEtEVmI+k++w GBkaVhmhDLVU3zY17tKpnfL9rqacEb64syupYM0nhtDXnamWbzbjbHKYVlx9J2tlzQDkCt 4OflKg/LB2EFh5r2us16s4NYX5o8FzpTJjrM8GPOVPDU6it1fAwnLsO2DqOFXS9Oc2ZxhP ba1PKMKjCOuWOQJv5B5TKfYK42AD/QC00ztY3UcGDdgN/0ISABqyB2CIl+UWmw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678739992; a=rsa-sha256; cv=none; b=EpPTkAinOXdjgpG39ctgHWMI6z+qcalUn1en32OsMn0FHkEEAIyZ196RhGHmtHS5SQ5+AT lk9IDvbx3x8wYXP1Ct80JAw55TM3RM9rFmfSRq9UypxfoKS/u3dCCrJQeyI9B4puG9JqC5 +u0DXhuQ8GwmysFWDzFgIROCfKPwJx7GFOrM9E8kVmSp6QyRfch6hDOEMuDlFLYAHZ1S2K ubpEnBSk29LZF9WacV5d8uAQqDebwJSwPWjBN0RYd1hVOltXKp4uQBfyjT0e8J6nViuXSx TZ7J8faBlfUV5sKlkHa5wqeC4J9EBBOo+JSuu3amjpcv1z0zkm+GbpT3xIZ7Jg== 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 4Pb7nN32jCz173s; Mon, 13 Mar 2023 20:39:52 +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 32DKdqSZ001898; Mon, 13 Mar 2023 20:39:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32DKdqru001897; Mon, 13 Mar 2023 20:39:52 GMT (envelope-from git) Date: Mon, 13 Mar 2023 20:39:52 GMT Message-Id: <202303132039.32DKdqru001897@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 370e009188ba - main - 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/main X-Git-Reftype: branch X-Git-Commit: 370e009188ba90c3290b1479aa06ec98b66e140a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=370e009188ba90c3290b1479aa06ec98b66e140a commit 370e009188ba90c3290b1479aa06ec98b66e140a Author: Warner Losh AuthorDate: 2023-03-13 20:28:51 +0000 Commit: Warner Losh CommitDate: 2023-03-13 20:38:36 +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 --- 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 5bc9b495c586..c04ed6f742a1 100644 --- a/usr.sbin/makefs/msdos/msdosfs_vnops.c +++ b/usr.sbin/makefs/msdos/msdosfs_vnops.c @@ -500,6 +500,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; }