---
name: "__generic_file_write_iter"
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/__generic_file_write_iter"
---

# \_\_generic\_file\_write\_iter(9)

write data to a file

## NAME

\_\_generic\_file\_write\_iter - write data to a file

## SYNOPSIS

**ssize\_t \_\_generic\_file\_write\_iter(struct kiocb \*** *iocb***, struct iov\_iter \*** *from***);**

## ARGUMENTS

*iocb*

IO state structure (file, offset, etc.)

*from*

iov\_iter with data to write

## DESCRIPTION

This function does all the work needed for actually writing data to a file. It does all basic checks, removes SUID from the file, updates modification times and calls proper subroutines depending on whether we do direct IO or a standard buffered write.

It expects i\_mutex to be grabbed unless we work on a block device or similar object which does not need locking at all.

This function does \*not\* take care of syncing data in case of O\_SYNC write. A caller has to handle it. This is mainly due to the fact that we want to avoid syncing under i\_mutex.

## COPYRIGHT
