From patchwork Wed Aug 14 10:45:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 13763314 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D357C52D7B for ; Wed, 14 Aug 2024 10:45:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A71AF6B0082; Wed, 14 Aug 2024 06:45:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A1F186B0083; Wed, 14 Aug 2024 06:45:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E73F6B0085; Wed, 14 Aug 2024 06:45:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 723D36B0082 for ; Wed, 14 Aug 2024 06:45:25 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id DBD7840E8A for ; Wed, 14 Aug 2024 10:45:24 +0000 (UTC) X-FDA: 82450519368.13.0DF1074 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by imf19.hostedemail.com (Postfix) with ESMTP id 11F061A0011 for ; Wed, 14 Aug 2024 10:45:22 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ilBj+qdA; spf=pass (imf19.hostedemail.com: domain of asml.silence@gmail.com designates 209.85.218.41 as permitted sender) smtp.mailfrom=asml.silence@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723632252; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=qM/+H+q/dNtHslpBIUYQjOqvFIMBvCtYMIlLtex0MfE=; b=Vbmch9rpgDMoBUMl+kmnoNbIXqcfkJGGOBhwrxJb/lbATw0gheGrFINHP5rS4L/z1MCelu CvLTJa1gbAemkt2mHS5WJ03x/UdYSewtt1NgCzjFmmC/bZxKQkaMIO7jInpEhOmDicwvHh RVeqw6Sho9LcWdXSkAuKInD8P0Bs424= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723632252; a=rsa-sha256; cv=none; b=YLynTO0PBkaKuIH9Yh6VYVcGWnTMIAqNqYPUvm4JNiWD8Ui7ziST9dnfI/PssFZthZ9qRZ gdsuiSFNqBt7eK08xPKxqM8bgPuLe4iFjrrXhHBu7msaAwfVUpvRr30LytiwNloUzE1hA1 RezcqqkIKVfPpEpsmKOhybinQei4K3E= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ilBj+qdA; spf=pass (imf19.hostedemail.com: domain of asml.silence@gmail.com designates 209.85.218.41 as permitted sender) smtp.mailfrom=asml.silence@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a7abe5aa9d5so740303066b.1 for ; Wed, 14 Aug 2024 03:45:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723632321; x=1724237121; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=qM/+H+q/dNtHslpBIUYQjOqvFIMBvCtYMIlLtex0MfE=; b=ilBj+qdAgAVXeDTk45B6Xcy54hnOi3/2ibNpE2qM8bPM8wYaOCgfCn835VtK73joVo +nwfT8Rr8VdYxdutHvNKE99paw4iDm6GJEpQ1dBLvnjZuK4vRRMjkt5q08QmdQHHafNj IfbTr0wkhFbfsERUMbBtw6SV+7ZVMVLrnupZbKZHteTbpBFWj5rbraBlqBIWJQS3x1Jp DykcPgxZCRPqbJso12yf+rxJPwN5QZQJT0lis0MBxm6ffLDfx+13zEeZDTxObNcFK1QE VaydEwrXqFJKZY6e+WWfCecCTZCSrHz0jK+EqsC5hrK73WD99ilehC6TR+hcmO/VT54J C5cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723632321; x=1724237121; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qM/+H+q/dNtHslpBIUYQjOqvFIMBvCtYMIlLtex0MfE=; b=OK1Iw8FyHAdvU+JKZrDLHGoiaySSYNOLzZM6ybgVahnKWxI0Cp2Kt9LPmQ/zP5PWDX TxXrOPTAdr3OaDRd++tQWXfNfHlkrQbWu3625qpDtMgVfI/XbyzPGB+f9yNeOSmeJzBy Yg63IlEmWLfldilmFlYcTx/bkF0BdQalMmVemwljevvMklsHxczbGZ+GajJS7HG5V6vZ 0FpBCeL2wQXtnJcTwfDeF5j6hpKMEWzxqItI81nu/UPQmTUgRgtQ+DqL2JuutJyZJZwq 5lNjUgwNY0OyPrmDUBGHHAFdLBA3urRRF+xLJCmWOhgWCPSNuFJbPb3hvpC93J5cjaee iaiQ== X-Forwarded-Encrypted: i=1; AJvYcCXPxRUlCtmGzUlizoVRANnZA3MhQkB+4AOWPd3stu45/UY5s+FIqm5qNWXhUqIJ0TiFv/JNxdrUcbigBmyAAf48Kp8= X-Gm-Message-State: AOJu0YyuYX06fPv/EOhLSZpAUv7EWt8XT9tmsTMMt6ibPFG9hxgu94ac 0APWNWD/auJrZKQwndTwr6EKwoax6WaOzgRokPzlaFT7lBt4JdZ3 X-Google-Smtp-Source: AGHT+IHdFQH/XhI3MmWWusGKBBhP3P128eD6d5du59qhURe8iVDeuvNJeHFRQkMLrrS+UEfann4zlA== X-Received: by 2002:a17:907:e6cb:b0:a7a:83f8:cfd5 with SMTP id a640c23a62f3a-a8366c31b00mr153852066b.18.1723632321090; Wed, 14 Aug 2024 03:45:21 -0700 (PDT) Received: from 127.0.0.1localhost ([148.252.132.251]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a80f418692asm157212766b.224.2024.08.14.03.45.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 03:45:20 -0700 (PDT) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: Jens Axboe , asml.silence@gmail.com, Conrad Meyer , linux-block@vger.kernel.org, linux-mm@kvack.org Subject: [RFC 0/5] implement asynchronous BLKDISCARD via io_uring Date: Wed, 14 Aug 2024 11:45:49 +0100 Message-ID: X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Rspamd-Queue-Id: 11F061A0011 X-Stat-Signature: ceg9fwi4qkmgxsg5398d1y64p8qzimxb X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1723632322-303723 X-HE-Meta: U2FsdGVkX19cM3WmDNmd32mtNuC6RYjDnPb6cYHU+iasa4MlIkYhBhmcJItOv3Y4FSFp/tZmYk9gsECUiezyvNHt+j1B86b0HYoUJGhHjY5n5AEtjZNWcRv8Waz7b+rbHfnCAq47bjUIu74VU2OlHst+2NLtqbRPirJ234aSzcJ8ENmkhdnkooJIRe+Hw5VZ0gwlZP7/4xrdqGU3QbvO4I8RNzyE4fYKNKuHv5d6fHDxPxDcyAhLtQRSy49erG6n4kK/ijYeVV76BDCLGwSHJu3fLVbkiFMPu97dZE3v9WUCFw87O4hx34NC6FsO2vfDKHjNLLPFXGhTbdvgs9jfluHQJnlnpHQLDHWglRMH3as4fOq/4j3c53QlkwfQPWv8wWWBBG27AR6/b7+dPj2WNJimR83LXMSRa6M9wQZC4Cy/rQK5qTim2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0.003553, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: There is an interest in having asynchronous block operations like discard. The patch set implements that as io_uring commands, which is an io_uring request type allowing to implement custom file specific operations. First 4 patches are simple preps, and the main part is in Patch 5. Not tested with a real drive yet, hence sending as an RFC. I'm also going to add BLKDISCARDZEROES and BLKSECDISCARD, which should reuse structures and helpers from Patch 5. liburing tests for reference: https://github.com/isilence/liburing.git discard-cmd-test Pavel Begunkov (5): io_uring/cmd: expose iowq to cmds io_uring/cmd: give inline space in request to cmds filemap: introduce filemap_invalidate_pages block: introduce blk_validate_discard() block: implement io_uring discard cmd block/blk.h | 1 + block/fops.c | 2 + block/ioctl.c | 139 ++++++++++++++++++++++++++++++----- include/linux/io_uring/cmd.h | 15 ++++ include/linux/pagemap.h | 2 + include/uapi/linux/fs.h | 2 + io_uring/io_uring.c | 11 +++ io_uring/io_uring.h | 1 + io_uring/uring_cmd.c | 7 ++ mm/filemap.c | 18 +++-- 10 files changed, 176 insertions(+), 22 deletions(-)