Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID...

50
Dateisysteme Quellen Dateisysteme Hochleistungs-Ein-/Ausgabe Michael Kuhn Wissenschaftliches Rechnen Fachbereich Informatik Universität Hamburg 2015-04-20 Michael Kuhn Dateisysteme 1 / 50

Transcript of Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID...

Page 1: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

DateisystemeHochleistungs-Ein-/Ausgabe

Michael Kuhn

Wissenschaftliches RechnenFachbereich InformatikUniversität Hamburg

2015-04-20

Michael Kuhn Dateisysteme 1 / 50

Page 2: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

1 DateisystemeOrientierungDateisystemeext4Object StoresDatenstrukturenLeistungsbewertungAusblick und Zusammenfassung

2 Quellen

Michael Kuhn Dateisysteme 2 / 50

Page 3: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Orientierung

E/A-Schichten

Anwendung

Bibliotheken

Speichergerät/-verbund

Paralleles verteiltes Dateisystem

Dateisystem

Abbildung: E/A-Schichten

Michael Kuhn Dateisysteme 3 / 50

Page 4: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Dateisysteme

Aufgabe

StrukturierungÜblicherweise Dateien und VerzeichnisseHierarchische OrganisationAndere Ansätze: Tagging

Verwaltung von Daten und MetadatenBlockallokationZugriffsrechte, Zeitstempel etc.

Dateisysteme nutzen ein darunter liegendes SpeichergerätOder einen SpeicherverbundLogical Volume Manager (LVM) und/oder mdadm

Michael Kuhn Dateisysteme 4 / 50

Page 5: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Dateisysteme

Beispiele

Linux: ext4, XFS, . . .

Windows: FAT, exFAT, NTFS

OS X: HFS+

Universal: ISO9660, . . .

Michael Kuhn Dateisysteme 5 / 50

Page 6: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Dateisysteme

Beispiele. . .

Netzwerk: NFS, AFS, Samba

Kryptographisch: EncFS, eCryptfs

Parallel verteilt: GPFS, Lustre, . . .

Pseudo: procfs, . . .

Setzen häufig auf darunterliegenden Dateisystemen auf

Michael Kuhn Dateisysteme 6 / 50

Page 7: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Dateisysteme

E/A-Operationen

1 fd = open("/path/to/file", O_RDWR | O_CREAT |↪→ O_TRUNC, S_IRUSR | S_IWUSR);

2 nb = write(fd, data, sizeof(data));3 rv = close(fd);4 rv = unlink("/path/to/file");

Listing 1: E/A über Low-Level-Funktionen

Initialer Zugriff über Pfad

Danach über File Descriptor (FD)

Michael Kuhn Dateisysteme 7 / 50

Page 8: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Dateisysteme

VFS

Virtual File System (Switch)Zentrale Dateisystemkomponente im Kernel

Standardisiertes Interface für alle Dateisysteme (POSIX)Gibt Dateisystemstruktur größtenteils vor

Leitet Anfragen der Anwendungen weiterBasierend auf dem Mountpoint

Michael Kuhn Dateisysteme 8 / 50

Page 9: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Dateisysteme

VFS. . .

Applications (Processes)

VFS

malloc

BIOs (Block I/O)

The Linux Storage Stack Diagramhttp://www.thomas-krenn.com/en/wiki/Linux_Storage_Stack_Diagram

Created by Werner Fischer and Georg SchönbergerLicense: CC-BY-SA 3.0, see http://creativecommons.org/licenses/by-sa/3.0/

ext2 ext3

btrfs

ext4

xfs ifsiso9660

...

NFS coda

Network FS

gfs ocfssmbfs ...

pseudo FS specialpurpose FSproc sysfs

futexfs

usbfs ...

tmpfs ramfs

devtmpfspipefs

network

mmap(anonymous pages)

block based FS

read

(2)

wri

te(2

)

op

en(2

)

stat(

2)

chm

od

(2)

...

PageCache

mdraid...

stackable

devices on top of “normal”block devices drbd

optional

LVM

BIOs (Block I/O)

ceph

