fuse_io.c (248084) | fuse_io.c (298806) |
---|---|
1/* 2 * Copyright (c) 2007-2009 Google Inc. 3 * 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 are 7 * met: 8 * --- 40 unchanged lines hidden (view full) --- 49 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 50 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 52 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 53 * SUCH DAMAGE. 54 */ 55 56#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 2007-2009 Google Inc. 3 * 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 are 7 * met: 8 * --- 40 unchanged lines hidden (view full) --- 49 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 50 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 52 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 53 * SUCH DAMAGE. 54 */ 55 56#include <sys/cdefs.h> |
57__FBSDID("$FreeBSD: head/sys/fs/fuse/fuse_io.c 248084 2013-03-09 02:32:23Z attilio $"); | 57__FBSDID("$FreeBSD: head/sys/fs/fuse/fuse_io.c 298806 2016-04-29 20:51:24Z pfg $"); |
58 59#include <sys/types.h> 60#include <sys/module.h> 61#include <sys/systm.h> 62#include <sys/errno.h> 63#include <sys/param.h> 64#include <sys/kernel.h> 65#include <sys/conf.h> --- 138 unchanged lines hidden (view full) --- 204 FS_DEBUG2G("biosize %d, lbn %d, on %d\n", biosize, (int)lbn, on); 205 206 /* 207 * Obtain the buffer cache block. Figure out the buffer size 208 * when we are at EOF. If we are modifying the size of the 209 * buffer based on an EOF condition we need to hold 210 * nfs_rslock() through obtaining the buffer to prevent 211 * a potential writer-appender from messing with n_size. | 58 59#include <sys/types.h> 60#include <sys/module.h> 61#include <sys/systm.h> 62#include <sys/errno.h> 63#include <sys/param.h> 64#include <sys/kernel.h> 65#include <sys/conf.h> --- 138 unchanged lines hidden (view full) --- 204 FS_DEBUG2G("biosize %d, lbn %d, on %d\n", biosize, (int)lbn, on); 205 206 /* 207 * Obtain the buffer cache block. Figure out the buffer size 208 * when we are at EOF. If we are modifying the size of the 209 * buffer based on an EOF condition we need to hold 210 * nfs_rslock() through obtaining the buffer to prevent 211 * a potential writer-appender from messing with n_size. |
212 * Otherwise we may accidently truncate the buffer and | 212 * Otherwise we may accidentally truncate the buffer and |
213 * lose dirty data. 214 * 215 * Note that bcount is *not* DEV_BSIZE aligned. 216 */ 217 if ((off_t)lbn * biosize >= filesize) { 218 bcount = 0; 219 } else if ((off_t)(lbn + 1) * biosize > filesize) { 220 bcount = filesize - (off_t)lbn *biosize; --- 320 unchanged lines hidden (view full) --- 541 * have to commit them separately so there isn't much 542 * advantage to it except perhaps a bit of asynchronization. 543 */ 544 545 if (bp->b_dirtyend > 0 && 546 (on > bp->b_dirtyend || (on + n) < bp->b_dirtyoff)) { 547 /* 548 * Yes, we mean it. Write out everything to "storage" | 213 * lose dirty data. 214 * 215 * Note that bcount is *not* DEV_BSIZE aligned. 216 */ 217 if ((off_t)lbn * biosize >= filesize) { 218 bcount = 0; 219 } else if ((off_t)(lbn + 1) * biosize > filesize) { 220 bcount = filesize - (off_t)lbn *biosize; --- 320 unchanged lines hidden (view full) --- 541 * have to commit them separately so there isn't much 542 * advantage to it except perhaps a bit of asynchronization. 543 */ 544 545 if (bp->b_dirtyend > 0 && 546 (on > bp->b_dirtyend || (on + n) < bp->b_dirtyoff)) { 547 /* 548 * Yes, we mean it. Write out everything to "storage" |
549 * immediatly, without hesitation. (Apart from other | 549 * immediately, without hesitation. (Apart from other |
550 * reasons: the only way to know if a write is valid 551 * if its actually written out.) 552 */ 553 bwrite(bp); 554 if (bp->b_error == EINTR) { 555 err = EINTR; 556 break; 557 } --- 253 unchanged lines hidden --- | 550 * reasons: the only way to know if a write is valid 551 * if its actually written out.) 552 */ 553 bwrite(bp); 554 if (bp->b_error == EINTR) { 555 err = EINTR; 556 break; 557 } --- 253 unchanged lines hidden --- |