UDF: Add support for O_DIRECT
Add support for the O_DIRECT flag. There are two cases to deal with: 1. Small files stored in the ICB (inode control block?): just return 0 from the new udf_adinicb_direct_IO() handler to fall back to buffered I/O. 2. Larger files, not stored in the ICB: nothing special here. Just call blockdev_direct_IO() from our new udf_direct_IO() handler and tidy up any blocks instantiated outside i_size on error. This is pretty standard. Factor error handling code out of udf_write_begin() into new function udf_write_failed() so it can also be called by udf_direct_IO(). Also change the whitespace in udf_aops to make it a bit neater. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
@ -118,11 +118,20 @@ static int udf_adinicb_write_end(struct file *file,
|
||||
return simple_write_end(file, mapping, pos, len, copied, page, fsdata);
|
||||
}
|
||||
|
||||
static ssize_t udf_adinicb_direct_IO(int rw, struct kiocb *iocb,
|
||||
const struct iovec *iov,
|
||||
loff_t offset, unsigned long nr_segs)
|
||||
{
|
||||
/* Fallback to buffered I/O. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct address_space_operations udf_adinicb_aops = {
|
||||
.readpage = udf_adinicb_readpage,
|
||||
.writepage = udf_adinicb_writepage,
|
||||
.write_begin = udf_adinicb_write_begin,
|
||||
.write_end = udf_adinicb_write_end,
|
||||
.direct_IO = udf_adinicb_direct_IO,
|
||||
};
|
||||
|
||||
static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
|
||||
|
Reference in New Issue
Block a user