lkml.org 
[lkml]   [2023]   [Jan]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] f2fs: reduce stack memory cost by using bitfield in struct f2fs_io_info
Date
This patch tries to use bitfield in struct f2fs_io_info to improve
memory usage.

struct f2fs_io_info {
...
int need_lock:8; /* indicate we need to lock cp_rwsem */
int version:8; /* version of the node */
int submitted:1; /* indicate IO submission */
int in_list:1; /* indicate fio is in io_list */
int is_por:1; /* indicate IO is from recovery or not */
int retry:1; /* need to reallocate block address */
int encrypted:1; /* indicate file is encrypted */
int post_read:1; /* require post read */
...
};

After this patch, size of struct f2fs_io_info reduces from 136 to 120.

Signed-off-by: Chao Yu <chao@kernel.org>
---
fs/f2fs/f2fs.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index fa41c0dad308..f2f201e2a6a6 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1212,19 +1212,19 @@ struct f2fs_io_info {
struct page *encrypted_page; /* encrypted page */
struct page *compressed_page; /* compressed page */
struct list_head list; /* serialize IOs */
- bool submitted; /* indicate IO submission */
- int need_lock; /* indicate we need to lock cp_rwsem */
- bool in_list; /* indicate fio is in io_list */
- bool is_por; /* indicate IO is from recovery or not */
- bool retry; /* need to reallocate block address */
int compr_blocks; /* # of compressed block addresses */
- bool encrypted; /* indicate file is encrypted */
- bool post_read; /* require post read */
+ int need_lock:8; /* indicate we need to lock cp_rwsem */
+ int version:8; /* version of the node */
+ int submitted:1; /* indicate IO submission */
+ int in_list:1; /* indicate fio is in io_list */
+ int is_por:1; /* indicate IO is from recovery or not */
+ int retry:1; /* need to reallocate block address */
+ int encrypted:1; /* indicate file is encrypted */
+ int post_read:1; /* require post read */
enum iostat_type io_type; /* io type */
struct writeback_control *io_wbc; /* writeback control */
struct bio **bio; /* bio for ipu */
sector_t *last_block; /* last block number in bio */
- unsigned char version; /* version of the node */
};

struct bio_entry {
--
2.36.1
\
 
 \ /
  Last update: 2023-03-27 00:01    [W:0.033 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site