Re: [Cluster-devel] [PATCH 27/27] direct-io: remove random prefetches

2022-04-19 Thread David Sterba
On Fri, Apr 15, 2022 at 06:52:58AM +0200, Christoph Hellwig wrote:
> Randomly poking into block device internals for manual prefetches isn't
> exactly a very maintainable thing to do.  And none of the performance
> criticil direct I/O implementations still use this library function
> anyway, so just drop it.
> 
> Signed-off-by: Christoph Hellwig 

That the direct io function needed a valid bdev just for the prefetch
but nothing else was one of the reasons we had to keep the latest_bdev
in btrfs, so good riddance.

You may want to add the reference to the patch that added the prefetch,
65dd2aa90aa1 ("dio: optimize cache misses in the submission path") and
also remove #include  as there are no more uses of
prefetch in the file.

With that

Reviewed-by: David Sterba 



[Cluster-devel] [PATCH 27/27] direct-io: remove random prefetches

2022-04-14 Thread Christoph Hellwig
Randomly poking into block device internals for manual prefetches isn't
exactly a very maintainable thing to do.  And none of the performance
criticil direct I/O implementations still use this library function
anyway, so just drop it.

Signed-off-by: Christoph Hellwig 
---
 fs/direct-io.c | 32 
 1 file changed, 4 insertions(+), 28 deletions(-)

diff --git a/fs/direct-io.c b/fs/direct-io.c
index aef06e607b405..840752006f601 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -1115,11 +1115,10 @@ static inline int drop_refcount(struct dio *dio)
  * individual fields and will generate much worse code. This is important
  * for the whole file.
  */
-static inline ssize_t
-do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
- struct block_device *bdev, struct iov_iter *iter,
- get_block_t get_block, dio_iodone_t end_io,
- dio_submit_t submit_io, int flags)
+ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
+   struct block_device *bdev, struct iov_iter *iter,
+   get_block_t get_block, dio_iodone_t end_io,
+   dio_submit_t submit_io, int flags)
 {
unsigned i_blkbits = READ_ONCE(inode->i_blkbits);
unsigned blkbits = i_blkbits;
@@ -1334,29 +1333,6 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode 
*inode,
kmem_cache_free(dio_cache, dio);
return retval;
 }
-
-ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
-struct block_device *bdev, struct iov_iter *iter,
-get_block_t get_block,
-dio_iodone_t end_io, dio_submit_t submit_io,
-int flags)
-{
-   /*
-* The block device state is needed in the end to finally
-* submit everything.  Since it's likely to be cache cold
-* prefetch it here as first thing to hide some of the
-* latency.
-*
-* Attempt to prefetch the pieces we likely need later.
-*/
-   prefetch(>bd_disk->part_tbl);
-   prefetch(bdev->bd_disk->queue);
-   prefetch((char *)bdev->bd_disk->queue + SMP_CACHE_BYTES);
-
-   return do_blockdev_direct_IO(iocb, inode, bdev, iter, get_block,
-end_io, submit_io, flags);
-}
-
 EXPORT_SYMBOL(__blockdev_direct_IO);
 
 static __init int dio_init(void)
-- 
2.30.2



[Cluster-devel] [PATCH 27/27] direct-io: remove random prefetches

2022-04-08 Thread Christoph Hellwig
Randomly poking into block device internals for manual prefetches isn't
exactly a very maintainable thing to do.  And none of the performance
criticil direct I/O implementations still use this library function
anyway, so just drop it.

Signed-off-by: Christoph Hellwig 
---
 fs/direct-io.c | 32 
 1 file changed, 4 insertions(+), 28 deletions(-)

diff --git a/fs/direct-io.c b/fs/direct-io.c
index aef06e607b405..840752006f601 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -1115,11 +1115,10 @@ static inline int drop_refcount(struct dio *dio)
  * individual fields and will generate much worse code. This is important
  * for the whole file.
  */
-static inline ssize_t
-do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
- struct block_device *bdev, struct iov_iter *iter,
- get_block_t get_block, dio_iodone_t end_io,
- dio_submit_t submit_io, int flags)
+ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
+   struct block_device *bdev, struct iov_iter *iter,
+   get_block_t get_block, dio_iodone_t end_io,
+   dio_submit_t submit_io, int flags)
 {
unsigned i_blkbits = READ_ONCE(inode->i_blkbits);
unsigned blkbits = i_blkbits;
@@ -1334,29 +1333,6 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode 
*inode,
kmem_cache_free(dio_cache, dio);
return retval;
 }
-
-ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
-struct block_device *bdev, struct iov_iter *iter,
-get_block_t get_block,
-dio_iodone_t end_io, dio_submit_t submit_io,
-int flags)
-{
-   /*
-* The block device state is needed in the end to finally
-* submit everything.  Since it's likely to be cache cold
-* prefetch it here as first thing to hide some of the
-* latency.
-*
-* Attempt to prefetch the pieces we likely need later.
-*/
-   prefetch(>bd_disk->part_tbl);
-   prefetch(bdev->bd_disk->queue);
-   prefetch((char *)bdev->bd_disk->queue + SMP_CACHE_BYTES);
-
-   return do_blockdev_direct_IO(iocb, inode, bdev, iter, get_block,
-end_io, submit_io, flags);
-}
-
 EXPORT_SYMBOL(__blockdev_direct_IO);
 
 static __init int dio_init(void)
-- 
2.30.2



[Cluster-devel] [PATCH 27/27] direct-io: remove random prefetches

2022-04-06 Thread Christoph Hellwig
Randomly poking into block device internals for manual prefetches isn't
exactly a very maintainable thing to do.  And none of the performance
criticil direct I/O implementations still use this library function
anyway, so just drop it.

Signed-off-by: Christoph Hellwig 
---
 fs/direct-io.c | 32 
 1 file changed, 4 insertions(+), 28 deletions(-)

diff --git a/fs/direct-io.c b/fs/direct-io.c
index aef06e607b405..840752006f601 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -1115,11 +1115,10 @@ static inline int drop_refcount(struct dio *dio)
  * individual fields and will generate much worse code. This is important
  * for the whole file.
  */
-static inline ssize_t
-do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
- struct block_device *bdev, struct iov_iter *iter,
- get_block_t get_block, dio_iodone_t end_io,
- dio_submit_t submit_io, int flags)
+ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
+   struct block_device *bdev, struct iov_iter *iter,
+   get_block_t get_block, dio_iodone_t end_io,
+   dio_submit_t submit_io, int flags)
 {
unsigned i_blkbits = READ_ONCE(inode->i_blkbits);
unsigned blkbits = i_blkbits;
@@ -1334,29 +1333,6 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode 
*inode,
kmem_cache_free(dio_cache, dio);
return retval;
 }
-
-ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
-struct block_device *bdev, struct iov_iter *iter,
-get_block_t get_block,
-dio_iodone_t end_io, dio_submit_t submit_io,
-int flags)
-{
-   /*
-* The block device state is needed in the end to finally
-* submit everything.  Since it's likely to be cache cold
-* prefetch it here as first thing to hide some of the
-* latency.
-*
-* Attempt to prefetch the pieces we likely need later.
-*/
-   prefetch(>bd_disk->part_tbl);
-   prefetch(bdev->bd_disk->queue);
-   prefetch((char *)bdev->bd_disk->queue + SMP_CACHE_BYTES);
-
-   return do_blockdev_direct_IO(iocb, inode, bdev, iter, get_block,
-end_io, submit_io, flags);
-}
-
 EXPORT_SYMBOL(__blockdev_direct_IO);
 
 static __init int dio_init(void)
-- 
2.30.2