From 73719b9ea5675f288f48a969ac1894cc5c71cd21 Mon Sep 17 00:00:00 2001 From: Alessio Balsini Date: Mon, 25 Jan 2021 16:58:50 +0000 Subject: [PATCH] BACKPORT: fs: Generic function to convert iocb to rw flags OverlayFS implements its own function to translate iocb flags into rw flags, so that they can be passed into another vfs call. With commit ce71bfea207b4 ("fs: align IOCB_* flags with RWF_* flags") Jens created a 1:1 matching between the iocb flags and rw flags, simplifying the conversion. Reduce the OverlayFS code by making the flag conversion function generic and reusable. Bug: 179164095 Link: https://lore.kernel.org/lkml/20210125153057.3623715-2-balsini@android.com/ Signed-off-by: Alessio Balsini Change-Id: I74aefeafd6ebbda2fbabee9024474dfe4cc6c2a7 Signed-off-by: Alessio Balsini --- include/linux/fs.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/fs.h b/include/linux/fs.h index 34df7fae303e..86fafb4455c2 100755 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3321,6 +3321,11 @@ static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags) return 0; } +static inline rwf_t iocb_to_rw_flags(int ifl, int iocb_mask) +{ + return ifl & iocb_mask; +} + static inline ino_t parent_ino(struct dentry *dentry) { ino_t res;