usr/src/uts/common/fs/zfs/zfs_vnops.c
changeset 9265 0ddbce3734dc
parent 9179 d8fbd96b79b3
child 9321 dca349c475c1
equal deleted inserted replaced
9264:e1b435ce53de 9265:0ddbce3734dc
  3876 
  3876 
  3877 /*
  3877 /*
  3878  * If we can't find a page in the cache, we will create a new page
  3878  * If we can't find a page in the cache, we will create a new page
  3879  * and fill it with file data.  For efficiency, we may try to fill
  3879  * and fill it with file data.  For efficiency, we may try to fill
  3880  * multiple pages at once (klustering) to fill up the supplied page
  3880  * multiple pages at once (klustering) to fill up the supplied page
  3881  * list.
  3881  * list.  Note that the pages to be filled are held with an exclusive
       
  3882  * lock to prevent access by other threads while they are being filled.
  3882  */
  3883  */
  3883 static int
  3884 static int
  3884 zfs_fillpage(vnode_t *vp, u_offset_t off, struct seg *seg,
  3885 zfs_fillpage(vnode_t *vp, u_offset_t off, struct seg *seg,
  3885     caddr_t addr, page_t *pl[], size_t plsz, enum seg_rw rw)
  3886     caddr_t addr, page_t *pl[], size_t plsz, enum seg_rw rw)
  3886 {
  3887 {
  3895 		/*
  3896 		/*
  3896 		 * We only have a single page, don't bother klustering
  3897 		 * We only have a single page, don't bother klustering
  3897 		 */
  3898 		 */
  3898 		io_off = off;
  3899 		io_off = off;
  3899 		io_len = PAGESIZE;
  3900 		io_len = PAGESIZE;
  3900 		pp = page_create_va(vp, io_off, io_len, PG_WAIT, seg, addr);
  3901 		pp = page_create_va(vp, io_off, io_len,
       
  3902 		    PG_EXCL | PG_WAIT, seg, addr);
  3901 	} else {
  3903 	} else {
  3902 		/*
  3904 		/*
  3903 		 * Try to find enough pages to fill the page list
  3905 		 * Try to find enough pages to fill the page list
  3904 		 */
  3906 		 */
  3905 		pp = pvn_read_kluster(vp, off, seg, addr, &io_off,
  3907 		pp = pvn_read_kluster(vp, off, seg, addr, &io_off,
  3998 
  4000 
  3999 	if (protp)
  4001 	if (protp)
  4000 		*protp = PROT_ALL;
  4002 		*protp = PROT_ALL;
  4001 
  4003 
  4002 	/*
  4004 	/*
  4003 	 * Loop through the requested range [off, off + len] looking
  4005 	 * Loop through the requested range [off, off + len) looking
  4004 	 * for pages.  If we don't find a page, we will need to create
  4006 	 * for pages.  If we don't find a page, we will need to create
  4005 	 * a new page and fill it with data from the file.
  4007 	 * a new page and fill it with data from the file.
  4006 	 */
  4008 	 */
  4007 	while (len > 0) {
  4009 	while (len > 0) {
  4008 		if (*pl = page_lookup(vp, off, SE_SHARED))
  4010 		if (*pl = page_lookup(vp, off, SE_SHARED))