struct bio- sector on disk

- bio_vec cnt- bio_vec index- bio_vec list

- sector cnt

direct I/O(O_DIRECT)

device mapperdm-crypt dm-mirror

dm-thindm-cache bcache

Abbildung: Virtual File System [3]

Michael Kuhn Dateisysteme 9 / 50

Page 10: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Dateisysteme

VFS. . .

Applications (Processes)

VFS

request-baseddevice mapper targets

dm-multipath

Physical devices

HDD SSD DVDdrive

MicronPCIe Card

LSIRAID

AdaptecRAID

QlogicHBA

EmulexHBA

malloc

BIOs (Block I/O)

sysfs(transport attributes)

SCSI upper level drivers

/dev/sda .../dev/sdb

SCSI low level driversmegaraid_sas

aacraid

qla2xxx ...libata

ahci ata_piix ... lpfc

Transport Classesscsi_transport_fc

scsi_transport_sas

scsi_transport_...

/dev/vd*

virtio_blk mtip32xx

/dev/rssd*

The Linux Storage Stack Diagramhttp://www.thomas-krenn.com/en/wiki/Linux_Storage_Stack_Diagram

Created by Werner Fischer and Georg SchönbergerLicense: CC-BY-SA 3.0, see http://creativecommons.org/licenses/by-sa/3.0/

ext2 ext3

btrfs

ext4

xfs ifsiso9660

...

NFS coda

Network FS

gfs ocfssmbfs ...

pseudo FS specialpurpose FSproc sysfs

futexfs

usbfs ...

tmpfs ramfs

devtmpfspipefs

network

nvmedevice

The Linux Storage Stack Diagramversion 3.17, 2014-10-17

outlines the Linux storage stack as of Kernel version 3.17

mmap(anonymous pages)

iscsi_tcp

network

null_blk/dev/rbd*

block based FS

read(2

)

wri

te(2

)

open(2

)

stat(

2)

chm

od(2

)

...

PageCache

mdraid...

stackable

devices on top of “normal”block devices drbd

optional

LVM

BIOs (Block I/O)

BIOs BIOs

Block Layer

multi queue

blkmq

SoftwareQueues

HardwareDispatchQueues

...

...

hooked in device drivers(they hook in like stackeddevices do)

BIOs

maps bios to requests

deadline

cfqnoop

I/O Scheduler

HardwareDispatchQueue

Requestbased Drivers

BIObased Drivers

Requestbased Drivers

rbd

ceph

struct bio- sector on disk

- bio_vec cnt- bio_vec index- bio_vec list

- sector cnt

Fibre

Channel

over

Eth

ern

et

LIO

target_core_mod

tcm

_fc

Fire

Wir

e

ISC

SI

direct I/O(O_DIRECT)

device mapper

network

iscs

i_ta

rget_

mod

sbp_t

arg

et

target_core_file

target_core_iblock

target_core_pscsi

vfs_writev, vfs_readv, ...

dm-crypt dm-mirror

dm-thindm-cache

tcm

_qla

2xxx

tcm

_usb

_gadget

USB

Fibre

Channel

tcm

_vh

ost

Vir

tual H

ost

nvme

/dev/nvme#n#

SCSI Mid Layer

virtio_pci

LSI 12GbsSAS HBA

mpt3sas

bcache

/dev/nullb*

vmw_pvscsi

/dev/skd*

skd

stecdevice

virtio_scsi

para-virtualizedSCSI

VMware'spara-virtualized

SCSI

Abbildung: E/A-Stack in Linux 3.17 [3]

Michael Kuhn Dateisysteme 10 / 50

Page 11: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Dateisysteme

Dateisystemobjekte

DateienEnthalten Daten in Form eines Byte-ArraysKönnen gelesen/geschrieben werden (explizit)Können in den Speicher gemappt werden (implizit)

VerzeichnisseEnthalten Dateien und VerzeichnisseZur Organisation des Namensraumes

Michael Kuhn Dateisysteme 11 / 50

Page 12: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Dateisysteme

Dateisystemobjekte. . .

