Commit bd5a876ac4c130e8e1986dcdbb21839ae4cd91c0

Authored by Christoph Hellwig
Committed by Nathan Scott
1 parent d130c14c03

[XFS] (mostly) remove xfs_inval_cached_pages Since the last round of

direct I/O locking changes it is just a wrapper around
VOP_FLUSHINVAL_PAGES, so it's not nessecary anymore.  Keep a simplified
version for kernels < 2.4.22, as these don't have the changed direct I/O
locking.

SGI-PV: 938064
SGI-Modid: xfs-linux:xfs-kern:194420a

Signed-off-by: Christoph Hellwig <hch@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>

Showing 4 changed files with 17 additions and 32 deletions Side-by-side Diff

fs/xfs/linux-2.6/xfs_lrw.c
... ... @@ -209,30 +209,6 @@
209 209 return (-status);
210 210 }
211 211  
212   -/*
213   - * xfs_inval_cached_pages
214   - *
215   - * This routine is responsible for keeping direct I/O and buffered I/O
216   - * somewhat coherent. From here we make sure that we're at least
217   - * temporarily holding the inode I/O lock exclusively and then call
218   - * the page cache to flush and invalidate any cached pages. If there
219   - * are no cached pages this routine will be very quick.
220   - */
221   -void
222   -xfs_inval_cached_pages(
223   - vnode_t *vp,
224   - xfs_iocore_t *io,
225   - xfs_off_t offset,
226   - int write,
227   - int relock)
228   -{
229   - if (VN_CACHED(vp)) {
230   - xfs_inval_cached_trace(io, offset, -1, ctooff(offtoct(offset)), -1);
231   - VOP_FLUSHINVAL_PAGES(vp, ctooff(offtoct(offset)), -1, FI_REMAPF_LOCKED);
232   - }
233   -
234   -}
235   -
236 212 ssize_t /* bytes read, or (-) error */
237 213 xfs_read(
238 214 bhv_desc_t *bdp,
fs/xfs/linux-2.6/xfs_lrw.h
... ... @@ -94,8 +94,6 @@
94 94  
95 95 extern int xfs_zero_eof(struct vnode *, struct xfs_iocore *, xfs_off_t,
96 96 xfs_fsize_t, xfs_fsize_t);
97   -extern void xfs_inval_cached_pages(struct vnode *, struct xfs_iocore *,
98   - xfs_off_t, int, int);
99 97 extern ssize_t xfs_read(struct bhv_desc *, struct kiocb *,
100 98 const struct iovec *, unsigned int,
101 99 loff_t *, int, struct cred *);
... ... @@ -180,9 +180,10 @@
180 180 goto error0;
181 181 }
182 182  
183   - if (VN_CACHED(tvp) != 0)
184   - xfs_inval_cached_pages(XFS_ITOV(tip), &(tip->i_iocore),
185   - (xfs_off_t)0, 0, 0);
  183 + if (VN_CACHED(tvp) != 0) {
  184 + xfs_inval_cached_trace(&tip->i_iocore, 0, -1, 0, -1);
  185 + VOP_FLUSHINVAL_PAGES(tvp, 0, -1, FI_REMAPF_LOCKED);
  186 + }
186 187  
187 188 /* Verify O_DIRECT for ftmp */
188 189 if (VN_CACHED(tvp) != 0) {
fs/xfs/xfs_vnodeops.c
... ... @@ -4329,6 +4329,7 @@
4329 4329 xfs_off_t len,
4330 4330 int attr_flags)
4331 4331 {
  4332 + vnode_t *vp;
4332 4333 int committed;
4333 4334 int done;
4334 4335 xfs_off_t end_dmi_offset;
4335 4336  
... ... @@ -4349,9 +4350,11 @@
4349 4350 xfs_trans_t *tp;
4350 4351 int need_iolock = 1;
4351 4352  
4352   - vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
  4353 + vp = XFS_ITOV(ip);
4353 4354 mp = ip->i_mount;
4354 4355  
  4356 + vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
  4357 +
4355 4358 if ((error = XFS_QM_DQATTACH(mp, ip, 0)))
4356 4359 return error;
4357 4360  
... ... @@ -4368,7 +4371,7 @@
4368 4371 DM_EVENT_ENABLED(XFS_MTOVFS(mp), ip, DM_EVENT_WRITE)) {
4369 4372 if (end_dmi_offset > ip->i_d.di_size)
4370 4373 end_dmi_offset = ip->i_d.di_size;
4371   - error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, XFS_ITOV(ip),
  4374 + error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, vp,
4372 4375 offset, end_dmi_offset - offset,
4373 4376 AT_DELAY_FLAG(attr_flags), NULL);
4374 4377 if (error)
... ... @@ -4387,7 +4390,14 @@
4387 4390 ioffset = offset & ~(rounding - 1);
4388 4391 if (ilen & (rounding - 1))
4389 4392 ilen = (ilen + rounding) & ~(rounding - 1);
4390   - xfs_inval_cached_pages(XFS_ITOV(ip), &(ip->i_iocore), ioffset, 0, 0);
  4393 +
  4394 + if (VN_CACHED(vp) != 0) {
  4395 + xfs_inval_cached_trace(&ip->i_iocore, ioffset, -1,
  4396 + ctooff(offtoct(ioffset)), -1);
  4397 + VOP_FLUSHINVAL_PAGES(vp, ctooff(offtoct(ioffset)),
  4398 + -1, FI_REMAPF_LOCKED);
  4399 + }
  4400 +
4391 4401 /*
4392 4402 * Need to zero the stuff we're not freeing, on disk.
4393 4403 * If its a realtime file & can't use unwritten extents then we