[Devel] [PATCH rh7] fuse: process small sync direct reads	synchronously
    Maxim Patlasov 
    mpatlasov at virtuozzo.com
       
    Thu Oct 13 18:25:09 PDT 2016
    
    
  
It is useless to process small sync direct reads asynchronously,
because that optimization works only if we send more than one
request to userspace fused concurrently.
On the other hand, the patch workarounds a problem reported by AK:
> If a cluster hangs (for any reason), all max_background fuse
> requests are usually consumed and async io is impossible.
> Unfortunately it also makes impossible to read .vstorage.info
> that is necessary to investigate why the cluster hanged.
Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
 fs/fuse/file.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 6b9e4ea..49ee3de 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -3307,8 +3307,11 @@ fuse_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
 	 * We cannot asynchronously extend the size of a file. We have no method
 	 * to wait on real async I/O requests, so we must submit this request
 	 * synchronously.
+	 * And it's useless to process small sync READs asynchronously.
 	 */
-	if (!is_sync_kiocb(iocb) && (offset + count > i_size) && rw == WRITE)
+	if ((!is_sync_kiocb(iocb) && (offset + count > i_size) && rw == WRITE) ||
+	    (rw != WRITE && is_sync_kiocb(iocb) &&
+	     count <= (FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT)))
 		io->async = false;
 
 	if (rw == WRITE)
    
    
More information about the Devel
mailing list