public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Sun YangKai <sunk67188@gmail.com>
To: linux-btrfs <linux-btrfs@vger.kernel.org>
Cc: sunk67188@gmail.com
Subject: Newbie questions about DIR_ITEM and DIR_INDEX design
Date: Wed, 20 Aug 2025 21:59:58 +0800	[thread overview]
Message-ID: <12726025.O9o76ZdvQC@saltykitkat> (raw)

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



             reply	other threads:[~2025-08-20 14:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-20 13:59 Sun YangKai [this message]
2025-08-20 17:06 ` Newbie questions about DIR_ITEM and DIR_INDEX design Mark Harmstone
2025-08-21  8:26   ` Sun YangKai
2025-08-21  9:20     ` Mark Harmstone
2025-08-21 10:06       ` Sun YangKai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12726025.O9o76ZdvQC@saltykitkat \
    --to=sunk67188@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox