From patchwork Wed Sep 4 14:17:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 13790930 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 3EF01CA0ED3 for ; Wed, 4 Sep 2024 14:17:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 957F36B0134; Wed, 4 Sep 2024 10:17:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 906578D0253; Wed, 4 Sep 2024 10:17:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7A7BA6B013B; Wed, 4 Sep 2024 10:17:46 -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 5A63C6B0134 for ; Wed, 4 Sep 2024 10:17:46 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id F25ACAAA91 for ; Wed, 4 Sep 2024 14:17:45 +0000 (UTC) X-FDA: 82527259290.24.C1DDE10 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by imf30.hostedemail.com (Postfix) with ESMTP id 30F3480024 for ; Wed, 4 Sep 2024 14:17:43 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=PiH+FpeU; spf=pass (imf30.hostedemail.com: domain of asml.silence@gmail.com designates 209.85.221.50 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=1725459367; 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=HY15Bjqq4aKur+xvKj1EtQb6SIbOC5ont+cHg4lEL9w=; b=xeS7dddpsRt46t2PFVijgagYFZcgfbsKKhIJzP84M66tpgUpXFx8CrP7mLWBKxmAtUNnZ4 kbubR0zalhretdR8vSjXgHqChMIIL0Q3UOfu30q5que1XaSxnF1s1NS3qTin/GprzpLa8K 20a7inSN2hfxakCgm2jgoBjgpNP4nY0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725459367; a=rsa-sha256; cv=none; b=hpCmlbFFsf7CBNaoELZtkg8jcTEXUPd15+mDmtPY7AGEuattBFO4KOhtXRL09N/kxYdXEu Demb8muJ3T5CVdCizPMz9cTmdbHO2vspkZDPBvo73AMyy9qtsBgaxJF4hYVfKrOjj0b63f UvBG/xJ01mbDXC8TIf2eKidu5HSxJ4Q= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=PiH+FpeU; spf=pass (imf30.hostedemail.com: domain of asml.silence@gmail.com designates 209.85.221.50 as permitted sender) smtp.mailfrom=asml.silence@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-374c84dcc64so2474794f8f.1 for ; Wed, 04 Sep 2024 07:17:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725459463; x=1726064263; 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=HY15Bjqq4aKur+xvKj1EtQb6SIbOC5ont+cHg4lEL9w=; b=PiH+FpeU3vpJ9lfhPJuAK/hIXYYwotadAPFTdviULZ+9rg7jHRQDdKb+CMBG/AcuM3 ipjl52d9Y3D0bJAq36oW7ZoKjeBTTs1SVI+zckFIlZts8wvn1helEg1rIXPGGc1DlYaK 6n85a2GFYhXEoN4xKBfTmvrq+FRBWsIWMz1d4XraehTAh4OtE/0iCaS+RDrwKu84BUr6 PrhA4StlS6+5SVPPH3fXtt1DqWpDMbPvLKRMh5EfpN6vgCCYK6g/F+efYaqQoAt3BwyS Z6/Be8C9PykSYlKLnmnW0Sw4VYCCP5GS7zh24OoVVvKISZFiCfJxA0JHpCIEy/UO7NNv m1bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725459463; x=1726064263; 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=HY15Bjqq4aKur+xvKj1EtQb6SIbOC5ont+cHg4lEL9w=; b=SiCLpBYt2yS9G2hzI9VjlGJH775c82bif15NETAbjb5TjcysiidmAv2wBRqLSWMVpB UrgJmHfgEboXEBAge7F8bof2Y/oe8dV9Zoi06+JJ+Wkh19LfRBaaNrGpM0JMt9Tzqx5y Xg9+3XM0uxa6w+BCRyslKa0OW8prCRGqELFi1fNIwDyj2iN2W4LWv3yXvxW/uW1+xtsK o3Xe7wDsXD0R2f62aiKqSETkMZ/o6oVmmf0Ndm5UQgvP6wtWkJmsWFLxWEhBZGrdyhWq 8+ZiNrHnjiANlqztY9ftCMQMdFpd0Y894T6KkRAKz811pzdwMz0E10XCJkWZdNdUdeq1 HIdQ== X-Forwarded-Encrypted: i=1; AJvYcCWgZeWxjqnbyXMoFVxC8bVzsR9WIQYNIeNPNgHiD/aIFgl4lbA64pbW8dtqVjYi0wJayCxhFb0DEw==@kvack.org X-Gm-Message-State: AOJu0YxeorHFXv/+qLd6kMlcZ7ZW23WlfhvfX2jLCBWePkxz50PSNO09 UwLpv8f7uzDPQrU+3iSufOtm33jlviBpS1znNorD2jTqsSZvP6Y1 X-Google-Smtp-Source: AGHT+IEwWK5Yj7vtJLC5Y418j0w9AbR/IgvD3JjLJ/GmnxmpSoNSgA7dlM+QCEdgLBruNVWlP7g0kA== X-Received: by 2002:adf:f608:0:b0:374:c05f:2313 with SMTP id ffacd0b85a97d-374c05f2775mr10514389f8f.45.1725459461605; Wed, 04 Sep 2024 07:17:41 -0700 (PDT) Received: from 127.0.0.1localhost ([163.114.131.193]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8989196c88sm811160766b.102.2024.09.04.07.17.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 07:17:40 -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, Christoph Hellwig Subject: [PATCH v3 0/8] implement async block discards and other ops via io_uring Date: Wed, 4 Sep 2024 15:17:59 +0100 Message-ID: X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Stat-Signature: ikm3jp65j3osdimqdqqh5jsatcdox9fa X-Rspamd-Queue-Id: 30F3480024 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1725459463-219567 X-HE-Meta: U2FsdGVkX1+GeWPGRiHilU5pMxgTgNXkNBHAp6AT2ZGhwWVJAIl7fSIdoXNTTgnYdr8389+CTOjO80Q6wx51dpLa7Y3jNOnU1S6BG/LsnFGoPKJbQAx7UGfzB56LZBhBxZGWutJmR1PkB9jqaaEuTOYYMpg0UFl2KXyVFPDFLh5zHstHWgjb1lYmGQVDZWuEad+WMRgAx/DWtB00gY6VqY5+gPTxt6ye3a+sPzFh2iCSQTmK3mj/yWNsznS+2wNrgJr2sAXBR1JQHr1E9GwcZwVqlj1dJdnVBsLza57yZNSBbBfdj+wn//kTOL8VKKguHki+FbUo8TpfujMnt8N4k5CNjSdl7+qyqRfigVH2X/us5Q6V9jPpgW8vC0dJLGSE2J03pxUhWmAEco2TUH7U6hoiStagiOjl0uV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ogofilter, spamicity=0.000000, 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 and write zeroes. The series implements that as io_uring commands, which is an io_uring request type allowing to implement custom file specific operations. First 4 are preparation patches. Patch 5 introduces the main chunk of cmd infrastructure and discard commands. Patches 6-8 implement write zeroes variants. Branch with tests and docs: https://github.com/isilence/liburing.git discard-cmd The man page specifically (need to shuffle it to some cmd section): https://github.com/isilence/liburing/commit/a6fa2bc2400bf7fcb80496e322b5db4c8b3191f0 v3: use GFP_NOWAIT for non-blocking allocation fail oversized nowait discards in advance drop secure erase and add zero page writes renamed function name + other cosmetic changes use IOC / ioctl encoding for cmd opcodes v2: move out of CONFIG_COMPAT add write zeroes & secure erase drop a note about interaction with page cache Pavel Begunkov (8): 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_byte_range() block: implement async discard as io_uring cmd block: implement async write zeroes command block: add nowait flag for __blkdev_issue_zero_pages block: implement async write zero pages command block/blk-lib.c | 25 +++- block/blk.h | 1 + block/fops.c | 2 + block/ioctl.c | 228 ++++++++++++++++++++++++++++++++--- include/linux/bio.h | 6 + include/linux/blkdev.h | 1 + include/linux/io_uring/cmd.h | 15 +++ include/linux/pagemap.h | 2 + include/uapi/linux/fs.h | 4 + io_uring/io_uring.c | 11 ++ io_uring/io_uring.h | 1 + io_uring/uring_cmd.c | 7 ++ mm/filemap.c | 17 ++- 13 files changed, 292 insertions(+), 28 deletions(-)