From patchwork Fri Sep 6 22:57:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 13794830 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 170B1E6FE49 for ; Fri, 6 Sep 2024 22:56:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 960086B0085; Fri, 6 Sep 2024 18:56:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 910D36B0088; Fri, 6 Sep 2024 18:56:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7FE936B0089; Fri, 6 Sep 2024 18:56:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 614896B0085 for ; Fri, 6 Sep 2024 18:56:58 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 14EF41C5E32 for ; Fri, 6 Sep 2024 22:56:58 +0000 (UTC) X-FDA: 82535825316.04.0FFDF7D Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) by imf25.hostedemail.com (Postfix) with ESMTP id 4AA01A000B for ; Fri, 6 Sep 2024 22:56:56 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=LGnwcgW+; spf=pass (imf25.hostedemail.com: domain of asml.silence@gmail.com designates 209.85.218.52 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=1725663318; 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=nGTHGb53DvEPF010k3Zs0+1r6sTv45lepnS24XVNVEo=; b=h2IdZUe9Fv53cp9quWk0C5hAUoaqwitBE8yIByIaP59iYDgxGzQwWC6YOlWnrwMKOEO24S rSijvu2wRYEmAPNpjv64CpBRmmfCgc1FB9P+pn7dokrrg8fPe58CFYqTU1dsxNLs8sY/oQ HA++X1/DrUZnTHlT5n1Zr/slpmiP1MA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725663318; a=rsa-sha256; cv=none; b=5YuP+iTY/w7hGOdKvippInbanz0DtWlvymb0YtrbzClqYYbzbHAZgijlNNaI1CxmreV1Kn 7QUkXGwm7gWp1fJM9NncUe+/h+dr6N/piupDnFiA7A+0zqryAG4WDFdbi9OfJuxBoj5L8a iulAFSR4wRyqrdWh8rhFE6NwRvptqLo= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=LGnwcgW+; spf=pass (imf25.hostedemail.com: domain of asml.silence@gmail.com designates 209.85.218.52 as permitted sender) smtp.mailfrom=asml.silence@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a83597ce5beso411726966b.1 for ; Fri, 06 Sep 2024 15:56:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725663415; x=1726268215; 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=nGTHGb53DvEPF010k3Zs0+1r6sTv45lepnS24XVNVEo=; b=LGnwcgW+dT4obsJF6LKkD3MGs1w/osdHd0npOyb1NC7tZX30umDOGliSLKFaEJYDCr 0qAMHOHmFB7nMdquxPUnEmrA9/nKfl7tE8eK7GmYM7qAO3Rhf+cec8W7IB2sDm1MkjzH HWzGxCLsT0ZIPSrX9jQW0UybML8obLaV0L8vUSwa7pxzZ5nKulGBIiIgaIPLYTExiObp FA8poEUwAgZhIXTuVbWDtoqK8umWictSJwjQKxgfbx7eooJV+o5DLPKphubwB6cdHEnx UeKujP8ZKjP49LxFAf88YkvILMyqv/3//gsqpmwcXLARgRgEPSYxoE9JheJAhQq1vSJJ 7O2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725663415; x=1726268215; 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=nGTHGb53DvEPF010k3Zs0+1r6sTv45lepnS24XVNVEo=; b=spM0i6OJ8EjjvRuz9Xj0YXx03XkpfBQLL9vIF5HDaCaS84p5EQ76k75vIOQfdzbX5U urBFg9w1cnVKsdpf3hkJJT30lhWoJvmZtsVaqz46fGbY0Ru6+bLBMfrzt9EDpCQ+vMMt BzkXZyJsAqkBF3rc4ebx0y21HFtYQAaQYlnUqfogAKiC4Ias/IPdiw0OXmETfBc4h8jf zu7vu1dR/JWiwWHc2Kkcd3XsUCv0IdHaLg7duQdeeT3Ij3Le15cVbvo9Gx9PC3D8y+xK F7lJc9csfz4eG/qxlUBkFuz3WFb2CzTImwIy8M9yBA/7A+cx4fpr2JhTW+A+h+UF6OJm +cog== X-Forwarded-Encrypted: i=1; AJvYcCX0EWePi+SS23zJwc9Cownq8ixX3zumM9gIg2mnZiW2NrYZNnyEGSSjwvY4zjVipl0Pa3hfFJlDZQ==@kvack.org X-Gm-Message-State: AOJu0YxDT6dyswciWgLWYPCLtVjGqtRFbeZcSNkGZf5C0+ECO/YDcImA DbTplL2P/IpCWAcEalqy07C8xv43XXqzmOohbVXcSdySLaD4iUIG X-Google-Smtp-Source: AGHT+IHuJBTmNgLXekzqo/kN3wYBE9A78U+mlsI5nzmIR5b6yYLak0xoaHmWgdXR81I+7iIxWWK4gw== X-Received: by 2002:a17:907:3da4:b0:a80:c0ed:2145 with SMTP id a640c23a62f3a-a8a85f2ee3dmr431894766b.2.1725663414129; Fri, 06 Sep 2024 15:56:54 -0700 (PDT) Received: from 127.0.0.1localhost ([148.252.146.236]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25d54978sm2679566b.199.2024.09.06.15.56.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 15:56:53 -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 v4 0/8] implement async block discards and other ops via io_uring Date: Fri, 6 Sep 2024 23:57:17 +0100 Message-ID: X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Rspamd-Queue-Id: 4AA01A000B X-Stat-Signature: npruxg3rsby38u7ccxdwma5daph8zxbz X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1725663416-925895 X-HE-Meta: U2FsdGVkX1/S8TfzDZPCUunI5c0HPjvrpyycp0efQlUL24FhwmKq/Wem6Ee7vewWNb4Y5a4NPIjlgXJYQygQhefT7rN02cBVSCvrNHu8RSX/AuhOETH+bLEVKOQ/H2pca+EUJyxJhhSYCJQYyycOHm+CIhVnvZC2I+clIAl4UHclR3vzGnD/dQ05dupjPPhim/BVnISXIClr5ZcHKS+Zos/+g2ALE6tuBPCJOENELoGgoGsUpbAIN26KUZ93551aUuHe0u24O3q1I02kxNiNyccmRqPTMUgG5IICZ/TCSiMlSiaWmoc/uvLM9HQmSE3NuOZYUbMWbTTEWlneBjvUc1vT4jBHon5+AhJ1Z3RjdQbOdgakgob0HrWibbCnutP1VaP79Ro28mtUCqWuoGxfewfmIKIy6AP5eg9i3vEUGma5TKpBrDM9Z7pzGL1t/+YgnauJPrSOMTb9aEToZknUdiNfcHldF6S1uuZDJk7I7Zbf0AangmKOnzzRtlKqsP4hkYvG3hGHvE8KjTj4+NK639F51HpwXUPXXYaPNuKlxpFQNTZySlUFVw23kYdZI9IIat/CQVjuaZLRZ93tK83SVdVk2vStH7/3QWWVEHDmnhYKJOJh+iJNeU9ESbb+K2/VtcTvmpD4i1ebAhbljtvqi6DJuxFf4gdkm3iNR8h41EE8SrmdZSAiletosX2JIUuLBpoqAVwIqKFlti/syhbDqU9ufGvmyIVl5dljykFuVKo8y2Yf8ToFNX9d4WbcvVxd7LWf+q15CLy9FMRU8/hVeoKK+3M0gQc68lhaoQuOh39fpg2uoan9iEFoGTmxlqwBwOiUj78vCcGHkbBppYIevlluuNL9y04kS/xV/Z0JNGg18S2az0GGoU5c2G2splxKO+w6LWpk8iU4KJ0/df3Zn09lt83mw2sH1fNt7BT28sBI8frysR0aB64KTRbHtyPixeQdyCWuDzqhZyqWUIx emtqjT5X T1wugH+dQiDKx6iD5S1pUTwUUjxKzOywrHSQny9H5k6T60Sr3zIvL1GVKNCtJgIuQvtVRlUuxeszil2j2kMetoIhIIno/jhe7tm3un/6xiFAEl+T4us/L+zp2XEg5bbXuA4EtA0Ms4k/O+EEEKMXhMFmBlLGN7X79Awsc8kJdn15Pb2fAzc80vMXR3JIUXLtiqinsAiNeboDV6puYa1/q9yJyJxGkivWVkdza9JRZsEvoRbpWdFPi/msNL+796++MmEb7TInGHU6LBwfimrzASl3ZDVB5OZcqPPeDwkeZChIrlfBnvzy6XCUP7kKQQGeWg5g9sh+Rz3yDVJEz/vkG4yTOcqSaeYKZyr7SqduIFh+cqbAJ2e42cv98VjoipIZTmVHST1/GDJ6HoMh8c46fu1rX5M9IpMvhaRdLk5hox2kx/gudkAI6DwQK60kGGrHAo8hr8x/S65jlOv3mx77UGWxt4WPVzsryQO2pGVVtRMf50eUXNkN7tQVpOg== X-Bogosity: Ham, tests=bogofilter, 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 v4: fix failing to pass nowait (unused opf) in patch 7 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 | 27 ++++- 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, 293 insertions(+), 29 deletions(-)