Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5071186pxu; Tue, 22 Dec 2020 07:43:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJxAKgAPVIHJwRICv39cmBddam2Dz0a/ZGzcgyKaceqj4n4jj/08Kf14O4d70KrmUBHy0QPs X-Received: by 2002:a05:6402:b88:: with SMTP id cf8mr21396868edb.140.1608651826598; Tue, 22 Dec 2020 07:43:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608651826; cv=none; d=google.com; s=arc-20160816; b=0ieDhOTzAw1TR7fFUFKc0W6JNgiSpwjjPpaneb3bx2UzJvY5XqZCQMdf7coqcc19lM Igcbfjnf4UeKQzVG8JpMDwH4b+ZsfGbDYgGzlFlo+H7jMfZMtIZl1Wb2ohBRU49Loc0M I0/J7hVoSSQ5Kjaxh/95JO19pHcIO19cImxdMtsqLtF+5nb1fN8dvfM6DYZICLOejO36 nBUu31SUvds+91CTDIPhHpt0oOBfoOe3auQWMELTWGyHjS+T6BMGQsxgnw1Qbvx0cRIy uo7rTfgNbdFOr3mFNagCBS6hP/OX1xqxsUGi/CWCMhhXjxBf2FXwxKNcrnn5FoujB18p eegw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature:dkim-filter; bh=g2nqEd4zB/hia2SJ/pN+xDzNDNvXoQaBzRotn2NR0KM=; b=bOJT5vBTZSObu45tfsx6sLSjDS+rkhUeEjkC5eVymk3Mnhub8NF+CCWi9yzNWRheMB AiOg3+tllIpD/7jlaiXxIO1K0EGH9FWN+LTNiqNNjivtA9RUq+TbVr/jgVyPASyJ/U06 Lo3egyBr1joMVY6bSZlkQSgKVASqDfFWEZJqQlZMzeCFefMSuK33FAmSdPzoFW8DLT/h xsraW7t8VVPZz4SS3P6vf6TJEWg8cA+Cn+iQUfrDsR6lfjVumUBf5Gqmi0rBmkUCzEpT d+GBjy2JrarYw6NQW1hcfgIEAtiVKwBrZcVPnsP9aZWbx8DSPfDgRR3NH6DTixLaUUaE CHUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=f09XEQCa; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c1si11458610edk.605.2020.12.22.07.43.19; Tue, 22 Dec 2020 07:43:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=f09XEQCa; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727310AbgLVPAr (ORCPT + 99 others); Tue, 22 Dec 2020 10:00:47 -0500 Received: from linux.microsoft.com ([13.77.154.182]:36950 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727193AbgLVPAr (ORCPT ); Tue, 22 Dec 2020 10:00:47 -0500 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by linux.microsoft.com (Postfix) with ESMTPSA id 178F320B83F2 for ; Tue, 22 Dec 2020 07:00:05 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 178F320B83F2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1608649206; bh=g2nqEd4zB/hia2SJ/pN+xDzNDNvXoQaBzRotn2NR0KM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=f09XEQCav3Dr/yGa4NwdeUYq+OHS6J8zus/uYtCNVLzW+S12LpdGorHUWZZzdk49T Q2bZo4YjoXyGEX587pO7618dYgeRF+DRiBS9F9AAuq7/GAGH3R2mESYG8EGx9GizvV SyeeFIhg7YkE588+B9wNXnhhgTvhJreybmiq/pWo= Received: by mail-pj1-f46.google.com with SMTP id m5so1471572pjv.5 for ; Tue, 22 Dec 2020 07:00:05 -0800 (PST) X-Gm-Message-State: AOAM533qOb/RdSiHUcwtjxFpyaZUf3txoUAV8ntjEWvgu4uo+dA9Aa9Z +CGx0pxynFy4rtgerVzS3VCtsZsOz97ErClU/JQ= X-Received: by 2002:a17:902:7d84:b029:db:feae:425e with SMTP id a4-20020a1709027d84b02900dbfeae425emr21488714plm.43.1608649205620; Tue, 22 Dec 2020 07:00:05 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Matteo Croce Date: Tue, 22 Dec 2020 15:59:29 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: discard and data=writeback To: "Theodore Y. Ts'o" Cc: linux-ext4@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Mon, Dec 21, 2020 at 4:04 AM Theodore Y. Ts'o wrote: > > So that implies that your experiment may not be repeatable; did you > make sure the file system was freshly reformatted before you wrote out > the files in the directory you are deleting? And was the directory > written out in exactly the same way? And did you make sure all of the > writes were flushed out to disk before you tried timing the "rm -rf" > command? And did you make sure that there weren't any other processes > running that might be issuing other file system operations (either > data or metadata heavy) that might be interfering with the "rm -rf" > operation? What kind of storage device were you using? (An SSD; a > USB thumb drive; some kind of Cloud emulated block device?) > I got another machine with a faster NVME disk. I discarded the whole drive before partitioning it, this drive is very fast in discarding blocks: # time blkdiscard -f /dev/nvme0n1p1 real 0m1.356s user 0m0.003s sys 0m0.000s Also, the drive is pretty big compared to the dataset size, so it's unlikely to be fragmented: # lsblk /dev/nvme0n1 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT nvme0n1 259:0 0 1.7T 0 disk =E2=94=94=E2=94=80nvme0n1p1 259:1 0 1.7T 0 part /media # df -h /media Filesystem Size Used Avail Use% Mounted on /dev/nvme0n1p1 1.8T 1.2G 1.7T 1% /media # du -sh /media/linux-5.10/ 1.1G /media/linux-5.10/ I'm issuing sync + sleep(10) after the extraction, so the writes should all be flushed. Also, I repeated the test three times, with very similar results: # dmesg |grep EXT4-fs [12807.847559] EXT4-fs (nvme0n1p1): mounted filesystem with ordered data mode. Opts: data=3Dordered,discard # tar xf ~/linux-5.10.tar ; sync ; sleep 10 # time rm -rf linux-5.10/ real 0m1.607s user 0m0.048s sys 0m1.559s # tar xf ~/linux-5.10.tar ; sync ; sleep 10 # time rm -rf linux-5.10/ real 0m1.634s user 0m0.080s sys 0m1.553s # tar xf ~/linux-5.10.tar ; sync ; sleep 10 # time rm -rf linux-5.10/ real 0m1.604s user 0m0.052s sys 0m1.552s # dmesg |grep EXT4-fs [13133.953978] EXT4-fs (nvme0n1p1): mounted filesystem with writeback data mode. Opts: data=3Dwriteback,discard # tar xf ~/linux-5.10.tar ; sync ; sleep 10 # time rm -rf linux-5.10/ real 1m29.443s user 0m0.073s sys 0m2.520s # tar xf ~/linux-5.10.tar ; sync ; sleep 10 # time rm -rf linux-5.10/ real 1m29.409s user 0m0.081s sys 0m2.518s # tar xf ~/linux-5.10.tar ; sync ; sleep 10 # time rm -rf linux-5.10/ real 1m19.283s user 0m0.068s sys 0m2.505s > Note that benchmarking the file system operations is *hard*. When I > worked with a graduate student working on a paper describing a > prototype of a file system enhancement to ext4 to optimize ext4 for > drive-managed SMR drives[1], the graduate student spent *way* more > time getting reliable, repeatable benchmarks than making changes to > ext4 for the prototype. (It turns out the SMR GC operations caused > variations in write speeds, which meant the writeback throughput > measurements would fluctuate wildly, which then influenced the > writeback cache ratio, which in turn massively influenced the how > aggressively the writeback threads would behave, which in turn > massively influenced the filebench and postmark numbers.) > > [1] https://www.usenix.org/conference/fast17/technical-sessions/presentat= ion/aghayev > Interesting! Cheers, --=20 per aspera ad upstream