diff options
author | Ian Abbott <abbotti@mev.co.uk> | 2012-09-05 12:44:31 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2012-09-06 10:20:39 -0400 |
commit | 5eec54fcde7e065eb3d8a6e70e61d90673ca706b (patch) | |
tree | b5946eb5ad36a2121334e38a1ccf417fa8babd14 /fs/udf/file.c | |
parent | 3f6bba823767e3c78efcf1bea5b6fdf98ad80e3b (diff) |
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>
Diffstat (limited to 'fs/udf/file.c')
-rw-r--r-- | fs/udf/file.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/udf/file.c b/fs/udf/file.c index d1c6093fd3d3..77b5953eaac8 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c | |||
@@ -118,11 +118,20 @@ static int udf_adinicb_write_end(struct file *file, | |||
118 | return simple_write_end(file, mapping, pos, len, copied, page, fsdata); | 118 | return simple_write_end(file, mapping, pos, len, copied, page, fsdata); |
119 | } | 119 | } |
120 | 120 | ||
121 | static ssize_t udf_adinicb_direct_IO(int rw, struct kiocb *iocb, | ||
122 | const struct iovec *iov, | ||
123 | loff_t offset, unsigned long nr_segs) | ||
124 | { | ||
125 | /* Fallback to buffered I/O. */ | ||
126 | return 0; | ||
127 | } | ||
128 | |||
121 | const struct address_space_operations udf_adinicb_aops = { | 129 | const struct address_space_operations udf_adinicb_aops = { |
122 | .readpage = udf_adinicb_readpage, | 130 | .readpage = udf_adinicb_readpage, |
123 | .writepage = udf_adinicb_writepage, | 131 | .writepage = udf_adinicb_writepage, |
124 | .write_begin = udf_adinicb_write_begin, | 132 | .write_begin = udf_adinicb_write_begin, |
125 | .write_end = udf_adinicb_write_end, | 133 | .write_end = udf_adinicb_write_end, |
134 | .direct_IO = udf_adinicb_direct_IO, | ||
126 | }; | 135 | }; |
127 | 136 | ||
128 | static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | 137 | static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov, |