mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergei Shtepa <sergei.shtepa@veeam.com>
To: Randy Dunlap <rdunlap@infradead.org>, <axboe@kernel.dk>,
	<hch@infradead.org>, <corbet@lwn.net>, <snitzer@kernel.org>
Cc: <viro@zeniv.linux.org.uk>, <brauner@kernel.org>,
	<willy@infradead.org>, <dlemoal@kernel.org>, <wsa@kernel.org>,
	<heikki.krogerus@linux.intel.com>, <ming.lei@redhat.com>,
	<gregkh@linuxfoundation.org>, <linux-block@vger.kernel.org>,
	<linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-fsdevel@vger.kernel.org>,
	"Bagas Sanjaya" <bagasdotme@gmail.com>
Subject: Re: [PATCH v4 01/11] documentation: Block Device Filtering Mechanism
Date: Tue, 13 Jun 2023 17:23:50 +0200	[thread overview]
Message-ID: <5f6cdc55-ddbe-ab03-92bf-02ff0318985f@veeam.com> (raw)
In-Reply-To: <004cc6b2-1941-5aed-6e09-3bd01dfbf8e4@infradead.org>

Thank you very much, Randy, for the work you've done.
Sometimes I want to compile the documentation into bytecode, fix the warnings
and debug it in the debugger.

On 6/13/23 03:52, Randy Dunlap wrote:
> Subject:
> Re: [PATCH v4 01/11] documentation: Block Device Filtering Mechanism
> From:
> Randy Dunlap <rdunlap@infradead.org>
> Date:
> 6/13/23, 03:52
> 
> To:
> Sergei Shtepa <sergei.shtepa@veeam.com>, axboe@kernel.dk, hch@infradead.org, corbet@lwn.net, snitzer@kernel.org
> CC:
> viro@zeniv.linux.org.uk, brauner@kernel.org, willy@infradead.org, dlemoal@kernel.org, wsa@kernel.org, heikki.krogerus@linux.intel.com, ming.lei@redhat.com, gregkh@linuxfoundation.org, linux-block@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Bagas Sanjaya <bagasdotme@gmail.com>
> 
> 
> Hi--
> 
> On 6/9/23 04:58, Sergei Shtepa wrote:
>> The document contains:
>> * Describes the purpose of the mechanism
>> * A little historical background on the capabilities of handling I/O
>>   units of the Linux kernel
>> * Brief description of the design
>> * Reference to interface description
>>
>> Reviewed-by: Bagas Sanjaya <bagasdotme@gmail.com>
>> Signed-off-by: Sergei Shtepa <sergei.shtepa@veeam.com>
>> ---
>>  Documentation/block/blkfilter.rst | 64 +++++++++++++++++++++++++++++++
>>  Documentation/block/index.rst     |  1 +
>>  MAINTAINERS                       |  6 +++
>>  3 files changed, 71 insertions(+)
>>  create mode 100644 Documentation/block/blkfilter.rst
>>
>> diff --git a/Documentation/block/blkfilter.rst b/Documentation/block/blkfilter.rst
>> new file mode 100644
>> index 000000000000..555625789244
>> --- /dev/null
>> +++ b/Documentation/block/blkfilter.rst
>> @@ -0,0 +1,64 @@
>> +.. SPDX-License-Identifier: GPL-2.0
>> +
>> +================================
>> +Block Device Filtering Mechanism
>> +================================
>> +
>> +The block device filtering mechanism is an API that allows to attach block
>                                                   that allows {what or who} to attach
> 
> so who/what does the attach? Is it a driver or a user or admin or something else?
> and attach them to what?
> 
>> +device filters. Block device filters allow perform additional processing
>                                         allow performing ...
> 
>> +for I/O units.
>> +
>> +Introduction
>> +============
>> +
>> +The idea of handling I/O units on block devices is not new. Back in the
>> +2.6 kernel, there was an undocumented possibility of handling I/O units
>> +by substituting the make_request_fn() function, which belonged to the
>> +request_queue structure. But none of the in-tree kernel modules used this
>> +feature, and it was eliminated in the 5.10 kernel.
>> +
>> +The block device filtering mechanism returns the ability to handle I/O units.
>> +It is possible to safely attach filter to a block device "on the fly" without
>                             attach a filter
> or
>                             attach filters
> 
>> +changing the structure of block devices stack.
>                           of the block device's stack.
> 
>> +
>> +It supports attaching one filter to one block device, because there is only
>> +one filter implementation in the kernel yet.
>> +See Documentation/block/blksnap.rst.
>> +
>> +Design
>> +======
>> +
>> +The block device filtering mechanism provides registration and unregistration
>> +for filter operations. The struct blkfilter_operations contains a pointer to
>> +the callback functions for the filter. After registering the filter operations,
>> +filter can be managed using block device ioctl BLKFILTER_ATTACH,
>    a filter
> or
>    the filter                               ioctls
> 
>> +BLKFILTER_DETACH and BLKFILTER_CTL.
>> +
>> +When the filter is attached, the callback function is called for each I/O unit
>> +for a block device, providing I/O unit filtering. Depending on the result of
>> +filtering the I/O unit, it can either be passed for subsequent processing by
>> +the block layer, or skipped.
>> +
>> +The filter can be implemented as a loadable module. In this case, the filter
>> +module cannot be unloaded while the filter is attached to at least one of the
>> +block devices.
>> +
>> +Interface description
>> +=====================
>> +
>> +The ioctl BLKFILTER_ATTACH and BLKFILTER_DETACH use structure blkfilter_name.
>        ioctls
> 
>> +It allows to attach a filter to a block device or detach it.
>    It allows a driver to attach a filter ...
> ?
> 
>> +
>> +The ioctl BLKFILTER_CTL use structure blkfilter_ctl. It allows to send a
>                                                         It allows a driver to send a
> 
>> +filter-specific command.
>> +
>> +.. kernel-doc:: include/uapi/linux/blk-filter.h
>> +
>> +To register in the system, the filter creates its own account, which contains
>> +callback functions, unique filter name and module owner. This filter account is
>> +used by the registration functions.
> I'm having a problem with this "account" thingy. Can you explain more about it?
> Is there an alternate word that might be used here?
> 
>> +
>> +.. kernel-doc:: include/linux/blk-filter.h
>> +
>> +.. kernel-doc:: block/blk-filter.c
>> +   :export:
> Thanks.
> -- ~Randy
> 