InodesEnhalten MetadatenEigentliche Basisobjekte des DateisystemsÜblicherweise eindeutige IDs

Michael Kuhn Dateisysteme 12 / 50

Page 13: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Dateisysteme

Dateien

1 nb = pwrite(fd, data, sizeof(data), 42);2 nb = pread(fd, data, sizeof(data), 42);

Listing 2: Expliziter Zugriff

pwrite und pread verhalten sich wie write bzw. readExplizite Angabe des Offsets

Zugriff über File Descriptor

Michael Kuhn Dateisysteme 13 / 50

Page 14: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Dateisysteme

Dateien. . .

1 char* pt = mmap(NULL, FILE_SIZE, PROT_READ |↪→ PROT_WRITE, MAP_SHARED, fd, 0);

2 memcpy(pt + 42, data, sizeof(data));3 memcpy(data, pt + 42, sizeof(data));4 munmap(pt, sizeof(data));

Listing 3: Impliziter Zugriff

mmap erlaubt es eine Datei in den Speicher einzublendenDatei beginnt an Adresse pt

Zugriff wie auf andere SpeicherobjekteZ.B. via memcpy oder direkte Zuweisung

Michael Kuhn Dateisysteme 14 / 50

Page 15: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Dateisysteme

Verzeichnisse

Inode Größe Namenslänge Dateityp Name23 10 2 2 .\0

24 11 3 2 ..\0...

......

......

42 14 6 1 hello\0

43 14 6 2 world\0

Abbildung: ext4-Verzeichniseintrag [1]

Traditionell lineares ArrayLangsam, da über das komplette Array iteriert werden muss

Heutzutage eher Baumstrukturen

Michael Kuhn Dateisysteme 15 / 50

Page 16: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Dateisysteme

Inodes

Feldgröße Inhalt

2 Bytes Berechtigungen2 Bytes Benutzer-ID4 Bytes Dateigröße4 Bytes Zugriffszeit4 Bytes Inode-Änderungszeit4 Bytes Datenänderungszeit4 Bytes Löschzeit2 Bytes Gruppen-ID2 Bytes Linkzahl

......

60 Bytes Blockzeiger, Extent-Baum oder Inline-Daten...

...4 Bytes Versionsnummer100 Bytes Freier Speicher

Abbildung: ext4-Inode (256 Bytes) [1]

Michael Kuhn Dateisysteme 16 / 50

Page 17: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Dateisysteme

Inodes. . .

Kompliziert durch RückwärtskompatibilitätViele Felder sind aufgeteilt

Zeitstempel: 4 Bytes für Sekunden seit 1970, 4 Bytes fürNanosekundenauflösungGröße: Obere und untere 4 Bytes

Felder mehrfach überladenBlockzeiger, Extent-Baum oder Inline-Daten (falls Dateikleiner als 60 Bytes)100 Bytes am Inode-Ende für erweiterte Attribute

Michael Kuhn Dateisysteme 17 / 50

Page 18: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Dateisysteme

Inodes. . .

1 $ touch foo2 $ ls -l foo3 -rw-r--r--. 1 u g 0 19. Apr 18:48 foo4 $ ln foo bar5 $ ls -l foo bar6 -rw-r--r--. 2 u g 0 19. Apr 18:48 bar7 -rw-r--r--. 2 u g 0 19. Apr 18:48 foo8 $ stat --format=%i foo bar9 641174

10 64117411 $ rm foo12 $ ls -l bar13 -rw-r--r--. 1 u g 0 19. Apr 18:48 bar

Listing 4: Inode vs. Datei

Michael Kuhn Dateisysteme 18 / 50

Page 19: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Dateisysteme

POSIX-Schnittstelle

open, close, creat

read, write, lseek

chmod, chown, stat

link, unlink

. . .

Michael Kuhn Dateisysteme 19 / 50

Page 20: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

ext4

ext4

Standard-Dateisystem in vielen Linux-DistributionenEingeführt 2006, stabil 2008Vorgänger: ext, ext2, ext3

Statische Festlegung bei DateisystemerzeugungInode-ZahlBlockgröße

