linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 0/4] block: Add support for REQ_OP_ALLOCATE
@ 2020-04-06 22:21 Chaitanya Kulkarni
  2020-04-06 22:21 ` [PATCH V2 1/4] block: create payloadless issue bio helper Chaitanya Kulkarni
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Chaitanya Kulkarni @ 2020-04-06 22:21 UTC (permalink / raw)
  To: hch, martin.petersen
  Cc: darrick.wong, axboe, tytso, adilger.kernel, ming.lei, jthumshirn,
	minwoo.im.dev, chaitanya.kulkarni, damien.lemoal, andrea.parri,
	hare, tj, hannes, khlebnikov, ajay.joshi, bvanassche, arnd,
	houtao1, asml.silence, ktkhai, linux-block, linux-ext4

Hi,

This patch-series is based on the original RFC patch series:-
https://www.spinics.net/lists/linux-block/msg47933.html.

I've designed a rough testcase based on the information present
in the mailing list archive for original RFC, it may need
some corrections from the author.

If anyone is interested, test results are at the end of this patch.

Following is the original cover-letter :-

Information about continuous extent placement may be useful
for some block devices. Say, distributed network filesystems,
which provide block device interface, may use this information
for better blocks placement over the nodes in their cluster,
and for better performance. Block devices, which map a file
on another filesystem (loop), may request the same length extent
on underlining filesystem for less fragmentation and for batching
allocation requests. Also, hypervisors like QEMU may use this
information for optimization of cluster allocations.

This patchset introduces REQ_OP_ALLOCATE, which is going
to be used for forwarding user's fallocate(0) requests into
block device internals. It rather similar to existing
REQ_OP_DISCARD, REQ_OP_WRITE_ZEROES, etc. The corresponding
exported primitive is called blkdev_issue_allocate().
See [1/3] for the details.

Patch [2/3] teaches loop driver to handle REQ_OP_ALLOCATE
requests by calling fallocate(0).

Patch [3/3] makes ext4 to notify a block device about fallocate(0).

Here is a simple test I did:
https://gist.github.com/tkhai/5b788651cdb74c1dbff3500745878856

I attached a file on ext4 to loop. Then, created ext4 partition
on loop device and started the test in the partition. Direct-io
is enabled on loop.

The test fallocates 4G file and writes from some offset with
given step, then it chooses another offset and repeats. After
the test all the blocks in the file become written.

The results shows that batching extents-assigning requests improves
the performance:

Before patchset: real ~ 1min 27sec
After patchset:  real ~ 1min 16sec (18% better)

Ordinary fallocate() before writes improves the performance
by batching the requests. These results just show, the same
is in case of forwarding extents information to underlining
filesystem.

Regards,
Chaitanya

Changes from V1:-

1. Adjust series from using assign range or ASSIGN_RANGE to allocate or
   ALLOCATE. (Martin)
2. Add SECT_FROM_SB_BLK() and NSECTS_FROM_SB_NBLK() macros since it
   avoids weired line breaking and duplication of the code for
   sb_issue_discard(), sb_issue_zeroout() and sb_issue_allocate().
   Should there be a prep patch for this ?

Changes from RFC:-

1. Add missing plumbing for REQ_OP_ASSIGN_RANGE similar to write-zeores.
2. Add a prep patch to create a helper to submit payloadless bios.
3. Design a testcases around the description present in the
   cover-letter.

Chaitanya Kulkarni (1):
  block: create payloadless issue bio helper

Kirill Tkhai (3):
  block: Add support for REQ_OP_ALLOCATE
  loop: Forward REQ_OP_ALLOCATE into fallocate(0)
  ext4: Notify block device about alloc-assigned blk

 block/blk-core.c          |   5 ++
 block/blk-lib.c           | 115 +++++++++++++++++++++++++++++++-------
 block/blk-merge.c         |  21 +++++++
 block/blk-settings.c      |  19 +++++++
 block/blk-zoned.c         |   1 +
 block/bounce.c            |   1 +
 drivers/block/loop.c      |   5 ++
 fs/ext4/ext4.h            |   2 +
 fs/ext4/extents.c         |  12 +++-
 include/linux/bio.h       |   9 ++-
 include/linux/blk_types.h |   2 +
 include/linux/blkdev.h    |  55 ++++++++++++++----
 12 files changed, 210 insertions(+), 37 deletions(-)

-- 
2.22.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-04-06 23:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-06 22:21 [PATCH V2 0/4] block: Add support for REQ_OP_ALLOCATE Chaitanya Kulkarni
2020-04-06 22:21 ` [PATCH V2 1/4] block: create payloadless issue bio helper Chaitanya Kulkarni
2020-04-06 22:21 ` [PATCH V2 2/4] block: Add support for REQ_OP_ALLOCATE Chaitanya Kulkarni
2020-04-06 22:21 ` [PATCH V2 3/4] loop: Forward REQ_OP_ALLOCATE into fallocate(0) Chaitanya Kulkarni
2020-04-06 22:21 ` [PATCH V2 4/4] ext4: Notify block device about alloc-assigned blk Chaitanya Kulkarni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).