diff options
Diffstat (limited to 'fs/ocfs2/file.c')
-rw-r--r-- | fs/ocfs2/file.c | 51 |
1 files changed, 1 insertions, 50 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 1715bc90e705..8a4048b55fdc 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -933,9 +933,6 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, | |||
933 | struct file *filp = iocb->ki_filp; | 933 | struct file *filp = iocb->ki_filp; |
934 | struct inode *inode = filp->f_dentry->d_inode; | 934 | struct inode *inode = filp->f_dentry->d_inode; |
935 | loff_t newsize, saved_pos; | 935 | loff_t newsize, saved_pos; |
936 | #ifdef OCFS2_ORACORE_WORKAROUNDS | ||
937 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | ||
938 | #endif | ||
939 | 936 | ||
940 | mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", filp, buf, | 937 | mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", filp, buf, |
941 | (unsigned int)count, | 938 | (unsigned int)count, |
@@ -951,14 +948,6 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, | |||
951 | return -EIO; | 948 | return -EIO; |
952 | } | 949 | } |
953 | 950 | ||
954 | #ifdef OCFS2_ORACORE_WORKAROUNDS | ||
955 | /* ugh, work around some applications which open everything O_DIRECT + | ||
956 | * O_APPEND and really don't mean to use O_DIRECT. */ | ||
957 | if (osb->s_mount_opt & OCFS2_MOUNT_COMPAT_OCFS && | ||
958 | (filp->f_flags & O_APPEND) && (filp->f_flags & O_DIRECT)) | ||
959 | filp->f_flags &= ~O_DIRECT; | ||
960 | #endif | ||
961 | |||
962 | mutex_lock(&inode->i_mutex); | 951 | mutex_lock(&inode->i_mutex); |
963 | /* to match setattr's i_mutex -> i_alloc_sem -> rw_lock ordering */ | 952 | /* to match setattr's i_mutex -> i_alloc_sem -> rw_lock ordering */ |
964 | if (filp->f_flags & O_DIRECT) { | 953 | if (filp->f_flags & O_DIRECT) { |
@@ -1079,27 +1068,7 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, | |||
1079 | /* communicate with ocfs2_dio_end_io */ | 1068 | /* communicate with ocfs2_dio_end_io */ |
1080 | ocfs2_iocb_set_rw_locked(iocb); | 1069 | ocfs2_iocb_set_rw_locked(iocb); |
1081 | 1070 | ||
1082 | #ifdef OCFS2_ORACORE_WORKAROUNDS | 1071 | ret = generic_file_aio_write_nolock(iocb, &local_iov, 1, &iocb->ki_pos); |
1083 | if (osb->s_mount_opt & OCFS2_MOUNT_COMPAT_OCFS && | ||
1084 | filp->f_flags & O_DIRECT) { | ||
1085 | unsigned int saved_flags = filp->f_flags; | ||
1086 | int sector_size = 1 << osb->s_sectsize_bits; | ||
1087 | |||
1088 | if ((saved_pos & (sector_size - 1)) || | ||
1089 | (count & (sector_size - 1)) || | ||
1090 | ((unsigned long)buf & (sector_size - 1))) { | ||
1091 | filp->f_flags |= O_SYNC; | ||
1092 | filp->f_flags &= ~O_DIRECT; | ||
1093 | } | ||
1094 | |||
1095 | ret = generic_file_aio_write_nolock(iocb, &local_iov, 1, | ||
1096 | &iocb->ki_pos); | ||
1097 | |||
1098 | filp->f_flags = saved_flags; | ||
1099 | } else | ||
1100 | #endif | ||
1101 | ret = generic_file_aio_write_nolock(iocb, &local_iov, 1, | ||
1102 | &iocb->ki_pos); | ||
1103 | 1072 | ||
1104 | /* buffered aio wouldn't have proper lock coverage today */ | 1073 | /* buffered aio wouldn't have proper lock coverage today */ |
1105 | BUG_ON(ret == -EIOCBQUEUED && !(filp->f_flags & O_DIRECT)); | 1074 | BUG_ON(ret == -EIOCBQUEUED && !(filp->f_flags & O_DIRECT)); |
@@ -1140,9 +1109,6 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, | |||
1140 | int ret = 0, rw_level = -1, have_alloc_sem = 0; | 1109 | int ret = 0, rw_level = -1, have_alloc_sem = 0; |
1141 | struct file *filp = iocb->ki_filp; | 1110 | struct file *filp = iocb->ki_filp; |
1142 | struct inode *inode = filp->f_dentry->d_inode; | 1111 | struct inode *inode = filp->f_dentry->d_inode; |
1143 | #ifdef OCFS2_ORACORE_WORKAROUNDS | ||
1144 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | ||
1145 | #endif | ||
1146 | 1112 | ||
1147 | mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", filp, buf, | 1113 | mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", filp, buf, |
1148 | (unsigned int)count, | 1114 | (unsigned int)count, |
@@ -1155,21 +1121,6 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, | |||
1155 | goto bail; | 1121 | goto bail; |
1156 | } | 1122 | } |
1157 | 1123 | ||
1158 | #ifdef OCFS2_ORACORE_WORKAROUNDS | ||
1159 | if (osb->s_mount_opt & OCFS2_MOUNT_COMPAT_OCFS) { | ||
1160 | if (filp->f_flags & O_DIRECT) { | ||
1161 | int sector_size = 1 << osb->s_sectsize_bits; | ||
1162 | |||
1163 | if ((pos & (sector_size - 1)) || | ||
1164 | (count & (sector_size - 1)) || | ||
1165 | ((unsigned long)buf & (sector_size - 1)) || | ||
1166 | (i_size_read(inode) & (sector_size -1))) { | ||
1167 | filp->f_flags &= ~O_DIRECT; | ||
1168 | } | ||
1169 | } | ||
1170 | } | ||
1171 | #endif | ||
1172 | |||
1173 | /* | 1124 | /* |
1174 | * buffered reads protect themselves in ->readpage(). O_DIRECT reads | 1125 | * buffered reads protect themselves in ->readpage(). O_DIRECT reads |
1175 | * need locks to protect pending reads from racing with truncate. | 1126 | * need locks to protect pending reads from racing with truncate. |