Michael Kuhn Dateisysteme 20 / 50

Page 21: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

ext4

ext

Erstes Dateisystem speziell für LinuxNutzte als erstes Dateisystem die VFS-Schicht

Inspiriert vom Unix File System (UFS)Beseitigte Beschränkungen des MINIX-Dateisystems

Dateigrößen bis 2 GBDateinamen bis 255 Zeichen

Michael Kuhn Dateisysteme 21 / 50

Page 22: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

ext4

ext2

Separate Zeitstempel für Zugriff undInode-/Datenänderung

Datenstrukturen für zukünftige Erweiterungen ausgelegtTestumgebung für neue VFS-Funktionen

Access Control Lists (ACLs)Erweiterte Attribute

Michael Kuhn Dateisysteme 22 / 50

Page 23: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

ext4

ext3

Journaling

Dateisystemvergrößerung zur Laufzeit

H-Baum für größere Verzeichnisse

Michael Kuhn Dateisysteme 23 / 50

Page 24: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

ext4

ext4

Größere Dateisysteme, Dateien und Verzeichnisse

Extents

Preallokation, verzögerte Allokation und verbesserteMultiblockallokation

Journal-Prüfsummen

Schnellere Dateisystemüberprüfung

Nanosekunden-Zeitstempel

Unterstützung für TRIM

Michael Kuhn Dateisysteme 24 / 50

Page 25: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

ext4

ext4. . .

Inhalt GrößePadding (Blockgruppe 0) 1.024 BytesSuperblock 1 BlockGruppenbeschreibung n BlöckeReservierte GDT-Blöcke m BlöckeDaten-Bitmap 1 BlockInode-Bitmap 1 BlockInode-Tabelle k BlöckeDaten-Blöcke l Blöcke

Abbildung: ext4-Blockgruppe [1]

Michael Kuhn Dateisysteme 25 / 50

Page 26: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

ext4

ext4. . .

Blockgröße 1 KiB 2 KiB 4 KiB 64 KiBBlöcke 264 264 264 264

Inodes 232 232 232 232

Dateisystemgröße 16 ZiB 32 ZiB 64 ZiB 1 YiBDateigröße (Extents) 4 TiB 8 TiB 16 TiB 256 TiBDateigröße (Blöcke) 16 GiB 256 GiB 4 TiB 256 PiB

Abbildung: ext4-Limits im 64-Bit-Modus [1]

Michael Kuhn Dateisysteme 26 / 50

Page 27: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

ext4

Allokation

BlockbasiertViele Blöcke gleicher Größe (üblicherweise 4 KiB)Zeiger auf Blöcke

Direkt, indirekt, doppelt indirekt, dreifach indirekt

Michael Kuhn Dateisysteme 27 / 50

Page 28: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

ext4

Allokation. . .

Abbildung: Block-Zeiger [2]

Michael Kuhn Dateisysteme 28 / 50

Page 29: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

ext4

Allokation. . .

ExtentbasiertWenige möglichst große Extents

Vier Extents können im Inode gespeichert werdenMehr in einer Baumstruktur und zusätzlichen Blöcken

Zeiger auf Startblock und LängeMaximale Länge: 32.768 BlöckeEntspricht 128 MiB bei einer Blockgröße von 4 KiB

Michael Kuhn Dateisysteme 29 / 50

Page 30: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

ext4

Allokation. . .

BlockallokationVersuche zusammenhängende Blöcke zu allokierenVersuche Blöcke in derselben Blockgruppe zu allokieren

Multiblockallokation und verzögerte AllokationSpekulativ 8 KiB bei Dateierzeugung allokierenAllokation wird erst durchgeführt, wenn Blöcke auf dasSpeichergerät geschrieben werden müssen

Michael Kuhn Dateisysteme 30 / 50

Page 31: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

ext4

Allokation. . .

Dateien und VerzeichnisseBlöcke möglichst in der Blockgruppe des Inodes allokierenDateien möglichst in der Blockgruppe des Verzeichnissesallokieren

