Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp968608lqj; Mon, 3 Jun 2024 06:36:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUekj7b6rU6o0jjBHR0pJLwg0np3JgX7+gFBDRHJHkjWYtdNRPlRGJYWQguxk6J38TPZRKkNM5G5f08ZxphPXhPOfy/rP1rq472202xig== X-Google-Smtp-Source: AGHT+IGcmWIxCSyaixwbqeGVWGMQy2HsLtOGeLSFy9SEO8HkBTEZNrgiuawqlgYmh1SGpCnSL9hC X-Received: by 2002:a05:6a20:6a25:b0:1af:ccd8:c118 with SMTP id adf61e73a8af0-1b26f117a0fmr9537673637.22.1717421767575; Mon, 03 Jun 2024 06:36:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717421767; cv=pass; d=google.com; s=arc-20160816; b=sYp/bXwKragyS2CIgexnWy6nryrkHZpp+CWz1dmCB3NsNCWwpLGz/SFgp2M0cCnAp3 l/OVYQoc0Cm2D835dWZXLajWEyBV7tGi5smwW0HhSPIJfKzpJNV+5Q/s2GPKdcibDF9I 9ly6Z63+0+FVxmBuZkaRsZSo2GoS7Jbai+PNwEwEELmT0X6AqDSxS7uSeIFzX4NPXJ5n nZ3VMl0hIdA2v43fNJbDDIMrcOdQ3VvJCw8RkYgz9o5p5D7h+fFACfJE9yDtn1tT9KTN NTFuSh0E26h+iDiZ06ejD6oLpl4M4SwjJnuIGkMFiw9tWxlqa7WWm6pd9oUhT5LKb0aT YEFw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=F/AppQrtGjIHDChNDICJ5hJRi1+uzDCNcLrYoDw3em8=; fh=j06T3EswMABkhkPUY1lEeHL/wmz1iP+bOyhRj6rK5YI=; b=Q9HYajh5nic6NQMQnBGQA2HL+a0TvAaf9in6yzPcU+Ljn53k0eT56NcXwOhWD8rKy4 8L4tmKWOmgVPINJJoj+mxtu9h/ca/bAxhJJP8WC9VVXeVyhjIwdxg5yQwbe4B4iNG1nU IhuYLekyOGhLNjuyxvm2fbHQ9zzRoKyv70F/YIIDnet/32gPteMaVHuTd6rfeEfpIjvc VV+A+q4CjOVbMBHFcOVmXRxZlXoBuknyzZiRN8Yt7ial2C6mQ6nRBsqKfGmtrPT1U1mr vVfCjWpSEsijbs8OJmeqvE9wL+9Z0y0Ln5ZOxHliaOCan0JU7xYlDLL2dJ7FrQAbIHRw xnvQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jYkAomWC; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-ext4+bounces-2753-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2753-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c702226b9bsi4708906a12.201.2024.06.03.06.36.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 06:36:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4+bounces-2753-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jYkAomWC; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-ext4+bounces-2753-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2753-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1685BB23816 for ; Mon, 3 Jun 2024 13:15:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 49C0884D0F; Mon, 3 Jun 2024 13:15:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jYkAomWC" X-Original-To: linux-ext4@vger.kernel.org Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 758A212D747 for ; Mon, 3 Jun 2024 13:15:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717420532; cv=none; b=cNpVcpuaszRkSM48kng9cxWSSTvTOL5vhRlhVhUXtj6xlzb63avupcmskwUyuhRrdYrgdQtEtCEwm4eITAE2oUYMeVA0WLVtjtfzjdkbrK+fdhZv29Xtur842W77c3FS3NiTPLFTeLDB6+uCqpM3A1La76ADr/kwq6bj5YaJmBg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717420532; c=relaxed/simple; bh=VAEsm378SBRwNjuOF2HT7ky+qTZcNBnlsUKg7NdlCFI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=FHpmoSu6ijEZoN02Jy8FneESg7QV9uirswAsradzZJVLjo2cByG2uctu3uAoiQ51dNyXeQ24nHmOwLZRlR4UHzONCOTRWgFh5caoqTcGB9KxAdK9D/n5kZXhJpToECm9624ILDQh/6MXcIKbRaPr9A7UQpW09LKJ9qBJoj1tyco= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jYkAomWC; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1f44b45d6abso30594495ad.0 for ; Mon, 03 Jun 2024 06:15:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717420530; x=1718025330; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=F/AppQrtGjIHDChNDICJ5hJRi1+uzDCNcLrYoDw3em8=; b=jYkAomWCLtIAYtVxISf0KAWCGOe7xf19WVzU90RmBC1fG6ykubrwYJVal34zZHUUks Qd8rdQ8yU/6o/mccLVXBqjv41eB2kJG4qbT13FuvkPDztwnQzfL9nNwXer8itcW/pYQ2 +6nyDHWzePaB+jC6WpZyMvHg5Dd0G9BfzKZQKMSET8iQj8OvNN2FCbQgAfpLbFAxym80 rmzjAgZatQ9mO15iHPh6aOZ+QWqKit+cPImlPtCi5vRFljBSoANFYzVu+VSisShoFPQt UQeJW7d8or0jNGVXKRVVKwYUaRdpoo8zj3YCyS9EX9xhA6VAioM8yFOckmxSq7XGuHn5 Ca4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717420530; x=1718025330; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=F/AppQrtGjIHDChNDICJ5hJRi1+uzDCNcLrYoDw3em8=; b=g4IG7IScgdufhPtOybAy04jZbB8fZQsT7/HBR0YHBM3QzlSpjmsrY+GybCG8wD31iw MWSUiXaZiSjGG19Z4ZLtPpCGWau646NvxfS1Xj9ncnDamc8Jnjf6AeIRciAjjLkk55gf 6aZQWLV1ZxLS1IZTHXNfuqrT3fwwKeZskUcJxSVf59BeiFB+vsWK5M8HWTokDwyziAtd OiZmKor4WpXVr0EjGEgS9CN9f187lKUzVSH3XSA37Hf6/h5bjgpkjwbjC8kQ4N8q6Clc Hk3C/5m6Mq++U2fOtgtRffUG8SSYDxC74qSjQMb5SSSTQDYLGzZit1s6j3areCxyRtrv j+Qw== X-Gm-Message-State: AOJu0Yw2G6CJlkkIE5m9SmFoMwPvydKzoD7wbRRZmyrRvn48qjLZNmQt 69o3teIH2evv5RfUmMPmJ1UfX0bvZaJ7fsocNzG+AWXFDuo3hgpd23XwXwca X-Received: by 2002:a17:903:2442:b0:1f6:565f:2779 with SMTP id d9443c01a7336-1f6565f28ecmr61524885ad.61.1717420529472; Mon, 03 Jun 2024 06:15:29 -0700 (PDT) Received: from localhost ([123.113.100.202]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f63237a319sm64305415ad.109.2024.06.03.06.15.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 06:15:29 -0700 (PDT) From: Junchao Sun To: linux-ext4@vger.kernel.org Cc: tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, Junchao Sun Subject: [PATCH] ext4: Adjust the layout of the ext4_inode_info structure to save memory. Date: Mon, 3 Jun 2024 21:15:24 +0800 Message-Id: <20240603131524.324224-1-sunjunchao2870@gmail.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Using pahole, we can see that there are some padding holes in the current ext4_inode_info structure. Adjusting the layout of ext4_inode_info can reduce these holes, resulting in the size of the structure decreasing from 2424 bytes to 2408 bytes. Signed-off-by: Junchao Sun --- fs/ext4/ext4.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 023571f8dd1b..42bcd4f749a8 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -1055,6 +1055,7 @@ struct ext4_inode_info { /* Number of ongoing updates on this inode */ atomic_t i_fc_updates; + atomic_t i_unwritten; /* Nr. of inflight conversions pending */ /* Fast commit wait queue for this inode */ wait_queue_head_t i_fc_wait; @@ -1103,6 +1104,10 @@ struct ext4_inode_info { /* mballoc */ atomic_t i_prealloc_active; + + /* allocation reservation info for delalloc */ + /* In case of bigalloc, this refer to clusters rather than blocks */ + unsigned int i_reserved_data_blocks; struct rb_root i_prealloc_node; rwlock_t i_prealloc_lock; @@ -1119,10 +1124,6 @@ struct ext4_inode_info { /* ialloc */ ext4_group_t i_last_alloc_group; - /* allocation reservation info for delalloc */ - /* In case of bigalloc, this refer to clusters rather than blocks */ - unsigned int i_reserved_data_blocks; - /* pending cluster reservations for bigalloc file systems */ struct ext4_pending_tree i_pending_tree; @@ -1146,7 +1147,6 @@ struct ext4_inode_info { */ struct list_head i_rsv_conversion_list; struct work_struct i_rsv_conversion_work; - atomic_t i_unwritten; /* Nr. of inflight conversions pending */ spinlock_t i_block_reservation_lock; -- 2.39.2