aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-11-01 08:20:50 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-12-03 06:13:59 -0500
commita1dc080c27ec8ea7ca1c8a9b499362a71ebff792 (patch)
treea41c931fb6f7c8bdc0c3481545892216921074eb /fs/ubifs
parent062e4fee4400f283307cf8ac1b7931c939010229 (diff)
UBIFS: use bit-fields to store compression type
Save a 4 bytes of RAM per 'struct inode' by stroring inode compression type in bit-filed, instead of using 'int'. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/super.c8
-rw-r--r--fs/ubifs/ubifs.h6
2 files changed, 11 insertions, 3 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index d80b2aef42b6..21b4103271ec 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -2021,6 +2021,14 @@ static int __init ubifs_init(void)
2021 BUILD_BUG_ON(UBIFS_REF_NODE_SZ != 64); 2021 BUILD_BUG_ON(UBIFS_REF_NODE_SZ != 64);
2022 2022
2023 /* 2023 /*
2024 * We use 2 bit wide bit-fields to store compression type, which should
2025 * be amended if more compressors are added. The bit-fields are:
2026 * @compr_type in 'struct ubifs_inode' and @default_compr in
2027 * 'struct ubifs_info'.
2028 */
2029 BUILD_BUG_ON(UBIFS_COMPR_TYPES_CNT > 4);
2030
2031 /*
2024 * We require that PAGE_CACHE_SIZE is greater-than-or-equal-to 2032 * We require that PAGE_CACHE_SIZE is greater-than-or-equal-to
2025 * UBIFS_BLOCK_SIZE. It is assumed that both are powers of 2. 2033 * UBIFS_BLOCK_SIZE. It is assumed that both are powers of 2.
2026 */ 2034 */
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 46b172560a06..4d76aba57ee1 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -386,12 +386,12 @@ struct ubifs_inode {
386 unsigned int dirty:1; 386 unsigned int dirty:1;
387 unsigned int xattr:1; 387 unsigned int xattr:1;
388 unsigned int bulk_read:1; 388 unsigned int bulk_read:1;
389 unsigned int compr_type:2;
389 struct mutex ui_mutex; 390 struct mutex ui_mutex;
390 spinlock_t ui_lock; 391 spinlock_t ui_lock;
391 loff_t synced_i_size; 392 loff_t synced_i_size;
392 loff_t ui_size; 393 loff_t ui_size;
393 int flags; 394 int flags;
394 int compr_type;
395 pgoff_t last_page_read; 395 pgoff_t last_page_read;
396 pgoff_t read_in_a_row; 396 pgoff_t read_in_a_row;
397 int data_len; 397 int data_len;
@@ -946,6 +946,7 @@ struct ubifs_mount_opts {
946 * @no_chk_data_crc: do not check CRCs when reading data nodes (except during 946 * @no_chk_data_crc: do not check CRCs when reading data nodes (except during
947 * recovery) 947 * recovery)
948 * @bulk_read: enable bulk-reads 948 * @bulk_read: enable bulk-reads
949 * @default_compr: default compression algorithm (%UBIFS_COMPR_LZO, etc)
949 * 950 *
950 * @tnc_mutex: protects the Tree Node Cache (TNC), @zroot, @cnext, @enext, and 951 * @tnc_mutex: protects the Tree Node Cache (TNC), @zroot, @cnext, @enext, and
951 * @calc_idx_sz 952 * @calc_idx_sz
@@ -986,7 +987,6 @@ struct ubifs_mount_opts {
986 * @main_lebs: count of LEBs in the main area 987 * @main_lebs: count of LEBs in the main area
987 * @main_first: first LEB of the main area 988 * @main_first: first LEB of the main area
988 * @main_bytes: main area size in bytes 989 * @main_bytes: main area size in bytes
989 * @default_compr: default compression algorithm (%UBIFS_COMPR_LZO, etc)
990 * 990 *
991 * @key_hash_type: type of the key hash 991 * @key_hash_type: type of the key hash
992 * @key_hash: direntry key hash function 992 * @key_hash: direntry key hash function
@@ -1196,6 +1196,7 @@ struct ubifs_info {
1196 unsigned int big_lpt:1; 1196 unsigned int big_lpt:1;
1197 unsigned int no_chk_data_crc:1; 1197 unsigned int no_chk_data_crc:1;
1198 unsigned int bulk_read:1; 1198 unsigned int bulk_read:1;
1199 unsigned int default_compr:2;
1199 1200
1200 struct mutex tnc_mutex; 1201 struct mutex tnc_mutex;
1201 struct ubifs_zbranch zroot; 1202 struct ubifs_zbranch zroot;
@@ -1237,7 +1238,6 @@ struct ubifs_info {
1237 int main_lebs; 1238 int main_lebs;
1238 int main_first; 1239 int main_first;
1239 long long main_bytes; 1240 long long main_bytes;
1240 int default_compr;
1241 1241
1242 uint8_t key_hash_type; 1242 uint8_t key_hash_type;
1243 uint32_t (*key_hash)(const char *str, int len); 1243 uint32_t (*key_hash)(const char *str, int len);