Skip to content

Commit c12beff

Browse files
committed
lq: direct xattr parser
1 parent fbe666d commit c12beff

2 files changed

Lines changed: 160 additions & 128 deletions

File tree

src/include/mdt_scanner.hpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,12 @@ class MDTScanner {
272272
//! Ensure the reusable xattr block buffer matches the current filesystem's block size
273273
void EnsureXattrBlockBuffer();
274274

275+
//! Clear per-inode cached xattr state
276+
void InvalidateBufferedXattrState();
277+
278+
//! Load the current inode's external EA block into the reusable buffer
279+
bool LoadBufferedExternalXattrBlock();
280+
275281
//! Fast path for skip_no_fid/skip_no_linkea without opening a full xattr handle
276282
bool PassesXattrSkipChecksFast(ext2_ino_t ino, const MDTScanConfig &config);
277283

@@ -282,6 +288,15 @@ class MDTScanner {
282288
//! Read a prefix of an external EA inode value into the caller-provided buffer
283289
bool ReadExternalXattrPrefix(ext2_ino_t value_ino, void *buf, unsigned int wanted, unsigned int &got);
284290

291+
//! Read the prefix of a buffered xattr value into a caller-provided scratch buffer when needed
292+
bool ReadBufferedXattrPrefix(uint8_t name_index, const char *short_name, size_t short_name_len,
293+
void *scratch, unsigned int wanted, const uint8_t *&value_ptr, size_t &value_len);
294+
295+
//! Direct parsers for lustre_inodes that avoid ext2_xattr_handle allocations
296+
bool ParseBufferedFID(LustreFID &fid);
297+
bool ParseBufferedSOM(uint64_t &size, uint64_t &blocks);
298+
bool HasBufferedLinkEA();
299+
285300
//===----------------------------------------------------------------------===//
286301
// Lustre Extended Attribute Parsing
287302
//===----------------------------------------------------------------------===//
@@ -311,6 +326,8 @@ class MDTScanner {
311326
std::vector<char> inode_buffer_;
312327
std::vector<char> xattr_block_buffer_;
313328
ext2_ino_t buffered_inode_ = 0;
329+
bool buffered_xattr_block_loaded_ = false;
330+
bool buffered_xattr_block_valid_ = false;
314331

315332
// For parallel block group scanning
316333
std::atomic<int> next_block_group_;

0 commit comments

Comments
 (0)