/dev/random was almost always returning 0 bytes. This was due to several
[dragonfly.git] / sys / vfs / ufs / ufs_readwrite.c
1 /*-
2  * Copyright (c) 1993
3  *      The Regents of the University of California.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *      This product includes software developed by the University of
16  *      California, Berkeley and its contributors.
17  * 4. Neither the name of the University nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  *
33  *      @(#)ufs_readwrite.c     8.11 (Berkeley) 5/8/95
34  * $FreeBSD: src/sys/ufs/ufs/ufs_readwrite.c,v 1.65.2.14 2003/04/04 22:21:29 tegge Exp $
35  * $DragonFly: src/sys/vfs/ufs/ufs_readwrite.c,v 1.15 2006/03/27 01:54:17 dillon Exp $
36  */
37
38 #define BLKSIZE(a, b, c)        blksize(a, b, c)
39 #define FS                      struct fs
40 #define I_FS                    i_fs
41
42 #include <vm/vm.h>
43 #include <vm/vm_object.h>
44 #include <vm/vm_pager.h>
45 #include <vm/vm_map.h>
46 #include <vm/vnode_pager.h>
47 #include <sys/event.h>
48 #include <sys/vmmeter.h>
49 #include <vm/vm_page2.h>
50
51 #include "opt_directio.h"
52
53 #define VN_KNOTE(vp, b) \
54         KNOTE((struct klist *)&vp->v_pollinfo.vpi_selinfo.si_note, (b))
55
56 #ifdef DIRECTIO
57 extern int ffs_rawread(struct vnode *vp, struct uio *uio, int *workdone);
58 #endif
59
60 /*
61  * Vnode op for reading.
62  *
63  * ffs_read(struct vnode *a_vp, struct uio *a_uio, int a_ioflag,
64  *          struct ucred *a_cred)
65  */
66 /* ARGSUSED */
67 int
68 ffs_read(struct vop_read_args *ap)
69 {
70         struct vnode *vp;
71         struct inode *ip;
72         struct uio *uio;
73         FS *fs;
74         struct buf *bp;
75         ufs_daddr_t lbn, nextlbn;
76         off_t nextloffset;
77         off_t loffset;
78         off_t bytesinfile;
79         int size, xfersize, blkoffset;
80         int error, orig_resid;
81         u_short mode;
82         int seqcount;
83         int ioflag;
84         vm_object_t object;
85
86         vp = ap->a_vp;
87         seqcount = ap->a_ioflag >> 16;
88         ip = VTOI(vp);
89         mode = ip->i_mode;
90         uio = ap->a_uio;
91         ioflag = ap->a_ioflag;
92 #ifdef DIRECTIO
93         if ((ioflag & IO_DIRECT) != 0) {
94                 int workdone;
95
96                 error = ffs_rawread(vp, uio, &workdone);
97                 if (error || workdone)
98                         return error;
99         }
100 #endif
101
102 #ifdef DIAGNOSTIC
103         if (uio->uio_rw != UIO_READ)
104                 panic("ffs_read: mode");
105
106         if (vp->v_type == VLNK) {
107                 if ((int)ip->i_size < vp->v_mount->mnt_maxsymlinklen)
108                         panic("ffs_read: short symlink");
109         } else if (vp->v_type != VREG && vp->v_type != VDIR)
110                 panic("ffs_read: type %d", vp->v_type);
111 #endif
112         fs = ip->I_FS;
113         if ((uint64_t)uio->uio_offset > fs->fs_maxfilesize)
114                 return (EFBIG);
115
116         orig_resid = uio->uio_resid;
117         if (orig_resid <= 0)
118                 return (0);
119
120         object = vp->v_object;
121
122         bytesinfile = ip->i_size - uio->uio_offset;
123         if (bytesinfile <= 0) {
124                 if ((vp->v_mount->mnt_flag & MNT_NOATIME) == 0)
125                         ip->i_flag |= IN_ACCESS;
126                 return 0;
127         }
128
129         if (object)
130                 vm_object_reference(object);
131
132         /*
133          * Ok so we couldn't do it all in one vm trick...
134          * so cycle around trying smaller bites..
135          */
136         for (error = 0, bp = NULL; uio->uio_resid > 0; bp = NULL) {
137                 if ((bytesinfile = ip->i_size - uio->uio_offset) <= 0)
138                         break;
139
140                 lbn = lblkno(fs, uio->uio_offset);
141                 loffset = lblktodoff(fs, lbn);
142                 nextlbn = lbn + 1;
143                 nextloffset = lblktodoff(fs, nextlbn);
144
145                 /*
146                  * size of buffer.  The buffer representing the
147                  * end of the file is rounded up to the size of
148                  * the block type ( fragment or full block, 
149                  * depending ).
150                  */
151                 size = BLKSIZE(fs, ip, lbn);
152                 blkoffset = blkoff(fs, uio->uio_offset);
153                 
154                 /*
155                  * The amount we want to transfer in this iteration is
156                  * one FS block less the amount of the data before
157                  * our startpoint (duh!)
158                  */
159                 xfersize = fs->fs_bsize - blkoffset;
160
161                 /*
162                  * But if we actually want less than the block,
163                  * or the file doesn't have a whole block more of data,
164                  * then use the lesser number.
165                  */
166                 if (uio->uio_resid < xfersize)
167                         xfersize = uio->uio_resid;
168                 if (bytesinfile < xfersize)
169                         xfersize = bytesinfile;
170
171                 if (nextloffset >= ip->i_size) {
172                         /*
173                          * Don't do readahead if this is the end of the file.
174                          */
175                         error = bread(vp, loffset, size, &bp);
176                 } else if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
177                         /* 
178                          * Otherwise if we are allowed to cluster,
179                          * grab as much as we can.
180                          *
181                          * XXX  This may not be a win if we are not
182                          * doing sequential access.
183                          */
184                         error = cluster_read(vp, (off_t)ip->i_size, 
185                                              loffset, size, 
186                                              uio->uio_resid, seqcount, &bp);
187                 } else if (seqcount > 1) {
188                         /*
189                          * If we are NOT allowed to cluster, then
190                          * if we appear to be acting sequentially,
191                          * fire off a request for a readahead
192                          * as well as a read. Note that the 4th and 5th
193                          * arguments point to arrays of the size specified in
194                          * the 6th argument.
195                          */
196                         int nextsize = BLKSIZE(fs, ip, nextlbn);
197                         error = breadn(vp, loffset,
198                             size, &nextloffset, &nextsize, 1, &bp);
199                 } else {
200                         /*
201                          * Failing all of the above, just read what the 
202                          * user asked for. Interestingly, the same as
203                          * the first option above.
204                          */
205                         error = bread(vp, loffset, size, &bp);
206                 }
207                 if (error) {
208                         brelse(bp);
209                         bp = NULL;
210                         break;
211                 }
212
213                 /*
214                  * If IO_DIRECT then set B_DIRECT for the buffer.  This
215                  * will cause us to attempt to release the buffer later on
216                  * and will cause the buffer cache to attempt to free the
217                  * underlying pages.
218                  */
219                 if (ioflag & IO_DIRECT)
220                         bp->b_flags |= B_DIRECT;
221
222                 /*
223                  * We should only get non-zero b_resid when an I/O error
224                  * has occurred, which should cause us to break above.
225                  * However, if the short read did not cause an error,
226                  * then we want to ensure that we do not uiomove bad
227                  * or uninitialized data.
228                  *
229                  * XXX b_resid is only valid when an actual I/O has occured
230                  * and may be incorrect if the buffer is B_CACHE or if the
231                  * last op on the buffer was a failed write.  This KASSERT
232                  * is a precursor to removing it from the UFS code.
233                  */
234                 KASSERT(bp->b_resid == 0, ("bp->b_resid != 0"));
235                 size -= bp->b_resid;
236                 if (size < xfersize) {
237                         if (size == 0)
238                                 break;
239                         xfersize = size;
240                 }
241
242                 /*
243                  * otherwise use the general form
244                  */
245                 error = uiomove((char *)bp->b_data + blkoffset, 
246                                 (int)xfersize, uio);
247
248                 if (error)
249                         break;
250
251                 if ((ioflag & (IO_VMIO|IO_DIRECT)) && 
252                     (LIST_FIRST(&bp->b_dep) == NULL)) {
253                         /*
254                          * If there are no dependencies, and it's VMIO,
255                          * then we don't need the buf, mark it available
256                          * for freeing. The VM has the data.
257                          */
258                         bp->b_flags |= B_RELBUF;
259                         brelse(bp);
260                 } else {
261                         /*
262                          * Otherwise let whoever
263                          * made the request take care of
264                          * freeing it. We just queue
265                          * it onto another list.
266                          */
267                         bqrelse(bp);
268                 }
269         }
270
271         /* 
272          * This can only happen in the case of an error
273          * because the loop above resets bp to NULL on each iteration
274          * and on normal completion has not set a new value into it.
275          * so it must have come from a 'break' statement
276          */
277         if (bp != NULL) {
278                 if ((ioflag & (IO_VMIO|IO_DIRECT)) && 
279                     (LIST_FIRST(&bp->b_dep) == NULL)) {
280                         bp->b_flags |= B_RELBUF;
281                         brelse(bp);
282                 } else {
283                         bqrelse(bp);
284                 }
285         }
286
287         if (object)
288                 vm_object_vndeallocate(object);
289         if ((error == 0 || uio->uio_resid != orig_resid) &&
290             (vp->v_mount->mnt_flag & MNT_NOATIME) == 0)
291                 ip->i_flag |= IN_ACCESS;
292         return (error);
293 }
294
295 /*
296  * Vnode op for writing.
297  *
298  * ffs_write(struct vnode *a_vp, struct uio *a_uio, int a_ioflag,
299  *           struct ucred *a_cred)
300  */
301 int
302 ffs_write(struct vop_write_args *ap)
303 {
304         struct vnode *vp;
305         struct uio *uio;
306         struct inode *ip;
307         FS *fs;
308         struct buf *bp;
309         ufs_daddr_t lbn;
310         off_t osize;
311         int seqcount;
312         int blkoffset, error, extended, flags, ioflag, resid, size, xfersize;
313         vm_object_t object;
314         struct thread *td;
315
316         extended = 0;
317         seqcount = ap->a_ioflag >> 16;
318         ioflag = ap->a_ioflag;
319         uio = ap->a_uio;
320         vp = ap->a_vp;
321         ip = VTOI(vp);
322
323         object = vp->v_object;
324         if (object)
325                 vm_object_reference(object);
326
327 #ifdef DIAGNOSTIC
328         if (uio->uio_rw != UIO_WRITE)
329                 panic("ffs_write: mode");
330 #endif
331
332         switch (vp->v_type) {
333         case VREG:
334                 if (ioflag & IO_APPEND)
335                         uio->uio_offset = ip->i_size;
336                 if ((ip->i_flags & APPEND) && uio->uio_offset != ip->i_size) {
337                         if (object)
338                                 vm_object_vndeallocate(object);
339                         return (EPERM);
340                 }
341                 /* FALLTHROUGH */
342         case VLNK:
343                 break;
344         case VDIR:
345                 panic("ffs_write: dir write");
346                 break;
347         default:
348                 panic("ffs_write: type %p %d (%d,%d)", vp, (int)vp->v_type,
349                         (int)uio->uio_offset,
350                         (int)uio->uio_resid
351                 );
352         }
353
354         fs = ip->I_FS;
355         if (uio->uio_offset < 0 ||
356             (uint64_t)uio->uio_offset + uio->uio_resid > fs->fs_maxfilesize) {
357                 if (object)
358                         vm_object_vndeallocate(object);
359                 return (EFBIG);
360         }
361         /*
362          * Maybe this should be above the vnode op call, but so long as
363          * file servers have no limits, I don't think it matters.
364          */
365         td = uio->uio_td;
366         if (vp->v_type == VREG && td && td->td_proc &&
367             uio->uio_offset + uio->uio_resid >
368             td->td_proc->p_rlimit[RLIMIT_FSIZE].rlim_cur) {
369                 psignal(td->td_proc, SIGXFSZ);
370                 if (object)
371                         vm_object_vndeallocate(object);
372                 return (EFBIG);
373         }
374
375         resid = uio->uio_resid;
376         osize = ip->i_size;
377
378         /*
379          * NOTE! These B_ flags are actually balloc-only flags, not buffer
380          * flags.  They are similar to the BA_ flags in fbsd.
381          */
382         if (seqcount > B_SEQMAX)
383                 flags = B_SEQMAX << B_SEQSHIFT;
384         else
385                 flags = seqcount << B_SEQSHIFT;
386         if ((ioflag & IO_SYNC) && !DOINGASYNC(vp))
387                 flags |= B_SYNC;
388
389         if (object && (object->flags & OBJ_OPT)) {
390                 vm_freeze_copyopts(object,
391                         OFF_TO_IDX(uio->uio_offset),
392                         OFF_TO_IDX(uio->uio_offset + uio->uio_resid + PAGE_MASK));
393         }
394
395         for (error = 0; uio->uio_resid > 0;) {
396                 lbn = lblkno(fs, uio->uio_offset);
397                 blkoffset = blkoff(fs, uio->uio_offset);
398                 xfersize = fs->fs_bsize - blkoffset;
399                 if (uio->uio_resid < xfersize)
400                         xfersize = uio->uio_resid;
401
402                 if (uio->uio_offset + xfersize > ip->i_size)
403                         vnode_pager_setsize(vp, uio->uio_offset + xfersize);
404
405                 /*      
406                  * We must perform a read-before-write if the transfer
407                  * size does not cover the entire buffer.
408                  */
409                 if (fs->fs_bsize > xfersize)
410                         flags |= B_CLRBUF;
411                 else
412                         flags &= ~B_CLRBUF;
413 /* XXX is uio->uio_offset the right thing here? */
414                 error = VOP_BALLOC(vp, uio->uio_offset, xfersize,
415                     ap->a_cred, flags, &bp);
416                 if (error != 0)
417                         break;
418                 /*
419                  * If the buffer is not valid and we did not clear garbage
420                  * out above, we have to do so here even though the write
421                  * covers the entire buffer in order to avoid a mmap()/write
422                  * race where another process may see the garbage prior to
423                  * the uiomove() for a write replacing it.
424                  */
425                 if ((bp->b_flags & B_CACHE) == 0 && fs->fs_bsize <= xfersize)
426                         vfs_bio_clrbuf(bp);
427                 if (ioflag & IO_DIRECT)
428                         bp->b_flags |= B_DIRECT;
429                 if (ioflag & IO_NOWDRAIN)
430                         bp->b_flags |= B_NOWDRAIN;
431                 if ((ioflag & (IO_SYNC|IO_INVAL)) == (IO_SYNC|IO_INVAL))
432                         bp->b_flags |= B_NOCACHE;
433
434                 if (uio->uio_offset + xfersize > ip->i_size) {
435                         ip->i_size = uio->uio_offset + xfersize;
436                         extended = 1;
437                 }
438
439                 size = BLKSIZE(fs, ip, lbn) - bp->b_resid;
440                 if (size < xfersize)
441                         xfersize = size;
442
443                 error =
444                     uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio);
445                 if ((ioflag & (IO_VMIO|IO_DIRECT)) && 
446                     (LIST_FIRST(&bp->b_dep) == NULL)) {
447                         bp->b_flags |= B_RELBUF;
448                 }
449
450                 /*
451                  * If IO_SYNC each buffer is written synchronously.  Otherwise
452                  * if we have a severe page deficiency write the buffer 
453                  * asynchronously.  Otherwise try to cluster, and if that
454                  * doesn't do it then either do an async write (if O_DIRECT),
455                  * or a delayed write (if not).
456                  */
457
458                 if (ioflag & IO_SYNC) {
459                         (void)bwrite(bp);
460                 } else if (vm_page_count_severe() || 
461                             buf_dirty_count_severe() ||
462                             (ioflag & IO_ASYNC)) {
463                         bp->b_flags |= B_CLUSTEROK;
464                         bawrite(bp);
465                 } else if (xfersize + blkoffset == fs->fs_bsize) {
466                         if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0) {
467                                 bp->b_flags |= B_CLUSTEROK;
468                                 cluster_write(bp, (off_t)ip->i_size, seqcount);
469                         } else {
470                                 bawrite(bp);
471                         }
472                 } else if (ioflag & IO_DIRECT) {
473                         bp->b_flags |= B_CLUSTEROK;
474                         bawrite(bp);
475                 } else {
476                         bp->b_flags |= B_CLUSTEROK;
477                         bdwrite(bp);
478                 }
479                 if (error || xfersize == 0)
480                         break;
481                 ip->i_flag |= IN_CHANGE | IN_UPDATE;
482         }
483         /*
484          * If we successfully wrote any data, and we are not the superuser
485          * we clear the setuid and setgid bits as a precaution against
486          * tampering.
487          */
488         if (resid > uio->uio_resid && ap->a_cred && ap->a_cred->cr_uid != 0)
489                 ip->i_mode &= ~(ISUID | ISGID);
490         if (resid > uio->uio_resid)
491                 VN_KNOTE(vp, NOTE_WRITE | (extended ? NOTE_EXTEND : 0));
492         if (error) {
493                 if (ioflag & IO_UNIT) {
494                         (void)UFS_TRUNCATE(vp, osize,
495                             ioflag & IO_SYNC, ap->a_cred, uio->uio_td);
496                         uio->uio_offset -= resid - uio->uio_resid;
497                         uio->uio_resid = resid;
498                 }
499         } else if (resid > uio->uio_resid && (ioflag & IO_SYNC))
500                 error = UFS_UPDATE(vp, 1);
501
502         if (object)
503                 vm_object_vndeallocate(object);
504
505         return (error);
506 }
507
508
509 /*
510  * get page routine
511  */
512 int
513 ffs_getpages(struct vop_getpages_args *ap)
514 {
515         off_t foff, physoffset;
516         int i, size, bsize;
517         struct vnode *dp, *vp;
518         vm_object_t obj;
519         vm_pindex_t pindex, firstindex;
520         vm_page_t mreq;
521         int bbackwards, bforwards;
522         int pbackwards, pforwards;
523         int firstpage;
524         off_t reqoffset;
525         off_t doffset;
526         int poff;
527         int pcount;
528         int rtval;
529         int pagesperblock;
530
531
532         pcount = round_page(ap->a_count) / PAGE_SIZE;
533         mreq = ap->a_m[ap->a_reqpage];
534         firstindex = ap->a_m[0]->pindex;
535
536         /*
537          * if ANY DEV_BSIZE blocks are valid on a large filesystem block,
538          * then the entire page is valid.  Since the page may be mapped,
539          * user programs might reference data beyond the actual end of file
540          * occuring within the page.  We have to zero that data.
541          */
542         if (mreq->valid) {
543                 if (mreq->valid != VM_PAGE_BITS_ALL)
544                         vm_page_zero_invalid(mreq, TRUE);
545                 for (i = 0; i < pcount; i++) {
546                         if (i != ap->a_reqpage) {
547                                 vm_page_free(ap->a_m[i]);
548                         }
549                 }
550                 return VM_PAGER_OK;
551         }
552
553         vp = ap->a_vp;
554         obj = vp->v_object;
555         bsize = vp->v_mount->mnt_stat.f_iosize;
556         pindex = mreq->pindex;
557         foff = IDX_TO_OFF(pindex) /* + ap->a_offset should be zero */;
558
559         if (bsize < PAGE_SIZE)
560                 return vnode_pager_generic_getpages(ap->a_vp, ap->a_m,
561                                                     ap->a_count,
562                                                     ap->a_reqpage);
563
564         /*
565          * foff is the file offset of the required page
566          * reqlblkno is the logical block that contains the page
567          * poff is the bytes offset of the page in the logical block
568          */
569         poff = (int)(foff % bsize);
570         reqoffset = foff - poff;
571
572         if (VOP_BMAP(vp, reqoffset, &dp, &doffset,
573                 &bforwards, &bbackwards) || (doffset == NOOFFSET)
574         ) {
575                 for (i = 0; i < pcount; i++) {
576                         if (i != ap->a_reqpage)
577                                 vm_page_free(ap->a_m[i]);
578                 }
579                 if (doffset == NOOFFSET) {
580                         if ((mreq->flags & PG_ZERO) == 0)
581                                 vm_page_zero_fill(mreq);
582                         vm_page_undirty(mreq);
583                         mreq->valid = VM_PAGE_BITS_ALL;
584                         return VM_PAGER_OK;
585                 } else {
586                         return VM_PAGER_ERROR;
587                 }
588         }
589
590         physoffset = doffset + poff;
591         pagesperblock = bsize / PAGE_SIZE;
592
593         /*
594          * find the first page that is contiguous.
595          *
596          * bforwards and bbackwards are the number of contiguous bytes
597          * available before and after the block offset.  poff is the page
598          * offset, in bytes, relative to the block offset.
599          *
600          * pforwards and pbackwards are the number of contiguous pages
601          * relative to the requested page, non-inclusive of the requested
602          * page (so a pbackwards and  pforwards of 0 indicates just the
603          * requested page).
604          */
605         firstpage = 0;
606         if (ap->a_count) {
607                 /*
608                  * Calculate pbackwards and clean up any requested
609                  * pages that are too far back.
610                  */
611                 pbackwards = (poff + bbackwards) >> PAGE_SHIFT;
612                 if (ap->a_reqpage > pbackwards) {
613                         firstpage = ap->a_reqpage - pbackwards;
614                         for (i = 0; i < firstpage; i++)
615                                 vm_page_free(ap->a_m[i]);
616                 }
617
618                 /*
619                  * Calculate pforwards
620                  */
621                 pforwards = (bforwards - poff - PAGE_SIZE) >> PAGE_SHIFT;
622                 if (pforwards < 0)
623                         pforwards = 0;
624                 if (pforwards < (pcount - (ap->a_reqpage + 1))) {
625                         for(i = ap->a_reqpage + pforwards + 1; i < pcount; i++)
626                                 vm_page_free(ap->a_m[i]);
627                         pcount = ap->a_reqpage + pforwards + 1;
628                 }
629
630                 /*
631                  * Adjust pcount to be relative to firstpage.  All pages prior
632                  * to firstpage in the array have been cleaned up.
633                  */
634                 pcount -= firstpage;
635         }
636
637         /*
638          * calculate the size of the transfer
639          */
640         size = pcount * PAGE_SIZE;
641
642         if ((IDX_TO_OFF(ap->a_m[firstpage]->pindex) + size) > vp->v_filesize) {
643                 size = vp->v_filesize - IDX_TO_OFF(ap->a_m[firstpage]->pindex);
644         }
645
646         physoffset -= foff;
647         rtval = VOP_GETPAGES(dp, &ap->a_m[firstpage], size,
648                              (ap->a_reqpage - firstpage), physoffset);
649
650         return (rtval);
651 }
652
653 /*
654  * put page routine
655  *
656  * XXX By default, wimp out... note that a_offset is ignored (and always
657  * XXX has been).
658  */
659 int
660 ffs_putpages(struct vop_putpages_args *ap)
661 {
662         return vnode_pager_generic_putpages(ap->a_vp, ap->a_m, ap->a_count,
663                 ap->a_sync, ap->a_rtvals);
664 }