1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 5 unchanged lines hidden (view full) --- 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* |
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. |
23 * Use is subject to license terms. 24 */ 25 |
26/* 27 * This file contains the code to implement file range locking in 28 * ZFS, although there isn't much specific to ZFS (all that comes to mind 29 * support for growing the blocksize). 30 * 31 * Interface 32 * --------- 33 * Defined in zfs_rlock.h but essentially: --- 390 unchanged lines hidden (view full) --- 424{ 425 rl_t *new; 426 427 ASSERT(type == RL_READER || type == RL_WRITER || type == RL_APPEND); 428 429 new = kmem_alloc(sizeof (rl_t), KM_SLEEP); 430 new->r_zp = zp; 431 new->r_off = off; |
432 if (len + off < off) /* overflow */ 433 len = UINT64_MAX - off; |
434 new->r_len = len; 435 new->r_cnt = 1; /* assume it's going to be in the tree */ 436 new->r_type = type; 437 new->r_proxy = B_FALSE; 438 new->r_write_wanted = B_FALSE; 439 new->r_read_wanted = B_FALSE; 440 441 mutex_enter(&zp->z_range_lock); --- 161 unchanged lines hidden --- |