Michael Kuhn Dateisysteme 31 / 50

Page 32: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

ext4

Sparse-Dateien und Preallokation

Sparse-Dateien: Dateien mit „Löchern“Z.B. mit lseek oder truncateEffiziente Speicherung von Dateien mit vielen 0-Bytes

1 $ truncate --size=1G dummy2 $ ls -lh dummy3 -rw-r--r--. 1 u g 1,0G 18. Apr 23:49 dummy4 $ du -h dummy5 0 dummy

Listing 5: Erzeugung einer Sparse-Datei

Michael Kuhn Dateisysteme 32 / 50

Page 33: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

ext4

Sparse-Dateien und Preallokation. . .

Preallokation: Speicher vorallokierenMit fallocate bzw. posix_fallocateVerhindert Fragmentierung bei vielen Dateivergrößerungen

1 $ fallocate --length $((1024 * 1024 * 1024)) dummy2 $ ls -lh dummy3 -rw-r--r--. 1 u g 1,0G 19. Apr 19:14 dummy4 $ du -h dummy5 1,1G dummy

Listing 6: Preallokation einer Datei

Michael Kuhn Dateisysteme 33 / 50

Page 34: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

ext4

Journaling

Journaling zur Sicherung der Konsistenz des Dateisystems

Dateisystemoperationen benötigen mehrere SchritteZ.B. das Löschen einer Datei

1 Entfernen des Verzeichniseintrags2 Freigeben des Inodes3 Freigeben der Datenblöcke

Problematisch im Fall eines Absturzes

Michael Kuhn Dateisysteme 34 / 50

Page 35: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

ext4

Journaling. . .

Geplante Änderungen werden ins Journal eingetragenEntfernen wenn Operation vollständig durchgeführt

Bei der anschließenden DateisystemüberprüfungÄnderungen wiederholen oderÄnderungen verwerfen

Unterschiedliche ModiMetadaten-Journaling und volles Journaling

Michael Kuhn Dateisysteme 35 / 50

Page 36: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

ext4

Journaling. . .

Journal: Alle Änderungen werden ins Journal geschriebenOrdered: Metadaten werden ins Journal geschrieben

Daten vor MetadatenProblematisch mit verzögerter Allokation

Writeback: Metadaten werden ins Journal geschriebenReihenfolge beliebig

Michael Kuhn Dateisysteme 36 / 50

Page 37: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Object Stores

Funktionen

„Dateisystem light“Dünne Abstraktionsschicht über SpeichergerätenObjektbasierter Zugriff auf Daten

Nur GrundoperationenErstellen, Öffnen, Schließen, Lesen, Schreiben

Manchmal Object SetsKönnen benutzt werden um verwandte Objekte zugruppieren

Michael Kuhn Dateisysteme 37 / 50

Page 38: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Object Stores

Funktionen. . .

Üblicherweise keine PfadeZugriff über eindeutige IDsKein Overhead durch Pfadauflösung

Block-/Extent-AllokationAuf unterschiedlichen Abstraktionsebenen verfügbar

Cloudspeicher, Festplatte

Michael Kuhn Dateisysteme 38 / 50

Page 39: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Object Stores

Schichtung

Object Stores können als Unterbau für Dateisystemegenutzt werden

Erlaubt Konzentration auf DateisystemfunktionalitätSpeicherverwaltung durch separate Schicht

Bei lokalen Dateisystemen nicht sinnvollFunktionalität größtenteils durch POSIX vorgegebenHauptunterschied ist Blockallokation

Sehr sinnvoll für parallele verteilte DateisystemeKein redundanter Dateisystem-Overhead

Michael Kuhn Dateisysteme 39 / 50

Page 40: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Datenstrukturen

B-Baum vs. B+-Baum

7 16

9 121 2 18 215 6

Abbildung: B-Baum [4]

7 16

9 121 2 18 215 6 7 16

Abbildung: B+-Baum [4]

Michael Kuhn Dateisysteme 40 / 50

Page 41: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Datenstrukturen

B-Baum vs. B+-Baum. . .

