Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4652391pxj; Tue, 22 Jun 2021 05:13:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+6ptkT0adZIbBFwCDjmHm3y7fqPwaaBtSJR1eBEiqwzpcLfwLcDFYtQ96d84296W83ahL X-Received: by 2002:a6b:310b:: with SMTP id j11mr2550683ioa.151.1624364029941; Tue, 22 Jun 2021 05:13:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624364029; cv=none; d=google.com; s=arc-20160816; b=hwYJuLaOmHNaEsgfa4yXHlPmIT99QB6Iy9EjscyTOYxoTpveSP2PmuTaGLpPy33Rjb AASrB5Svt5VAXl8gpAFnxOBLz1Z1YEDETJXk789PqpFC25TnOl5YTZb+fdvNB6nzoGyY MCL5dn0ebIL2g3Ez7hhnCaDdg3dXRJcZxg7WHRp260fWE52WZSzzP1JBG+LKSMWbDsQ+ YXZeYOQMrCH0mw5wPHBxiNIN1eEtJ3CzFQMsnIvqxb3ilLJPxCjXhFbaWZv7UTUvEI8c aADKJUYOpcWqMmSmvs6NZ9HqGlX9VobLeqbhknEXqp08D/Q0jUTCU9Wb5X3hLygNV8l4 dQDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from; bh=Ge0EhfnkgIE0GqI9fpoWcW5MaMMr6aQYGe5ClVD/Zdk=; b=fwDOSxN675Q3Q6s3KEgmAHJjoO5UD/4nfYBT9JtGlYLcMJ6VU2Z3G4GV9530yR4tGG T8nCGi4UAT0ErPfFgqgiK9gzTho+pYX02xzs8PSalUPd0OjNGDIwER8eu1XssHpVBP3s PxFcDkqBiACy8EJ0CtqWWe3lElmEHxvw6VnNWZKAwouRVattjeuS7Vhtx0tOxqa+J8/4 xxClY2E+kEmqARktrbeg0wAwQ/JCuAaN1jlM+c2pQdHszSPgWK9qQp3NBz6u52s8gE/F yDGFx0RQjypAXM8W/eFLSg6z6bKwpcIVcaSFIxZ028bQ5+uxZA4ETaYWZ4TzJYwHmoRi voaw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g2si13542411ila.16.2021.06.22.05.13.37; Tue, 22 Jun 2021 05:13:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231349AbhFVMOB (ORCPT + 99 others); Tue, 22 Jun 2021 08:14:01 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:34437 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231243AbhFVMOB (ORCPT ); Tue, 22 Jun 2021 08:14:01 -0400 Received: from orion.localdomain ([95.117.21.172]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mn1iT-1lWXV33A6Z-00kBxJ; Tue, 22 Jun 2021 14:11:42 +0200 From: "Enrico Weigelt, metux IT consult" To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk Subject: RFC: generic file operation for fstrim ioctl() Date: Tue, 22 Jun 2021 14:11:30 +0200 Message-Id: <20210622121136.4394-1-info@metux.net> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:W2BeeFr7U+wjER9qNqOeODEQlcctBdEdMmZlsDZ4KHdnHjwBMCv ZOTZYZbE3r9/l/PhVbAKwTSRPQNLdLiE3sOk7/yk7zNLUgK+t48gKNFnxIyErDqMWaXVzta DjnGi8eUFoQiy21OMx1Ady5sV6lv1kWrWOtQTfxoBaIPomv8mmfNjNp22/IQT2Q+uxAbC5O UP6lVCcHNAxEUMRbXzBcw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:ukJISyO1zCM=:T2VKI7c5AKGGuoRFQyH0R5 xLBlJBRn4SE+RcmVpNmVr8XBkFwk2xvl4iFOc2cS83dJz18+rutnacCflJEV7OkzE7ymCr3HQ UZNDLwtVNxE/+u4t5LTeI0pt/JuucZ+mDVmCLd7MTteM8oxPnY5HHHsxlxVUWY2aSNLOIr0Ak puwJq2Va+Imke3Q0iHg4Gnb5qJfWuUFmSf70r71ZHqyz4bp39R43GkvFqWbTAI2jDaA2vKTDK 07Q5l0jQ2hv2AmXvWCsTlUbycKxmEAR+P3daEIrAP4VZx3jBRMsfbvJvXufXJUuuDAvMpgMrw 4Kn5kxqzuqDwj0hBjrbcUzYb4Ib9hrTjMC/SahrmI6eOt9Ylr3WVK8NepZlCrVKiM1abzMelU eKr1DUJTnHAkVRfdt/Qtf+Ax+xKXilA4L6+BfOMm35j/Ce0lSa/dFi1VkNIDQFxbiwCtcSdiE H6y8MInYN9pFzJVDE059j8qp81fR+r2I2XlPHxujytQ4ddaYnA9tT2jYvFdeOlLPmpfBpkQzo sfGXg/qkvjXMN4oUHUb8Qw= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello friends, here's an RFC for a generic implementation of the FITRIM ioctl: * introduce a new file_operation call vector for fstrim * move the generic pieces (eg. cap check, copy from/to userland, etc) into a generic implementation that then calls into the fileop * passing to the old ioctl fileop when fstrim op is NULL * convert a few fs'es to the new schema Rationale: it seems that all file systems implement generic stuff like permission checks and buffer copy from/to userspace, all on their own. We already have a common place for generic ioctl() handling (do_vfs_ioctl). I feel its time for factoring this out the common fstrim pieces, too. The first patch of this series introduces a new file_operation and calls it on FITRIM (from do_vfs_ioctl) if it's set - otherwise just passes the ioctl to file_ioctl(), as it had been before. So, this only becomes active on a fs thats converted to the new file_operation. Subsequent patches do the conversion for a few file systems. Note this is just an RFC, don't apply it - there might still be bugs in there. have fun, --mtx