Skip to content

Commit

Permalink
Facebook: [hypernode][oly2] nvme format with T10-DIX enabled if suppo…
Browse files Browse the repository at this point in the history
…rted by device

Summary:
We want to enable T10-DIX support during nvme format for drives that support it. As of today, we were doing it only for a list of specific model Ids (currently all OLY2.0). As different models for OLY2.x are added to the fleet, we need to keep updating this list with model Ids that support T10-DIX.

This diff checks if a drive supports t10dix in the way we want and enables it if it does.

Differential Revision: D64211281

fbshipit-source-id: 17c6a0be38b9c8cc15cfef5e7b632334099e66b4
  • Loading branch information
Kumar Amit authored and facebook-github-bot committed Oct 21, 2024
1 parent c893e7a commit e37992e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions cookbooks/fb_storage/libraries/storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1350,6 +1350,32 @@ def gen_fb_fstab(node)
fstab
end

def self.oly2_host?(node)
node.in_fbwhoami?('server_type', 'TYPE_VIII_MATER') && node.in_fbwhoami?('CPU_ARCHITECTURE', 'sierraforest')
end

def self.get_t10dix_lbaf(device)
nsid_out = Mixlib::ShellOut.new("nvme id-ns #{device} -ojson").run_command
nsid_out.error!
nsid_json = JSON.parse(nsid_out.stdout)

# Details about output of the nvme id-ns command and it's associated structures/sub-structures can be found here:
# https://manpages.ubuntu.com/manpages/oracular/en/man2/nvme_id_ns.2.html
# More details about the bitmask values used can be bound here:
# https://github.com/torvalds/linux/blob/master/include/linux/nvme.h

# Find LBA format with metadata size 64 bytes and data size 2^12 = 4KB
lbaf = nsid_json['lbafs'].find_index { |item| item['ms'] == 64 && item['ds'] == 12 }
# Ensure Protection Information (PI) Type 3 is supported and PI is transferred as the last 8 bytes of the metadata
dpc_valid = (nsid_json['dpc'] & (1 << 2) != 0 && nsid_json['dpc'] & (1 << 4) != 0)

if lbaf != -1 && dpc_valid
return lbaf
else
return -1
end
end

private

# we make an instance method that calls a class method for easier testing
Expand Down

0 comments on commit e37992e

Please sign in to comment.