public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* Newbie questions about DIR_ITEM and DIR_INDEX design
@ 2025-08-20 13:59 Sun YangKai
  2025-08-20 17:06 ` Mark Harmstone
  0 siblings, 1 reply; 5+ messages in thread
From: Sun YangKai @ 2025-08-20 13:59 UTC (permalink / raw)
  To: linux-btrfs; +Cc: sunk67188

Hello btrfs developers

I am a beginner studying the implementation of btrfs. While examining the 
structures of DIR_ITEM and DIR_INDEX, I noticed that both store similar 
content but differ in their offset values. This led me to two questions:

1. The offset field in DIR_ITEM is computed as a CRC32 hash of the filename. In 
practice, is there a risk of hash collisions? If so, how does the current 
implementation handle such collisions?

2. The offset field in DIR_INDEX appears to be an auto-incrementing number, 
possibly indicating the creation order of entries within a directory. Why is 
this necessary, given that DIR_ITEM already exists?

I would greatly appreciate any insights or references to relevant 
documentation or code snippets to help me understand these design choices.

Thank you for your time and guidance.

Best regards,
Sun YangKai



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-08-21 10:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-20 13:59 Newbie questions about DIR_ITEM and DIR_INDEX design Sun YangKai
2025-08-20 17:06 ` Mark Harmstone
2025-08-21  8:26   ` Sun YangKai
2025-08-21  9:20     ` Mark Harmstone
2025-08-21 10:06       ` Sun YangKai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox