---
title: FSVolume.PreallocateHandler
framework: fskit
role: symbol
role_heading: Protocol
path: fskit/fsvolume/preallocatehandler
---

# FSVolume.PreallocateHandler

Methods and properties implemented by volumes that want to offer preallocation functions.

## Declaration

```swift
protocol PreallocateHandler : NSObjectProtocol
```

## Overview

Overview A preallocation operation allocates space for a file without writing to it yet. A file system may use reallocation to avoid performing space allocation while in the midst of I/O; this strategy improves performance. Also, if the expected I/O pattern is many small writes, preallocating contiguous chunks may prevent fragmenting the file system. This process can improve performance later. In a kernel-based file system, you typically preallocate space with the VNOP_ALLOCATE operation, called from fcntl(F_PREALLOCATE). important: This protocol replaces the FSVolume.PreallocateOperations protocol. It exposes the same functionality, while using the FSPreallocateResult object. This objects adds the ability to reply with FSItem.Attributes and free space from preallocateSpace(for:at:length:flags:context:replyHandler:).

## Topics

### Preallocating space

- [preallocateSpace(for:at:length:flags:context:replyHandler:)](fskit/fsvolume/preallocatehandler/preallocatespace(for:at:length:flags:context:replyhandler:).md)
- [FSVolume.PreallocateFlags](fskit/fsvolume/preallocateflags.md)
- [FSPreallocateResult](fskit/fspreallocateresult.md)

### Inspecting volume properties

- [isPreallocateInhibited](fskit/fsvolume/preallocatehandler/ispreallocateinhibited.md)

## Relationships

### Inherits From

- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Implementing optional handlers

- [FSVolume.OpenCloseHandler](fskit/fsvolume/openclosehandler.md)
- [FSVolume.ReadWriteHandler](fskit/fsvolume/readwritehandler.md)
- [FSVolume.AccessCheckHandler](fskit/fsvolume/accesscheckhandler.md)
- [FSVolume.RenameHandler](fskit/fsvolume/renamehandler.md)
- [FSVolume.XattrHandler](fskit/fsvolume/xattrhandler.md)
- [FSVolume.ItemDeactivationHandler](fskit/fsvolume/itemdeactivationhandler.md)
- [FSVolume.KernelOffloadedIOHandler](fskit/fsvolume/kerneloffloadediohandler.md)
- [FSVolume.DataCacheHandler](fskit/fsvolume/datacachehandler.md)
- [FSVolume.SeekRegionHandler](fskit/fsvolume/seekregionhandler.md)
