mbox series

[v2,0/6] Restore data lifetime support

Message ID 20240202203926.2478590-1-bvanassche@acm.org (mailing list archive)
Headers show
Series Restore data lifetime support | expand

Message

Bart Van Assche Feb. 2, 2024, 8:39 p.m. UTC
Hi Christian,

UFS devices are widely used in mobile applications, e.g. in smartphones.
UFS vendors need data lifetime information to achieve good performance.
Providing data lifetime information to UFS devices can result in up to 40%
lower write amplification. Hence this patch series that restores the
bi_write_hint member in struct bio. After this patch series has been merged,
patches that implement data lifetime support in the SCSI disk (sd) driver
will be sent to the Linux kernel SCSI maintainer.

The following changes are included in this patch series:
 - Improvements for the F_GET_RW_HINT and F_SET_RW_HINT fcntls.
 - Move enum rw_hint into a new header file.
 - Support F_SET_RW_HINT for block devices to make it easy to test data
   lifetime support.
 - Restore the bio.bi_write_hint member and restore support in the VFS layer
   and also in the block layer for data lifetime information.

The shell script that has been used to test the patch series combined with
the SCSI patches is available at the end of this cover letter.

Please consider this patch series for the next merge window.

Thanks,

Bart.

Changes compared to v1:
 - Rebased this patch series on top of the vfs.all branch.
 - Use READ_ONCE() / WRITE_ONCE() to access i_write_hint in the fcntl
   implementation.

Bart Van Assche (6):
  fs: Fix rw_hint validation
  fs: Verify write lifetime constants at compile time
  fs: Split fcntl_rw_hint()
  fs: Move enum rw_hint into a new header file
  fs: Propagate write hints to the struct block_device inode
  block, fs: Restore the per-bio/request data lifetime fields

 block/bio.c                 |  2 ++
 block/blk-crypto-fallback.c |  1 +
 block/blk-merge.c           |  8 +++++
 block/blk-mq.c              |  2 ++
 block/bounce.c              |  1 +
 block/fops.c                |  3 ++
 fs/buffer.c                 | 12 ++++---
 fs/direct-io.c              |  2 ++
 fs/f2fs/f2fs.h              |  1 +
 fs/fcntl.c                  | 64 +++++++++++++++++++++++--------------
 fs/inode.c                  |  1 +
 fs/iomap/buffered-io.c      |  1 +
 fs/iomap/direct-io.c        |  1 +
 fs/mpage.c                  |  1 +
 include/linux/blk-mq.h      |  2 ++
 include/linux/blk_types.h   |  2 ++
 include/linux/fs.h          | 16 ++--------
 include/linux/rw_hint.h     | 24 ++++++++++++++
 18 files changed, 102 insertions(+), 42 deletions(-)
 create mode 100644 include/linux/rw_hint.h

Comments

Christian Brauner Feb. 6, 2024, 1:35 p.m. UTC | #1
On Thu, 11 Jan 2024 17:22:40 +1100, David Disseldorp wrote:
> If initrd_start cpio extraction fails, CONFIG_BLK_DEV_RAM triggers
> fallback to initrd.image handling via populate_initrd_image().
> The populate_initrd_image() call follows successful extraction of any
> built-in cpio archive at __initramfs_start, but currently performs
> built-in archive extraction a second time.
> 
> Prior to commit b2a74d5f9d446 ("initramfs: remove clean_rootfs"),
> the second built-in initramfs unpack call was used to repopulate entries
> removed by clean_rootfs(), but it's no longer necessary now the contents
> of the previous extraction are retained.
> 
> [...]

I've pulled this in. There was a minor merge-conflict with
fs/iomap/buffer_write.c that I've resolved. Please double-check that
it's sane. I'll treat this branch as stable by Friday since I know you
want to rely on it.

We can do it right now but I reckon that there might still be an ack or
two incoming that you wanted.

---

Applied to the vfs.rw branch of the vfs/vfs.git tree.
Patches in the vfs.rw branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.rw
Bart Van Assche Feb. 6, 2024, 6:25 p.m. UTC | #2
On 2/6/24 05:35, Christian Brauner wrote:
> On Thu, 11 Jan 2024 17:22:40 +1100, David Disseldorp wrote:
>> If initrd_start cpio extraction fails, CONFIG_BLK_DEV_RAM triggers
>> fallback to initrd.image handling via populate_initrd_image().
>> The populate_initrd_image() call follows successful extraction of any
>> built-in cpio archive at __initramfs_start, but currently performs
>> built-in archive extraction a second time.
>>
>> Prior to commit b2a74d5f9d446 ("initramfs: remove clean_rootfs"),
>> the second built-in initramfs unpack call was used to repopulate entries
>> removed by clean_rootfs(), but it's no longer necessary now the contents
>> of the previous extraction are retained.
>>
>> [...]
> 
> I've pulled this in. There was a minor merge-conflict with
> fs/iomap/buffer_write.c that I've resolved. Please double-check that
> it's sane. I'll treat this branch as stable by Friday since I know you
> want to rely on it.

Thanks! The patches on the vfs.rw branch look good to me and pass my regression
tests.

> We can do it right now but I reckon that there might still be an ack or
> two incoming that you wanted.
I'm not sure acks will be incoming despite earlier promises. The following
was promised almost two years ago: "If at some point there's a desire to
actually try and upstream this support, then we'll be happy to review that
patchset." [ ... ] "As I've said multiple times, whenever code is available,
it'll be reviewed and discussed."

Sources:
* https://lore.kernel.org/linux-block/ef77ef36-df95-8658-ff54-7d8046f5d0e7@kernel.dk/,
   March 2022.
* https://lore.kernel.org/linux-block/95588225-b2af-72b6-2feb-811a3b346f9f@kernel.dk/,
   March 2022.

Bart.