---
name: "__generic_file_aio_write"
section: "9"
platform: "linux"
package: "linux-manual-3.2"
version: "3.2.78-1"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/__generic_file_aio_write"
---

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

write data to a file

## NAME

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

## SYNOPSIS

**ssize\_t \_\_generic\_file\_aio\_write(struct kiocb \*** *iocb***, const struct iovec \*** *iov***, unsigned long** *nr\_segs***, loff\_t \*** *ppos***);**

## ARGUMENTS

*iocb*

IO state structure (file, offset, etc.)

*iov*

vector with data to write

*nr\_segs*

number of segments in the vector

*ppos*

position where 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
