Skip to contentSkip to conversation

design: fix computation of buffer log item bitmap size

PATCH Superseded Darrick J. Wong 2 participants 4 messages Nov 10, 2021 – Jan 4, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 design: fix computation of buffer log item bitmap size

From: Darrick J. Wong <[email protected]>

Wengang Wang was trying to work through a buffer log item by consulting the ondisk format documentation, and was confused by the formula given in section 14.3.14 regarding the size of blf_data_map, aka the dirty bitmap for buffer log items. We noticed that the documentation doesn't match what the kernel actually does, so let's fix this.

---
 .../journaling_log.asciidoc                        |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
design/XFS_Filesystem_Structure/journaling_log.asciidoc +1 -1
index 1dba56e..894d3e5 100644
@@ -992,7 +992,7 @@ The size of +blf_data_map+, in 32-bit words.
 This variable-sized array acts as a dirty bitmap for the logged buffer.  Each
 1 bit represents a dirty region in the buffer, and each run of 1 bits
 corresponds to a subsequent log item containing the new contents of the buffer
-area.  Each bit represents +(blf_len * 512) / (blf_map_size * NBBY)+ bytes.
+area.  Each bit represents +(blf_len * 512) / (blf_map_size * sizeof(unsigned int) * NBBY)+ bytes.
 
 [[Buffer_Data_Log_Item]]
 === Buffer Data Log Item
#1 lore raw
Quoted 10 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Wengang Wang was trying to work through a buffer log item by consulting the ondisk format documentation, and was confused by the formula given in section 14.3.14 regarding the size of blf_data_map, aka the dirty bitmap for buffer log items. We noticed that the documentation doesn't match what the kernel actually does, so let's fix this.

This is probably a bad time for this, but... ping?

--D

Quoted 17 lines
---
 .../journaling_log.asciidoc                        |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
design/XFS_Filesystem_Structure/journaling_log.asciidoc +1 -1
index 1dba56e..894d3e5 100644
@@ -992,7 +992,7 @@ The size of +blf_data_map+, in 32-bit words.
 This variable-sized array acts as a dirty bitmap for the logged buffer.  Each
 1 bit represents a dirty region in the buffer, and each run of 1 bits
 corresponds to a subsequent log item containing the new contents of the buffer
-area.  Each bit represents +(blf_len * 512) / (blf_map_size * NBBY)+ bytes.
+area.  Each bit represents +(blf_len * 512) / (blf_map_size * sizeof(unsigned int) * NBBY)+ bytes.
 
 [[Buffer_Data_Log_Item]]
 === Buffer Data Log Item
#2 lore raw
In reply to Darrick J. Wong
Quoted 19 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Wengang Wang was trying to work through a buffer log item by consulting the ondisk format documentation, and was confused by the formula given in section 14.3.14 regarding the size of blf_data_map, aka the dirty bitmap for buffer log items. We noticed that the documentation doesn't match what the kernel actually does, so let's fix this.

---
 .../journaling_log.asciidoc                        |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
design/XFS_Filesystem_Structure/journaling_log.asciidoc +0 -0
index 1dba56e..894d3e5 100644

design/XFS_Filesystem_Structure/journaling_log.asciidoc The size of +blf_data_map+, in 32-bit words. · line 998

Quoted 8 lines
design/XFS_Filesystem_Structure/journaling_log.asciidoc +1 -1
@@ -992,7 +992,7 @@ The size of +blf_data_map+, in 32-bit words.
 This variable-sized array acts as a dirty bitmap for the logged buffer.  Each
 1 bit represents a dirty region in the buffer, and each run of 1 bits
 corresponds to a subsequent log item containing the new contents of the buffer
-area.  Each bit represents +(blf_len * 512) / (blf_map_size * NBBY)+ bytes.
+area.  Each bit represents +(blf_len * 512) / (blf_map_size * sizeof(unsigned int) * NBBY)+ bytes.
 
 [[Buffer_Data_Log_Item]]
 === Buffer Data Log Item

The calculation looks correct. However, wouldn't it be better to mention,

"Each bit represents XFS_BLF_CHUNK (i.e. 128) bytes"

... or some such variant involving XFS_BLF_CHUNK.

Signature · 1 line
chandan
#3 lore raw
Quoted 26 lines · Chandan Babu R
Quoted 25 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Wengang Wang was trying to work through a buffer log item by consulting the ondisk format documentation, and was confused by the formula given in section 14.3.14 regarding the size of blf_data_map, aka the dirty bitmap for buffer log items. We noticed that the documentation doesn't match what the kernel actually does, so let's fix this.

---
 .../journaling_log.asciidoc                        |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
design/XFS_Filesystem_Structure/journaling_log.asciidoc +1 -1
index 1dba56e..894d3e5 100644
@@ -992,7 +992,7 @@ The size of +blf_data_map+, in 32-bit words.
 This variable-sized array acts as a dirty bitmap for the logged buffer.  Each
 1 bit represents a dirty region in the buffer, and each run of 1 bits
 corresponds to a subsequent log item containing the new contents of the buffer
-area.  Each bit represents +(blf_len * 512) / (blf_map_size * NBBY)+ bytes.
+area.  Each bit represents +(blf_len * 512) / (blf_map_size * sizeof(unsigned int) * NBBY)+ bytes.
 
Quoted 8 lines

design/XFS_Filesystem_Structure/journaling_log.asciidoc The size of +blf_data_map+, in 32-bit words. · line 998

Quoted 2 lines
design/XFS_Filesystem_Structure/journaling_log.asciidoc +0 -0
 [[Buffer_Data_Log_Item]]
 === Buffer Data Log Item

The calculation looks correct. However, wouldn't it be better to mention,

"Each bit represents XFS_BLF_CHUNK (i.e. 128) bytes"

... or some such variant involving XFS_BLF_CHUNK.

Ok.

--D

Quoted 3 lines
Signature · 2 lines
-- 
chandan