ext2_alloc.c (212079) | ext2_alloc.c (217585) |
---|---|
1/*- 2 * modified for Lites 1.1 3 * 4 * Aug 1995, Godmar Back (gback@cs.utah.edu) 5 * University of Utah, Department of Computer Science 6 */ 7/*- 8 * Copyright (c) 1982, 1986, 1989, 1993 --- 19 unchanged lines hidden (view full) --- 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 * @(#)ffs_alloc.c 8.8 (Berkeley) 2/21/94 | 1/*- 2 * modified for Lites 1.1 3 * 4 * Aug 1995, Godmar Back (gback@cs.utah.edu) 5 * University of Utah, Department of Computer Science 6 */ 7/*- 8 * Copyright (c) 1982, 1986, 1989, 1993 --- 19 unchanged lines hidden (view full) --- 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 * @(#)ffs_alloc.c 8.8 (Berkeley) 2/21/94 |
36 * $FreeBSD: head/sys/fs/ext2fs/ext2_alloc.c 212079 2010-09-01 05:34:17Z lulf $ | 36 * $FreeBSD: head/sys/fs/ext2fs/ext2_alloc.c 217585 2011-01-19 16:55:32Z jhb $ |
37 */ 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/conf.h> 42#include <sys/vnode.h> 43#include <sys/stat.h> 44#include <sys/mount.h> --- 26 unchanged lines hidden (view full) --- 71 * available block is located. 72 * If no block preference is given the following hierarchy is used 73 * to allocate a block: 74 * 1) allocate a block in the cylinder group that contains the 75 * inode for the file. 76 * 2) quadradically rehash into other cylinder groups, until an 77 * available block is located. 78 */ | 37 */ 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/conf.h> 42#include <sys/vnode.h> 43#include <sys/stat.h> 44#include <sys/mount.h> --- 26 unchanged lines hidden (view full) --- 71 * available block is located. 72 * If no block preference is given the following hierarchy is used 73 * to allocate a block: 74 * 1) allocate a block in the cylinder group that contains the 75 * inode for the file. 76 * 2) quadradically rehash into other cylinder groups, until an 77 * available block is located. 78 */ |
79 | |
80int 81ext2_alloc(ip, lbn, bpref, size, cred, bnp) 82 struct inode *ip; 83 int32_t lbn, bpref; 84 int size; 85 struct ucred *cred; 86 int32_t *bnp; 87{ --- 129 unchanged lines hidden (view full) --- 217 return (ENOSPC); 218 } 219 sbap = (int32_t *)sbp->b_data; 220 soff = idp->in_off; 221 } 222 /* 223 * Find the preferred location for the cluster. 224 */ | 79int 80ext2_alloc(ip, lbn, bpref, size, cred, bnp) 81 struct inode *ip; 82 int32_t lbn, bpref; 83 int size; 84 struct ucred *cred; 85 int32_t *bnp; 86{ --- 129 unchanged lines hidden (view full) --- 216 return (ENOSPC); 217 } 218 sbap = (int32_t *)sbp->b_data; 219 soff = idp->in_off; 220 } 221 /* 222 * Find the preferred location for the cluster. 223 */ |
225 EXT2_LOCK(ump); | 224 EXT2_LOCK(ump); |
226 pref = ext2_blkpref(ip, start_lbn, soff, sbap, blkno); 227 /* 228 * If the block range spans two block maps, get the second map. 229 */ 230 if (end_lvl == 0 || (idp = &end_ap[end_lvl - 1])->in_off + 1 >= len) { 231 ssize = len; 232 } else { 233#ifdef DIAGNOSTIC --- 726 unchanged lines hidden --- | 225 pref = ext2_blkpref(ip, start_lbn, soff, sbap, blkno); 226 /* 227 * If the block range spans two block maps, get the second map. 228 */ 229 if (end_lvl == 0 || (idp = &end_ap[end_lvl - 1])->in_off + 1 >= len) { 230 ssize = len; 231 } else { 232#ifdef DIAGNOSTIC --- 726 unchanged lines hidden --- |