fix of the blkfilter.rst document and help in Kconfig for blksnap

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Sergei Shtepa <sergei.shtepa@veeam.com>
---
 Documentation/block/blkfilter.rst | 28 +++++++++++++++-------------
 drivers/block/blksnap/Kconfig     |  2 +-
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/Documentation/block/blkfilter.rst b/Documentation/block/blkfilter.rst
index 555625789244..b5160d1008fd 100644
--- a/Documentation/block/blkfilter.rst
+++ b/Documentation/block/blkfilter.rst
@@ -4,8 +4,8 @@
 Block Device Filtering Mechanism
 ================================
 
-The block device filtering mechanism is an API that allows to attach block
-device filters. Block device filters allow perform additional processing
+The block device filtering mechanism provides the ability to attach block
+device filters. Block device filters allow performing additional processing
 for I/O units.
 
 Introduction
@@ -18,8 +18,8 @@ request_queue structure. But none of the in-tree kernel modules used this
 feature, and it was eliminated in the 5.10 kernel.
 
 The block device filtering mechanism returns the ability to handle I/O units.
-It is possible to safely attach filter to a block device "on the fly" without
-changing the structure of block devices stack.
+It is possible to safely attach a filter to a block device "on the fly" without
+changing the structure of the block device's stack.
 
 It supports attaching one filter to one block device, because there is only
 one filter implementation in the kernel yet.
@@ -31,7 +31,7 @@ Design
 The block device filtering mechanism provides registration and unregistration
 for filter operations. The struct blkfilter_operations contains a pointer to
 the callback functions for the filter. After registering the filter operations,
-filter can be managed using block device ioctl BLKFILTER_ATTACH,
+the filter can be managed using block device ioctls BLKFILTER_ATTACH,
 BLKFILTER_DETACH and BLKFILTER_CTL.
 
 When the filter is attached, the callback function is called for each I/O unit
