From 2b4861cd57e6e6078d6db4924fd4e567e2f364bb Mon Sep 17 00:00:00 2001 From: Jian Yu Date: Wed, 7 Feb 2024 01:08:04 -0800 Subject: [PATCH] EX-8669 llite: set STATX_ATTR_COMPRESSED flag in ll_iocontrol() This patch extracts the compression flag LUSTRE_COMPR_FL from mbo_flags and set STATX_ATTR_COMPRESSED flag in ll_iocontrol() to please lsattr and other e2fsprogs tools. Test-Parameters: trivial testlist=sanity-compr Change-Id: I14d2082a6719a1ca5708f7aef7a2fb0f085ca63c Signed-off-by: Jian Yu Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53953 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/include/uapi/linux/lustre/lustre_idl.h | 1 + lustre/llite/llite_internal.h | 3 ++- lustre/llite/llite_lib.c | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lustre/include/uapi/linux/lustre/lustre_idl.h b/lustre/include/uapi/linux/lustre/lustre_idl.h index 1f785d4..96f1cba 100644 --- a/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -1883,6 +1883,7 @@ enum { LUSTRE_ORPHAN_FL = 0x00002000, LUSTRE_SET_SYNC_FL = 0x00040000, /* Synchronous setattr on OSTs */ LUSTRE_ENCRYPT_FL = 0x00800000, /* encrypted file */ + LUSTRE_COMPR_FL = 0x00000004, /* compressed file */ LUSTRE_LMA_FL_MASKS = LUSTRE_ENCRYPT_FL | LUSTRE_ORPHAN_FL, }; diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 98d9b86..392fcfa 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -452,7 +452,8 @@ enum ll_inode_flags { LLIF_PROJECT_INHERIT = 3, /* update atime from MDS even if it's older than local inode atime. */ LLIF_UPDATE_ATIME = 4, - /* 6 is not used for now */ + /* compressed file */ + LLIF_COMPR_FL = 6, /* Xattr cache is filled */ LLIF_XATTR_CACHE_FILLED = 7, diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 116ccde..46f88eb 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -2571,6 +2571,11 @@ void ll_update_inode_flags(struct inode *inode, int ext_flags) set_bit(LLIF_PROJECT_INHERIT, &ll_i2info(inode)->lli_flags); else clear_bit(LLIF_PROJECT_INHERIT, &ll_i2info(inode)->lli_flags); + + if (ext_flags & LUSTRE_COMPR_FL) + set_bit(LLIF_COMPR_FL, &ll_i2info(inode)->lli_flags); + else + clear_bit(LLIF_COMPR_FL, &ll_i2info(inode)->lli_flags); } int ll_update_inode(struct inode *inode, struct lustre_md *md) @@ -2932,6 +2937,9 @@ int ll_iocontrol(struct inode *inode, struct file *file, if (flags & LUSTRE_ENCRYPT_FL) flags |= STATX_ATTR_ENCRYPTED; + if (test_bit(LLIF_COMPR_FL, &ll_i2info(inode)->lli_flags)) + flags |= STATX_ATTR_COMPRESSED; + ptlrpc_req_finished(req); RETURN(put_user(flags, (int __user *)arg)); -- 1.8.3.1