26 #include <linux/capability.h>
28 #include <linux/types.h>
29 #include <linux/slab.h>
32 #include <linux/uio.h>
33 #include <linux/sched.h>
37 #include <linux/falloc.h>
83 static void ocfs2_free_file_private(
struct inode *inode,
struct file *file)
96 static int ocfs2_file_open(
struct inode *inode,
struct file *file)
102 trace_ocfs2_file_open(inode, file, file->
f_path.dentry,
103 (
unsigned long long)OCFS2_I(inode)->
ip_blkno,
104 file->
f_path.dentry->d_name.len,
105 file->
f_path.dentry->d_name.name, mode);
128 status = ocfs2_init_file_private(inode, file);
143 static int ocfs2_file_release(
struct inode *inode,
struct file *file)
151 trace_ocfs2_file_release(inode, file, file->
f_path.dentry,
153 file->
f_path.dentry->d_name.len,
154 file->
f_path.dentry->d_name.name,
158 ocfs2_free_file_private(inode, file);
163 static int ocfs2_dir_open(
struct inode *inode,
struct file *file)
165 return ocfs2_init_file_private(inode, file);
168 static int ocfs2_dir_release(
struct inode *inode,
struct file *file)
170 ocfs2_free_file_private(inode, file);
174 static int ocfs2_sync_file(
struct file *file, loff_t
start, loff_t
end,
179 struct inode *inode = file->
f_mapping->host;
182 trace_ocfs2_sync_file(inode, file, file->
f_path.dentry,
183 OCFS2_I(inode)->ip_blkno,
184 file->
f_path.dentry->d_name.len,
185 file->
f_path.dentry->d_name.name,
186 (
unsigned long long)datasync);
208 journal = osb->
journal->j_journal;
216 return (err < 0) ? -
EIO : 0;
225 if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb))
263 struct buffer_head *bh)
271 if (IS_ERR(handle)) {
272 ret = PTR_ERR(handle);
300 static int ocfs2_set_inode_size(handle_t *
handle,
302 struct buffer_head *fe_bh,
307 i_size_write(inode, new_i_size);
308 inode->
i_blocks = ocfs2_inode_sector_count(inode);
322 struct buffer_head *di_bh,
327 handle_t *handle =
NULL;
330 if (IS_ERR(handle)) {
331 ret = PTR_ERR(handle);
336 ret = ocfs2_set_inode_size(handle, inode, di_bh,
346 static int ocfs2_cow_file_pos(
struct inode *inode,
347 struct buffer_head *fe_bh,
352 unsigned int num_clusters = 0;
360 if ((offset & (
OCFS2_SB(inode->
i_sb)->s_clustersize - 1)) == 0)
364 &num_clusters, &ext_flags);
379 static int ocfs2_orphan_for_truncate(
struct ocfs2_super *osb,
381 struct buffer_head *fe_bh,
394 status = ocfs2_cow_file_pos(inode, fe_bh, new_i_size);
404 if (IS_ERR(handle)) {
405 status = PTR_ERR(handle);
420 cluster_bytes = ocfs2_align_bytes_to_clusters(inode->
i_sb, new_i_size);
428 i_size_write(inode, new_i_size);
444 static int ocfs2_truncate_file(
struct inode *inode,
445 struct buffer_head *di_bh,
456 trace_ocfs2_truncate_file((
unsigned long long)OCFS2_I(inode)->ip_blkno,
458 (
unsigned long long)new_i_size);
461 "Inode %llu, inode i_size = %lld != di "
462 "i_size = %llu, i_flags = 0x%x\n",
463 (
unsigned long long)OCFS2_I(inode)->ip_blkno,
469 trace_ocfs2_truncate_file_error(
471 (
unsigned long long)new_i_size);
485 &OCFS2_I(inode)->ip_la_data_resv);
499 i_size_read(inode), 1);
503 goto bail_unlock_sem;
510 status = ocfs2_orphan_for_truncate(osb, inode, di_bh, new_i_size);
513 goto bail_unlock_sem;
519 goto bail_unlock_sem;
524 up_write(&OCFS2_I(inode)->ip_alloc_sem);
527 if (!status && OCFS2_I(inode)->ip_clusters == 0)
548 struct buffer_head *fe_bh,
559 clusters_to_add, mark_unwritten,
560 data_ac, meta_ac, reason_ret);
565 static int __ocfs2_extend_allocation(
struct inode *inode,
u32 logical_start,
566 u32 clusters_to_add,
int mark_unwritten)
569 int restart_func = 0;
572 struct buffer_head *bh =
NULL;
574 handle_t *handle =
NULL;
586 BUG_ON(mark_unwritten && !ocfs2_sparse_alloc(osb));
606 credits = ocfs2_calc_extend_credits(osb->
sb, &fe->
id2.
i_list,
609 if (IS_ERR(handle)) {
610 status = PTR_ERR(handle);
616 restarted_transaction:
617 trace_ocfs2_extend_allocation(
618 (
unsigned long long)OCFS2_I(inode)->ip_blkno,
619 (
unsigned long long)i_size_read(inode),
623 status = dquot_alloc_space_nodirty(inode,
624 ocfs2_clusters_to_bytes(osb->
sb, clusters_to_add));
639 prev_clusters = OCFS2_I(inode)->ip_clusters;
651 if ((status < 0) && (status != -
EAGAIN)) {
659 spin_lock(&OCFS2_I(inode)->ip_lock);
660 clusters_to_add -= (OCFS2_I(inode)->ip_clusters - prev_clusters);
661 spin_unlock(&OCFS2_I(inode)->ip_lock);
663 dquot_free_space(inode,
664 ocfs2_clusters_to_bytes(osb->
sb, clusters_to_add));
675 credits = ocfs2_calc_extend_credits(osb->
sb,
686 goto restarted_transaction;
690 trace_ocfs2_extend_allocation_end(OCFS2_I(inode)->ip_blkno,
693 OCFS2_I(inode)->ip_clusters,
694 (
unsigned long long)i_size_read(inode));
697 if (status < 0 && did_quota)
698 dquot_free_space(inode,
699 ocfs2_clusters_to_bytes(osb->
sb, clusters_to_add));
712 if ((!status) && restart_func) {
726 static handle_t *ocfs2_zero_start_ordered_transaction(
struct inode *inode)
729 handle_t *handle =
NULL;
732 if (!ocfs2_should_order_data(inode))
736 if (IS_ERR(handle)) {
742 ret = ocfs2_jbd2_file_inode(handle, inode);
750 handle = ERR_PTR(ret);
758 static int ocfs2_write_zero_page(
struct inode *inode,
u64 abs_from,
764 handle_t *handle =
NULL;
766 unsigned zero_from, zero_to, block_start, block_end;
768 BUG_ON(abs_from >= abs_to);
769 BUG_ON(abs_to > (((
u64)index + 1) << PAGE_CACHE_SHIFT));
785 trace_ocfs2_write_zero_page(
786 (
unsigned long long)OCFS2_I(inode)->ip_blkno,
787 (
unsigned long long)abs_from,
788 (
unsigned long long)abs_to,
789 index, zero_from, zero_to);
792 for (block_start = zero_from; block_start < zero_to;
793 block_start = block_end) {
794 block_end = block_start + (1 << inode->
i_blkbits);
809 handle = ocfs2_zero_start_ordered_transaction(inode);
810 if (IS_ERR(handle)) {
811 ret = PTR_ERR(handle);
848 static int ocfs2_zero_extend_get_range(
struct inode *inode,
849 struct buffer_head *di_bh,
850 u64 zero_start,
u64 zero_end,
853 int rc = 0, needs_cow = 0;
854 u32 p_cpos, zero_clusters = 0;
856 zero_start >>
OCFS2_SB(inode->
i_sb)->s_clustersize_bits;
857 u32 last_cpos = ocfs2_clusters_for_bytes(inode->
i_sb, zero_end);
858 unsigned int num_clusters = 0;
859 unsigned int ext_flags = 0;
861 while (zero_cpos < last_cpos) {
863 &num_clusters, &ext_flags);
870 zero_clusters = num_clusters;
876 zero_cpos += num_clusters;
878 if (!zero_clusters) {
883 while ((zero_cpos + zero_clusters) < last_cpos) {
885 &p_cpos, &num_clusters,
892 if (!p_cpos || (ext_flags & OCFS2_EXT_UNWRITTEN))
896 zero_clusters += num_clusters;
898 if ((zero_cpos + zero_clusters) > last_cpos)
899 zero_clusters = last_cpos - zero_cpos;
910 *range_start = ocfs2_clusters_to_bytes(inode->
i_sb, zero_cpos);
911 *range_end = ocfs2_clusters_to_bytes(inode->
i_sb,
912 zero_cpos + zero_clusters);
922 static int ocfs2_zero_extend_range(
struct inode *inode,
u64 range_start,
929 trace_ocfs2_zero_extend_range(
930 (
unsigned long long)OCFS2_I(inode)->ip_blkno,
931 (
unsigned long long)range_start,
932 (
unsigned long long)range_end);
933 BUG_ON(range_start >= range_end);
935 while (zero_pos < range_end) {
937 if (next_pos > range_end)
938 next_pos = range_end;
939 rc = ocfs2_write_zero_page(inode, zero_pos, next_pos);
960 u64 zero_start, range_start = 0, range_end = 0;
963 zero_start = ocfs2_align_bytes_to_blocks(sb, i_size_read(inode));
964 trace_ocfs2_zero_extend((
unsigned long long)OCFS2_I(inode)->ip_blkno,
965 (
unsigned long long)zero_start,
966 (
unsigned long long)i_size_read(inode));
967 while (zero_start < zero_to_size) {
968 ret = ocfs2_zero_extend_get_range(inode, di_bh, zero_start,
979 if (range_start < zero_start)
980 range_start = zero_start;
981 if (range_end > zero_to_size)
982 range_end = zero_to_size;
984 ret = ocfs2_zero_extend_range(inode, range_start,
990 zero_start = range_end;
997 u64 new_i_size,
u64 zero_to)
1000 u32 clusters_to_add;
1010 clusters_to_add = ocfs2_clusters_for_bytes(inode->
i_sb, new_i_size);
1012 clusters_to_add = 0;
1016 if (clusters_to_add) {
1017 ret = __ocfs2_extend_allocation(inode, oi->
ip_clusters,
1018 clusters_to_add, 0);
1038 static int ocfs2_extend_file(
struct inode *inode,
1039 struct buffer_head *di_bh,
1048 if (new_i_size == 0)
1051 if (i_size_read(inode) == new_i_size)
1053 BUG_ON(new_i_size < i_size_read(inode));
1071 goto out_update_size;
1106 int status = 0, size_change;
1107 struct inode *inode = dentry->
d_inode;
1110 struct buffer_head *bh =
NULL;
1111 handle_t *handle =
NULL;
1115 trace_ocfs2_setattr(inode, dentry,
1116 (
unsigned long long)OCFS2_I(inode)->ip_blkno,
1125 #define OCFS2_VALID_ATTRS (ATTR_ATIME | ATTR_MTIME | ATTR_CTIME | ATTR_SIZE \
1126 | ATTR_GID | ATTR_UID | ATTR_MODE)
1134 if (is_quota_modification(inode, attr))
1149 goto bail_unlock_rw;
1152 if (size_change && attr->
ia_size != i_size_read(inode)) {
1159 if (i_size_read(inode) > attr->
ia_size) {
1160 if (ocfs2_should_order_data(inode)) {
1161 status = ocfs2_begin_ordered_truncate(inode,
1166 status = ocfs2_truncate_file(inode, bh, attr->
ia_size);
1168 status = ocfs2_extend_file(inode, bh, attr->
ia_size);
1203 2 * ocfs2_quota_trans_credits(sb));
1204 if (IS_ERR(handle)) {
1205 status = PTR_ERR(handle);
1214 if (IS_ERR(handle)) {
1215 status = PTR_ERR(handle);
1231 attr->
ia_size != i_size_read(inode)) {
1240 mark_inode_dirty(inode);
1257 for (qtype = 0; qtype <
MAXQUOTAS; qtype++)
1258 dqput(transfer_to[qtype]);
1273 struct inode *inode = dentry->
d_inode;
1315 static int __ocfs2_write_remove_suid(
struct inode *inode,
1316 struct buffer_head *bh)
1323 trace_ocfs2_write_remove_suid(
1324 (
unsigned long long)OCFS2_I(inode)->ip_blkno,
1328 if (IS_ERR(handle)) {
1329 ret = PTR_ERR(handle);
1360 static int ocfs2_check_range_for_holes(
struct inode *inode, loff_t
pos,
1364 unsigned int extent_flags;
1365 u32 cpos, clusters, extent_len, phys_cpos;
1368 cpos = pos >>
OCFS2_SB(sb)->s_clustersize_bits;
1369 clusters = ocfs2_clusters_for_bytes(sb, pos + count) - cpos;
1379 if (phys_cpos == 0 || (extent_flags & OCFS2_EXT_UNWRITTEN)) {
1384 if (extent_len > clusters)
1385 extent_len = clusters;
1387 clusters -= extent_len;
1394 static int ocfs2_write_remove_suid(
struct inode *inode)
1397 struct buffer_head *bh =
NULL;
1405 ret = __ocfs2_write_remove_suid(inode, bh);
1416 static int ocfs2_allocate_unwritten_extents(
struct inode *inode,
1420 u32 cpos, phys_cpos, clusters, alloc_size;
1421 u64 end = start + len;
1422 struct buffer_head *di_bh =
NULL;
1424 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
1448 cpos = start >>
OCFS2_SB(inode->
i_sb)->s_clustersize_bits;
1449 clusters = ocfs2_clusters_for_bytes(inode->
i_sb, start + len);
1464 if (alloc_size > clusters)
1465 alloc_size = clusters;
1475 ret = __ocfs2_extend_allocation(inode, cpos, alloc_size, 1);
1484 clusters -= alloc_size;
1498 static void ocfs2_truncate_cluster_pages(
struct inode *inode,
u64 byte_start,
1505 start = (loff_t)ocfs2_align_bytes_to_clusters(inode->
i_sb, byte_start);
1506 end = byte_start + byte_len;
1515 static int ocfs2_zero_partial_clusters(
struct inode *inode,
1519 u64 tmpend, end = start + len;
1531 trace_ocfs2_zero_partial_clusters(
1532 (
unsigned long long)OCFS2_I(inode)->ip_blkno,
1533 (
unsigned long long)start, (
unsigned long long)end);
1540 if ((start & (csize - 1)) == 0 && (end & (csize - 1)) == 0)
1544 if (IS_ERR(handle)) {
1545 ret = PTR_ERR(handle);
1557 trace_ocfs2_zero_partial_clusters_range1((
unsigned long long)start,
1558 (
unsigned long long)tmpend);
1572 trace_ocfs2_zero_partial_clusters_range2(
1573 (
unsigned long long)start, (
unsigned long long)end);
1609 static void ocfs2_calc_trunc_pos(
struct inode *inode,
1612 u32 trunc_start,
u32 *trunc_cpos,
1613 u32 *trunc_len,
u32 *trunc_end,
1629 if (range < *trunc_end)
1634 }
else if (range > trunc_start) {
1639 *trunc_cpos = trunc_start;
1643 if (range < *trunc_end)
1645 *trunc_len = *trunc_end - trunc_start;
1648 ocfs2_clusters_to_blocks(inode->
i_sb, coff);
1649 *trunc_end = trunc_start;
1665 static int ocfs2_remove_inode_range(
struct inode *inode,
1666 struct buffer_head *di_bh,
u64 byte_start,
1669 int ret = 0,
flags = 0, done = 0,
i;
1670 u32 trunc_start, trunc_len, trunc_end, trunc_cpos, phys_cpos;
1683 ocfs2_init_dealloc_ctxt(&dealloc);
1685 trace_ocfs2_remove_inode_range(
1686 (
unsigned long long)OCFS2_I(inode)->ip_blkno,
1687 (
unsigned long long)byte_start,
1688 (
unsigned long long)byte_len);
1693 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
1695 byte_start + byte_len, 0);
1719 ret = ocfs2_cow_file_pos(inode, di_bh, byte_start);
1725 ret = ocfs2_cow_file_pos(inode, di_bh, byte_start + byte_len);
1732 trunc_start = ocfs2_clusters_for_bytes(osb->
sb, byte_start);
1734 cluster_in_el = trunc_end;
1736 ret = ocfs2_zero_partial_clusters(inode, byte_start, byte_len);
1749 while (trunc_end > trunc_start) {
1760 i = ocfs2_find_rec(el, trunc_end);
1780 if (cluster_in_el == 0)
1787 trunc_end = cluster_in_el + 1;
1796 ocfs2_calc_trunc_pos(inode, el, rec, trunc_start, &trunc_cpos,
1797 &trunc_len, &trunc_end, &blkno, &done);
1802 phys_cpos = ocfs2_blocks_to_clusters(inode->
i_sb, blkno);
1805 phys_cpos, trunc_len,
flags,
1806 &dealloc, refcount_loc);
1812 cluster_in_el = trunc_end;
1817 ocfs2_truncate_cluster_pages(inode, byte_start, byte_len);
1829 static int __ocfs2_change_file_space(
struct file *file,
struct inode *inode,
1830 loff_t f_pos,
unsigned int cmd,
1838 struct buffer_head *di_bh =
NULL;
1840 unsigned long long max_off = inode->
i_sb->s_maxbytes;
1842 if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb))
1864 goto out_inode_unlock;
1874 sr->
l_start += i_size_read(inode);
1878 goto out_inode_unlock;
1887 || (sr->
l_start + llen) > max_off) {
1889 goto out_inode_unlock;
1894 if (sr->
l_len <= 0) {
1896 goto out_inode_unlock;
1901 ret = __ocfs2_write_remove_suid(inode, di_bh);
1904 goto out_inode_unlock;
1916 ret = ocfs2_allocate_unwritten_extents(inode, sr->
l_start,
1921 ret = ocfs2_remove_inode_range(inode, di_bh, sr->
l_start,
1927 up_write(&OCFS2_I(inode)->ip_alloc_sem);
1930 goto out_inode_unlock;
1937 if (IS_ERR(handle)) {
1938 ret = PTR_ERR(handle);
1940 goto out_inode_unlock;
1943 if (change_size && i_size_read(inode) < size)
1944 i_size_write(inode, size);
1970 struct inode *inode = file->
f_path.dentry->d_inode;
1975 !ocfs2_writes_unwritten_extents(osb))
1978 !ocfs2_sparse_alloc(osb))
1990 ret = __ocfs2_change_file_space(file, inode, file->
f_pos, cmd, sr, 0);
1995 static long ocfs2_fallocate(
struct file *file,
int mode, loff_t offset,
1998 struct inode *inode = file->
f_path.dentry->d_inode;
2001 int change_size = 1;
2006 if (!ocfs2_writes_unwritten_extents(osb))
2019 return __ocfs2_change_file_space(
NULL, inode, offset, cmd, &sr,
2027 unsigned int extent_flags;
2028 u32 cpos, clusters, extent_len, phys_cpos;
2032 !(OCFS2_I(inode)->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL) ||
2033 OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL)
2036 cpos = pos >>
OCFS2_SB(sb)->s_clustersize_bits;
2037 clusters = ocfs2_clusters_for_bytes(sb, pos + count) - cpos;
2052 if (extent_len > clusters)
2053 extent_len = clusters;
2055 clusters -= extent_len;
2062 static void ocfs2_aiodio_wait(
struct inode *inode)
2069 static int ocfs2_is_io_unaligned(
struct inode *inode,
size_t count, loff_t pos)
2071 int blockmask = inode->
i_sb->s_blocksize - 1;
2072 loff_t final_size = pos +
count;
2074 if ((pos & blockmask) || (final_size & blockmask))
2079 static int ocfs2_prepare_inode_for_refcount(
struct inode *inode,
2081 loff_t pos,
size_t count,
2085 struct buffer_head *di_bh =
NULL;
2088 ocfs2_clusters_for_bytes(inode->
i_sb, pos + count) - cpos;
2106 static int ocfs2_prepare_inode_for_write(
struct file *file,
2113 int ret = 0, meta_level = 0;
2115 struct inode *inode = dentry->
d_inode;
2116 loff_t saved_pos = 0,
end;
2140 if (meta_level == 0) {
2146 ret = ocfs2_write_remove_suid(inode);
2156 saved_pos = i_size_read(inode);
2160 end = saved_pos +
count;
2167 ret = ocfs2_prepare_inode_for_refcount(inode,
2187 if (!direct_io || !(*direct_io))
2194 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
2205 if (end > i_size_read(inode)) {
2216 ret = ocfs2_check_range_for_holes(inode, saved_pos, count);
2229 trace_ocfs2_prepare_inode_for_write(OCFS2_I(inode)->ip_blkno,
2230 saved_pos, appending, count,
2231 direct_io, has_refcount);
2233 if (meta_level >= 0)
2241 const struct iovec *iov,
2242 unsigned long nr_segs,
2245 int ret, direct_io, appending, rw_level, have_alloc_sem = 0;
2246 int can_do_direct, has_refcount = 0;
2252 struct file *file = iocb->
ki_filp;
2253 struct inode *inode = file->
f_path.dentry->d_inode;
2257 int unaligned_dio = 0;
2259 trace_ocfs2_file_aio_write(inode, file, file->
f_path.dentry,
2260 (
unsigned long long)OCFS2_I(inode)->ip_blkno,
2261 file->
f_path.dentry->d_name.len,
2262 file->
f_path.dentry->d_name.name,
2263 (
unsigned int)nr_segs);
2268 sb_start_write(inode->
i_sb);
2271 direct_io = file->
f_flags & O_DIRECT ? 1 : 0;
2289 rw_level = (!direct_io || full_coherency);
2301 if (direct_io && full_coherency) {
2316 can_do_direct = direct_io;
2317 ret = ocfs2_prepare_inode_for_write(file, ppos,
2319 &can_do_direct, &has_refcount);
2325 if (direct_io && !is_sync_kiocb(iocb))
2326 unaligned_dio = ocfs2_is_io_unaligned(inode, iocb->
ki_left,
2333 if (direct_io && !can_do_direct) {
2343 if (unaligned_dio) {
2348 ocfs2_aiodio_wait(inode);
2351 atomic_inc(&OCFS2_I(inode)->ip_unaligned_aio);
2359 old_size = i_size_read(inode);
2360 old_clusters = OCFS2_I(inode)->ip_clusters;
2363 ocfs2_iocb_set_rw_locked(iocb, rw_level);
2378 ppos, count, ocount);
2395 ((file->
f_flags & O_DIRECT) && !direct_io)) {
2401 if (!ret && ((old_size != i_size_read(inode)) ||
2402 (old_clusters != OCFS2_I(inode)->ip_clusters) ||
2429 if (unaligned_dio) {
2431 atomic_dec(&OCFS2_I(inode)->ip_unaligned_aio);
2443 sb_end_write(inode->
i_sb);
2456 ret = ocfs2_prepare_inode_for_write(out, &sd->
pos,
2474 struct inode *inode = mapping->
host;
2483 trace_ocfs2_file_splice_write(inode, out, out->
f_path.dentry,
2484 (
unsigned long long)OCFS2_I(inode)->ip_blkno,
2485 out->
f_path.dentry->d_name.len,
2486 out->
f_path.dentry->d_name.name, len);
2502 ret = ocfs2_splice_to_file(pipe, out, &sd);
2516 unsigned long nr_pages;
2533 static ssize_t ocfs2_file_splice_read(
struct file *
in,
2539 int ret = 0, lock_level = 0;
2540 struct inode *inode = in->
f_path.dentry->d_inode;
2542 trace_ocfs2_file_splice_read(inode, in, in->
f_path.dentry,
2543 (
unsigned long long)OCFS2_I(inode)->ip_blkno,
2544 in->
f_path.dentry->d_name.len,
2545 in->
f_path.dentry->d_name.name, len);
2564 const struct iovec *iov,
2565 unsigned long nr_segs,
2568 int ret = 0, rw_level = -1, have_alloc_sem = 0, lock_level = 0;
2569 struct file *filp = iocb->
ki_filp;
2570 struct inode *inode = filp->
f_path.dentry->d_inode;
2572 trace_ocfs2_file_aio_read(inode, filp, filp->
f_path.dentry,
2573 (
unsigned long long)OCFS2_I(inode)->ip_blkno,
2574 filp->
f_path.dentry->d_name.len,
2575 filp->
f_path.dentry->d_name.name, nr_segs);
2590 if (filp->
f_flags & O_DIRECT) {
2601 ocfs2_iocb_set_rw_locked(iocb, rw_level);
2621 trace_generic_file_aio_read_ret(ret);
2643 static loff_t ocfs2_file_llseek(
struct file *file, loff_t offset,
int origin)
2645 struct inode *inode = file->
f_mapping->host;
2658 offset = file->
f_pos;
2661 offset += file->
f_pos;
2676 if (!ret && offset > inode->
i_sb->s_maxbytes)
2681 if (offset != file->
f_pos) {
2717 .llseek = ocfs2_file_llseek,
2721 .fsync = ocfs2_sync_file,
2722 .release = ocfs2_file_release,
2723 .open = ocfs2_file_open,
2724 .aio_read = ocfs2_file_aio_read,
2725 .aio_write = ocfs2_file_aio_write,
2727 #ifdef CONFIG_COMPAT
2732 .splice_read = ocfs2_file_splice_read,
2733 .splice_write = ocfs2_file_splice_write,
2734 .fallocate = ocfs2_fallocate,
2741 .fsync = ocfs2_sync_file,
2742 .release = ocfs2_dir_release,
2743 .open = ocfs2_dir_open,
2745 #ifdef CONFIG_COMPAT
2765 .llseek = ocfs2_file_llseek,
2769 .fsync = ocfs2_sync_file,
2770 .release = ocfs2_file_release,
2771 .open = ocfs2_file_open,
2772 .aio_read = ocfs2_file_aio_read,
2773 .aio_write = ocfs2_file_aio_write,
2775 #ifdef CONFIG_COMPAT
2779 .splice_read = ocfs2_file_splice_read,
2780 .splice_write = ocfs2_file_splice_write,
2781 .fallocate = ocfs2_fallocate,
2788 .fsync = ocfs2_sync_file,
2789 .release = ocfs2_dir_release,
2790 .open = ocfs2_dir_open,
2792 #ifdef CONFIG_COMPAT