B-BaumVerallgemeinerter BinärbaumOptimiert für Systeme, die große Blöcke lesen/schreibenZeiger und Daten gemischt

B+-BaumDaten nur in BlätternVorteilhaft für Caching, da einfacher alle Knoten zu cachenBenutzt in NTFS, XFS, . . .

Michael Kuhn Dateisysteme 41 / 50

Page 42: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Datenstrukturen

H-Baum

Basiert auf B-Baum

Andere Behandlung von Hash-Kollisionen

Benutzt in ext3 und ext4

Michael Kuhn Dateisysteme 42 / 50

Page 43: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Leistungsbewertung

Leistungsbewertung

Dateisystemleistung ist schwierig zu bewertenViele unterschiedliche FaktorenDaten- vs. MetadatenleistungLeistung unterschiedlicher FunktionenLeistung für spezifische Anforderungen messen

Datensicherheit kostet üblicherweise LeistungVolles Journaling, Prüfsummen etc.

Michael Kuhn Dateisysteme 43 / 50

Page 44: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Leistungsbewertung

Kernel- vs. Userspace

Dateisysteme üblicherweise direkt im Kernel implementiertHoher Wartungsaufwand

Alternative: Filesystem in Userspace (FUSE)Besteht aus Kernelmodul und BibliothekEntwicklung von Dateisystemen als normale Prozesse

Michael Kuhn Dateisysteme 44 / 50

Page 45: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Leistungsbewertung

Kernel- vs. Userspace. . .

libfuse

glibcglibc

FUSE

Ext3

...

VFS

ls -l /tmp/fuse

./hello /tmp/fuse

Kernel

Userspace

NFS

Abbildung: FUSE [5]

Umleitung in Userspace durch VFS und FUSE-ModulGeringere Leistung durch Kontextwechsel

Michael Kuhn Dateisysteme 45 / 50

Page 46: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Ausblick und Zusammenfassung

Ausblick

Moderne Dateisysteme integrieren zusätzliche FunktionenVolumenverwaltung, Prüfsummen, Schnappschüsse, . . .

Basis für parallele verteilte DateisystemeObject Stores besser geeignet

Michael Kuhn Dateisysteme 46 / 50

Page 47: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Ausblick und Zusammenfassung

Zusammenfassung

Dateisysteme organisieren Daten und MetadatenÜblicherweise standardisierte Schnittstelle

Hauptobjekte sind Dateien und VerzeichnisseInodes speichern Metadaten

Neue Techniken zur EffizienzsteigerungJournaling um Konsistenz sicherzustellenSpeicherallokation mit Hilfe von ExtentsBaumstrukturen für skalierbaren Zugriff

Michael Kuhn Dateisysteme 47 / 50

Page 48: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

1 DateisystemeOrientierungDateisystemeext4Object StoresDatenstrukturenLeistungsbewertungAusblick und Zusammenfassung

2 Quellen

Michael Kuhn Dateisysteme 48 / 50

Page 49: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Quellen I

[1] djwong. Ext4 Disk Layout. https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout.

[2] Hal Pomeranz. Understanding Indirect Blocks in Unix FileSystems. http://digital-forensics.sans.org/blog/2008/12/24/understanding-indirect-blocks-in-unix-file-systems.

[3] Werner Fischer and Georg Schönberger. Linux Storage StackDiagramm. https://www.thomas-krenn.com/de/wiki/Linux_Storage_Stack_Diagramm.

[4] Wikipedia. B-tree.http://en.wikipedia.org/wiki/B-tree.

Michael Kuhn Dateisysteme 49 / 50

Page 50: Dateisysteme - Hochleistungs-Ein-/Ausgabe · 2018. 1. 24. · PCIe Card LSI RAID Adaptec RAID Qlogic HBA Emulex HBA malloc BIOs (Block I/O) sysfs (transport attributes) SCSI upper

Dateisysteme Quellen

Quellen II

[5] Wikipedia. Filesystem in Userspace. http://en.wikipedia.org/wiki/Filesystem_in_Userspace.

Michael Kuhn Dateisysteme 50 / 50