@@ -46,17 +46,19 @@ block devices.
 Interface description
 =====================
 
-The ioctl BLKFILTER_ATTACH and BLKFILTER_DETACH use structure blkfilter_name.
-It allows to attach a filter to a block device or detach it.
-
-The ioctl BLKFILTER_CTL use structure blkfilter_ctl. It allows to send a
-filter-specific command.
+The ioctl BLKFILTER_ATTACH allows user-space programs to attach a block device
+filter to a block device. The ioctl BLKFILTER_DETACH allows user-space programs
+to detach it. Both ioctls use structure blkfilter_name. The ioctl BLKFILTER_CTL
+allows user-space programs to send a filter-specific command. It use structure
+blkfilter_ctl.
 
 .. kernel-doc:: include/uapi/linux/blk-filter.h
 
-To register in the system, the filter creates its own account, which contains
-callback functions, unique filter name and module owner. This filter account is
-used by the registration functions.
+To register in the system, the filter uses the blkfilter_operations structure,
+which contains callback functions, unique filter name and module owner. When
+attaching a filter to a block device, the filter creates a blkfilter structure.
+The pointer to the blkfilter structure allows the filter to determine for
+which block device the callback functions are being called.
 
 .. kernel-doc:: include/linux/blk-filter.h
 
diff --git a/drivers/block/blksnap/Kconfig b/drivers/block/blksnap/Kconfig
index 14081359847b..11df0886489d 100644
--- a/drivers/block/blksnap/Kconfig
+++ b/drivers/block/blksnap/Kconfig
@@ -8,5 +8,5 @@ config BLKSNAP
 	help
 	  Allow to create snapshots and track block changes for block devices.
 	  Designed for creating backups for simple block devices. Snapshots are
-	  temporary and are released then backup is completed. Change block
+	  temporary and are released when backup is completed. Change block
 	  tracking allows to create incremental or differential backups.
-- 
2.20.1

      reply	other threads:[~2023-06-13 15:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 11:58 Sergei Shtepa
2023-06-09 11:58 ` [PATCH v4 02/11] block: " Sergei Shtepa
2023-06-13  1:51   ` Randy Dunlap
2023-06-13 12:34     ` Sergei Shtepa
2023-06-13 14:16       ` Randy Dunlap
2023-06-09 11:58 ` [PATCH v4 03/11] documentation: Block Devices Snapshots Module Sergei Shtepa
2023-06-09 11:58 ` [PATCH v4 04/11] blksnap: header file of the module interface Sergei Shtepa
2023-06-09 11:58 ` [PATCH v4 05/11] blksnap: module management interface functions Sergei Shtepa
2023-06-09 11:58 ` [PATCH v4 06/11] blksnap: handling and tracking I/O units Sergei Shtepa
2023-06-09 11:58 ` [PATCH v4 07/11] blksnap: minimum data storage unit of the original block device Sergei Shtepa
2023-06-09 11:58 ` [PATCH v4 08/11] blksnap: difference storage Sergei Shtepa
2023-06-09 11:58 ` [PATCH v4 09/11] blksnap: event queue from the " Sergei Shtepa
2023-06-09 11:58 ` [PATCH v4 10/11] blksnap: snapshot and snapshot image block device Sergei Shtepa
2023-06-09 11:58 ` [PATCH v4 11/11] blksnap: Kconfig and Makefile Sergei Shtepa
2023-06-12 23:43   ` Randy Dunlap
2023-06-13 10:47     ` Sergei Shtepa
2023-06-13  1:52 ` [PATCH v4 01/11] documentation: Block Device Filtering Mechanism Randy Dunlap
2023-06-13 15:23   ` Sergei Shtepa [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5f6cdc55-ddbe-ab03-92bf-02ff0318985f@veeam.com \
    --to=sergei.shtepa@veeam.com \
    --cc=axboe@kernel.dk \
    --cc=bagasdotme@gmail.com \
    --cc=brauner@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dlemoal@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@infradead.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=snitzer@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    --cc=wsa@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®