diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_lrw.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_lrw.c | 64 |
1 files changed, 25 insertions, 39 deletions
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c index 94941da6c4da..2dc979e3e969 100644 --- a/fs/xfs/linux-2.6/xfs_lrw.c +++ b/fs/xfs/linux-2.6/xfs_lrw.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include "xfs_buf_item.h" | 48 | #include "xfs_buf_item.h" |
49 | #include "xfs_utils.h" | 49 | #include "xfs_utils.h" |
50 | #include "xfs_iomap.h" | 50 | #include "xfs_iomap.h" |
51 | #include "xfs_vnodeops.h" | ||
51 | 52 | ||
52 | #include <linux/capability.h> | 53 | #include <linux/capability.h> |
53 | #include <linux/writeback.h> | 54 | #include <linux/writeback.h> |
@@ -180,27 +181,22 @@ unlock: | |||
180 | 181 | ||
181 | ssize_t /* bytes read, or (-) error */ | 182 | ssize_t /* bytes read, or (-) error */ |
182 | xfs_read( | 183 | xfs_read( |
183 | bhv_desc_t *bdp, | 184 | xfs_inode_t *ip, |
184 | struct kiocb *iocb, | 185 | struct kiocb *iocb, |
185 | const struct iovec *iovp, | 186 | const struct iovec *iovp, |
186 | unsigned int segs, | 187 | unsigned int segs, |
187 | loff_t *offset, | 188 | loff_t *offset, |
188 | int ioflags, | 189 | int ioflags) |
189 | cred_t *credp) | ||
190 | { | 190 | { |
191 | struct file *file = iocb->ki_filp; | 191 | struct file *file = iocb->ki_filp; |
192 | struct inode *inode = file->f_mapping->host; | 192 | struct inode *inode = file->f_mapping->host; |
193 | bhv_vnode_t *vp = XFS_ITOV(ip); | ||
194 | xfs_mount_t *mp = ip->i_mount; | ||
193 | size_t size = 0; | 195 | size_t size = 0; |
194 | ssize_t ret = 0; | 196 | ssize_t ret = 0; |
195 | xfs_fsize_t n; | 197 | xfs_fsize_t n; |
196 | xfs_inode_t *ip; | ||
197 | xfs_mount_t *mp; | ||
198 | bhv_vnode_t *vp; | ||
199 | unsigned long seg; | 198 | unsigned long seg; |
200 | 199 | ||
201 | ip = XFS_BHVTOI(bdp); | ||
202 | vp = BHV_TO_VNODE(bdp); | ||
203 | mp = ip->i_mount; | ||
204 | 200 | ||
205 | XFS_STATS_INC(xs_read_calls); | 201 | XFS_STATS_INC(xs_read_calls); |
206 | 202 | ||
@@ -249,8 +245,7 @@ xfs_read( | |||
249 | bhv_vrwlock_t locktype = VRWLOCK_READ; | 245 | bhv_vrwlock_t locktype = VRWLOCK_READ; |
250 | int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG_RD(ioflags); | 246 | int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG_RD(ioflags); |
251 | 247 | ||
252 | ret = -XFS_SEND_DATA(mp, DM_EVENT_READ, | 248 | ret = -XFS_SEND_DATA(mp, DM_EVENT_READ, vp, *offset, size, |
253 | BHV_TO_VNODE(bdp), *offset, size, | ||
254 | dmflags, &locktype); | 249 | dmflags, &locktype); |
255 | if (ret) { | 250 | if (ret) { |
256 | xfs_iunlock(ip, XFS_IOLOCK_SHARED); | 251 | xfs_iunlock(ip, XFS_IOLOCK_SHARED); |
@@ -287,16 +282,15 @@ xfs_read( | |||
287 | 282 | ||
288 | ssize_t | 283 | ssize_t |
289 | xfs_splice_read( | 284 | xfs_splice_read( |
290 | bhv_desc_t *bdp, | 285 | xfs_inode_t *ip, |
291 | struct file *infilp, | 286 | struct file *infilp, |
292 | loff_t *ppos, | 287 | loff_t *ppos, |
293 | struct pipe_inode_info *pipe, | 288 | struct pipe_inode_info *pipe, |
294 | size_t count, | 289 | size_t count, |
295 | int flags, | 290 | int flags, |
296 | int ioflags, | 291 | int ioflags) |
297 | cred_t *credp) | ||
298 | { | 292 | { |
299 | xfs_inode_t *ip = XFS_BHVTOI(bdp); | 293 | bhv_vnode_t *vp = XFS_ITOV(ip); |
300 | xfs_mount_t *mp = ip->i_mount; | 294 | xfs_mount_t *mp = ip->i_mount; |
301 | ssize_t ret; | 295 | ssize_t ret; |
302 | 296 | ||
@@ -310,8 +304,7 @@ xfs_splice_read( | |||
310 | bhv_vrwlock_t locktype = VRWLOCK_READ; | 304 | bhv_vrwlock_t locktype = VRWLOCK_READ; |
311 | int error; | 305 | int error; |
312 | 306 | ||
313 | error = XFS_SEND_DATA(mp, DM_EVENT_READ, BHV_TO_VNODE(bdp), | 307 | error = XFS_SEND_DATA(mp, DM_EVENT_READ, vp, *ppos, count, |
314 | *ppos, count, | ||
315 | FILP_DELAY_FLAG(infilp), &locktype); | 308 | FILP_DELAY_FLAG(infilp), &locktype); |
316 | if (error) { | 309 | if (error) { |
317 | xfs_iunlock(ip, XFS_IOLOCK_SHARED); | 310 | xfs_iunlock(ip, XFS_IOLOCK_SHARED); |
@@ -330,16 +323,15 @@ xfs_splice_read( | |||
330 | 323 | ||
331 | ssize_t | 324 | ssize_t |
332 | xfs_splice_write( | 325 | xfs_splice_write( |
333 | bhv_desc_t *bdp, | 326 | xfs_inode_t *ip, |
334 | struct pipe_inode_info *pipe, | 327 | struct pipe_inode_info *pipe, |
335 | struct file *outfilp, | 328 | struct file *outfilp, |
336 | loff_t *ppos, | 329 | loff_t *ppos, |
337 | size_t count, | 330 | size_t count, |
338 | int flags, | 331 | int flags, |
339 | int ioflags, | 332 | int ioflags) |
340 | cred_t *credp) | ||
341 | { | 333 | { |
342 | xfs_inode_t *ip = XFS_BHVTOI(bdp); | 334 | bhv_vnode_t *vp = XFS_ITOV(ip); |
343 | xfs_mount_t *mp = ip->i_mount; | 335 | xfs_mount_t *mp = ip->i_mount; |
344 | xfs_iocore_t *io = &ip->i_iocore; | 336 | xfs_iocore_t *io = &ip->i_iocore; |
345 | ssize_t ret; | 337 | ssize_t ret; |
@@ -356,8 +348,7 @@ xfs_splice_write( | |||
356 | bhv_vrwlock_t locktype = VRWLOCK_WRITE; | 348 | bhv_vrwlock_t locktype = VRWLOCK_WRITE; |
357 | int error; | 349 | int error; |
358 | 350 | ||
359 | error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, BHV_TO_VNODE(bdp), | 351 | error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, vp, *ppos, count, |
360 | *ppos, count, | ||
361 | FILP_DELAY_FLAG(outfilp), &locktype); | 352 | FILP_DELAY_FLAG(outfilp), &locktype); |
362 | if (error) { | 353 | if (error) { |
363 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); | 354 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); |
@@ -591,24 +582,22 @@ out_lock: | |||
591 | 582 | ||
592 | ssize_t /* bytes written, or (-) error */ | 583 | ssize_t /* bytes written, or (-) error */ |
593 | xfs_write( | 584 | xfs_write( |
594 | bhv_desc_t *bdp, | 585 | struct xfs_inode *xip, |
595 | struct kiocb *iocb, | 586 | struct kiocb *iocb, |
596 | const struct iovec *iovp, | 587 | const struct iovec *iovp, |
597 | unsigned int nsegs, | 588 | unsigned int nsegs, |
598 | loff_t *offset, | 589 | loff_t *offset, |
599 | int ioflags, | 590 | int ioflags) |
600 | cred_t *credp) | ||
601 | { | 591 | { |
602 | struct file *file = iocb->ki_filp; | 592 | struct file *file = iocb->ki_filp; |
603 | struct address_space *mapping = file->f_mapping; | 593 | struct address_space *mapping = file->f_mapping; |
604 | struct inode *inode = mapping->host; | 594 | struct inode *inode = mapping->host; |
595 | bhv_vnode_t *vp = XFS_ITOV(xip); | ||
605 | unsigned long segs = nsegs; | 596 | unsigned long segs = nsegs; |
606 | xfs_inode_t *xip; | ||
607 | xfs_mount_t *mp; | 597 | xfs_mount_t *mp; |
608 | ssize_t ret = 0, error = 0; | 598 | ssize_t ret = 0, error = 0; |
609 | xfs_fsize_t isize, new_size; | 599 | xfs_fsize_t isize, new_size; |
610 | xfs_iocore_t *io; | 600 | xfs_iocore_t *io; |
611 | bhv_vnode_t *vp; | ||
612 | int iolock; | 601 | int iolock; |
613 | int eventsent = 0; | 602 | int eventsent = 0; |
614 | bhv_vrwlock_t locktype; | 603 | bhv_vrwlock_t locktype; |
@@ -618,9 +607,6 @@ xfs_write( | |||
618 | 607 | ||
619 | XFS_STATS_INC(xs_write_calls); | 608 | XFS_STATS_INC(xs_write_calls); |
620 | 609 | ||
621 | vp = BHV_TO_VNODE(bdp); | ||
622 | xip = XFS_BHVTOI(bdp); | ||
623 | |||
624 | error = generic_segment_checks(iovp, &segs, &ocount, VERIFY_READ); | 610 | error = generic_segment_checks(iovp, &segs, &ocount, VERIFY_READ); |
625 | if (error) | 611 | if (error) |
626 | return error; | 612 | return error; |
@@ -730,7 +716,7 @@ start: | |||
730 | */ | 716 | */ |
731 | 717 | ||
732 | if (pos > xip->i_size) { | 718 | if (pos > xip->i_size) { |
733 | error = xfs_zero_eof(BHV_TO_VNODE(bdp), io, pos, xip->i_size); | 719 | error = xfs_zero_eof(vp, io, pos, xip->i_size); |
734 | if (error) { | 720 | if (error) { |
735 | xfs_iunlock(xip, XFS_ILOCK_EXCL); | 721 | xfs_iunlock(xip, XFS_ILOCK_EXCL); |
736 | goto out_unlock_internal; | 722 | goto out_unlock_internal; |
@@ -815,7 +801,7 @@ retry: | |||
815 | 801 | ||
816 | if (ret == -ENOSPC && | 802 | if (ret == -ENOSPC && |
817 | DM_EVENT_ENABLED(xip, DM_EVENT_NOSPACE) && !(ioflags & IO_INVIS)) { | 803 | DM_EVENT_ENABLED(xip, DM_EVENT_NOSPACE) && !(ioflags & IO_INVIS)) { |
818 | xfs_rwunlock(bdp, locktype); | 804 | xfs_rwunlock(xip, locktype); |
819 | if (need_i_mutex) | 805 | if (need_i_mutex) |
820 | mutex_unlock(&inode->i_mutex); | 806 | mutex_unlock(&inode->i_mutex); |
821 | error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp, | 807 | error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp, |
@@ -823,7 +809,7 @@ retry: | |||
823 | 0, 0, 0); /* Delay flag intentionally unused */ | 809 | 0, 0, 0); /* Delay flag intentionally unused */ |
824 | if (need_i_mutex) | 810 | if (need_i_mutex) |
825 | mutex_lock(&inode->i_mutex); | 811 | mutex_lock(&inode->i_mutex); |
826 | xfs_rwlock(bdp, locktype); | 812 | xfs_rwlock(xip, locktype); |
827 | if (error) | 813 | if (error) |
828 | goto out_unlock_internal; | 814 | goto out_unlock_internal; |
829 | pos = xip->i_size; | 815 | pos = xip->i_size; |
@@ -854,7 +840,7 @@ retry: | |||
854 | if (error) | 840 | if (error) |
855 | goto out_unlock_internal; | 841 | goto out_unlock_internal; |
856 | 842 | ||
857 | xfs_rwunlock(bdp, locktype); | 843 | xfs_rwunlock(xip, locktype); |
858 | if (need_i_mutex) | 844 | if (need_i_mutex) |
859 | mutex_unlock(&inode->i_mutex); | 845 | mutex_unlock(&inode->i_mutex); |
860 | 846 | ||
@@ -863,7 +849,7 @@ retry: | |||
863 | error = -ret; | 849 | error = -ret; |
864 | if (need_i_mutex) | 850 | if (need_i_mutex) |
865 | mutex_lock(&inode->i_mutex); | 851 | mutex_lock(&inode->i_mutex); |
866 | xfs_rwlock(bdp, locktype); | 852 | xfs_rwlock(xip, locktype); |
867 | } | 853 | } |
868 | 854 | ||
869 | out_unlock_internal: | 855 | out_unlock_internal: |
@@ -881,7 +867,7 @@ retry: | |||
881 | xip->i_d.di_size = xip->i_size; | 867 | xip->i_d.di_size = xip->i_size; |
882 | xfs_iunlock(xip, XFS_ILOCK_EXCL); | 868 | xfs_iunlock(xip, XFS_ILOCK_EXCL); |
883 | } | 869 | } |
884 | xfs_rwunlock(bdp, locktype); | 870 | xfs_rwunlock(xip, locktype); |
885 | out_unlock_mutex: | 871 | out_unlock_mutex: |
886 | if (need_i_mutex) | 872 | if (need_i_mutex) |
887 | mutex_unlock(&inode->i_mutex); | 873 | mutex_unlock(&inode->i_mutex); |
@@ -920,14 +906,14 @@ xfs_bdstrat_cb(struct xfs_buf *bp) | |||
920 | 906 | ||
921 | 907 | ||
922 | int | 908 | int |
923 | xfs_bmap(bhv_desc_t *bdp, | 909 | xfs_bmap( |
910 | xfs_inode_t *ip, | ||
924 | xfs_off_t offset, | 911 | xfs_off_t offset, |
925 | ssize_t count, | 912 | ssize_t count, |
926 | int flags, | 913 | int flags, |
927 | xfs_iomap_t *iomapp, | 914 | xfs_iomap_t *iomapp, |
928 | int *niomaps) | 915 | int *niomaps) |
929 | { | 916 | { |
930 | xfs_inode_t *ip = XFS_BHVTOI(bdp); | ||
931 | xfs_iocore_t *io = &ip->i_iocore; | 917 | xfs_iocore_t *io = &ip->i_iocore; |
932 | 918 | ||
933 | ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG); | 919 | ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG); |