1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * fs/hmdfs/hmdfs_dentryfile_cloud.h 4 * 5 * Copyright (c) 2023-2023 Huawei Device Co., Ltd. 6 */ 7 8 #ifndef HMDFS_DENTRYFILE_CLOUD_H 9 #define HMDFS_DENTRYFILE_CLOUD_H 10 11 #include "inode.h" 12 #include "hmdfs_dentryfile.h" 13 14 /* 15 * 4096 = version(1) + bitmap(8) + reserved(7) 16 * + nsl(60 * 60) + filename(60 * 8) 17 */ 18 #define DENTRY_BITMAP_LENGTH_CLOUD 8 19 #define DENTRY_PER_GROUP_CLOUD 60 20 #define DENTRY_GROUP_RESERVED_CLOUD 7 21 struct hmdfs_dentry_cloud { 22 __le32 hash; 23 __le16 i_mode; 24 __le16 namelen; 25 __le64 i_size; 26 __le64 i_mtime; 27 __u8 record_id[CLOUD_RECORD_ID_LEN]; 28 /* reserved bytes for long term extend, total 60 bytes */ 29 __u8 reserved[CLOUD_DENTRY_RESERVED_LENGTH]; 30 } __packed; 31 32 /* 4K/68 Bytes = 60 dentries for per dentrygroup */ 33 struct hmdfs_dentry_group_cloud { 34 __u8 dentry_version; 35 __u8 bitmap[DENTRY_BITMAP_LENGTH_CLOUD]; 36 struct hmdfs_dentry_cloud nsl[DENTRY_PER_GROUP_CLOUD]; 37 __u8 filename[DENTRY_PER_GROUP_CLOUD][DENTRY_NAME_LEN]; 38 __u8 reserved[DENTRY_GROUP_RESERVED_CLOUD]; 39 } __packed; 40 41 struct hmdfs_dcache_lookup_ctx_cloud { 42 struct hmdfs_sb_info *sbi; 43 const struct qstr *name; 44 struct file *filp; 45 __u32 hash; 46 47 /* for case sensitive */ 48 unsigned long bidx; 49 struct hmdfs_dentry_group_cloud *page; 50 51 /* for case insensitive */ 52 struct hmdfs_dentry_cloud *insense_de; 53 unsigned long insense_bidx; 54 struct hmdfs_dentry_group_cloud *insense_page; 55 }; 56 57 void hmdfs_init_dcache_lookup_ctx_cloud( 58 struct hmdfs_dcache_lookup_ctx_cloud *ctx, struct hmdfs_sb_info *sbi, 59 const struct qstr *qstr, struct file *filp); 60 struct hmdfs_dentry_cloud * 61 hmdfs_find_dentry_cloud(struct dentry *child_dentry, 62 struct hmdfs_dcache_lookup_ctx_cloud *ctx); 63 #endif 64