---
name: "truncate_setsize"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/truncate_setsize"
---

# truncate\_setsize(9)

update inode and pagecache for a new file size

## NAME

truncate\_setsize - update inode and pagecache for a new file size

## SYNOPSIS

**void truncate\_setsize(struct inode \*** *inode***, loff\_t** *newsize***);**

## ARGUMENTS

*inode*

inode

*newsize*

new file size

## DESCRIPTION

truncate\_setsize updates i\_size and performs pagecache truncation (if necessary) to *newsize*. It will be typically be called from the filesystem's setattr function when ATTR\_SIZE is passed in.

Must be called with a lock serializing truncates and writes (generally i\_mutex but e.g. xfs uses a different lock) and before all filesystem specific block truncation has been performed.

## COPYRIGHT
