On 26/11/2019 11:10, Johannes Thumshirn wrote: > Apart from Willy's comment > Reviewed-by: Johannes Thumshirn <jthumshirn@xxxxxxx> On the other hand, you could as well do: static ssize_t btrfs_file_read_iter(struct kiocb *iocb, struct iov_iter *to) +{ + ssize_t ret = 0; + if (iocb->ki_flags & IOCB_DIRECT) + ret = btrfs_dio_read(iocb, to); + if (ret < 0) + return ret; + + return generic_file_read_iter(iocb, ret); +} In patch 3/5, if IOCB_DIRECT is set we're branching into btrfs_dio_read() above and if not generic_file_read_iter() will then directly call generic_file_buffered_read() -- Johannes Thumshirn SUSE Labs Filesystems jthumshirn@xxxxxxx +49 911 74053 689 SUSE Software Solutions Germany GmbH Maxfeldstr. 5 90409 Nürnberg Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850