Lines Matching +full:xlen +full:- +full:1
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) International Business Machines Corp., 2000-2004
54 * ip - the inode of the file.
55 * xlen - requested extent length.
56 * pno - the starting page number with the file.
57 * xp - pointer to an xad. on entry, xad describes an
59 * xaddr of the xad is non-zero. on successful exit,
61 * abnr - bool indicating whether the newly allocated extent
65 * 0 - success
66 * -EIO - i/o error.
67 * -ENOSPC - insufficient disk resources.
70 extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, bool abnr) in extAlloc() argument
72 struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb); in extAlloc()
78 txBeginAnon(ip->i_sb); in extAlloc()
81 mutex_lock(&JFS_IP(ip)->commit_mutex); in extAlloc()
84 if (xlen > MAXXLEN) in extAlloc()
85 xlen = MAXXLEN; in extAlloc()
88 xoff = pno << sbi->l2nbperpage; in extAlloc()
104 abnr == ((xp->flag & XAD_NOTRECORDED) ? true : false)) in extAlloc()
108 hint += (nxlen - 1); in extAlloc()
112 * will try to allocate disk blocks for the requested size (xlen). in extAlloc()
113 * if this fails (xlen contiguous free blocks not available), it'll in extAlloc()
117 * power of 2 number (i.e. 16 -> 8). it'll continue to round down in extAlloc()
121 nxlen = xlen; in extAlloc()
123 mutex_unlock(&JFS_IP(ip)->commit_mutex); in extAlloc()
131 mutex_unlock(&JFS_IP(ip)->commit_mutex); in extAlloc()
153 mutex_unlock(&JFS_IP(ip)->commit_mutex); in extAlloc()
161 xp->flag = xflag; in extAlloc()
165 mutex_unlock(&JFS_IP(ip)->commit_mutex); in extAlloc()
183 * ip - the inode of the file.
184 * offset - file offset for which the hint is needed.
185 * xp - pointer to the xad that is to be filled in with
189 * 0 - success
190 * -EIO - i/o error.
194 struct super_block *sb = ip->i_sb; in extHint()
195 int nbperpage = JFS_SBI(sb)->nbperpage; in extHint()
199 int xlen; in extHint() local
208 prev = ((offset & ~POFFSET) >> JFS_SBI(sb)->l2bsize) - nbperpage; in extHint()
215 rc = xtLookup(ip, prev, nbperpage, &xflag, &xaddr, &xlen, 0); in extHint()
217 if ((rc == 0) && xlen) { in extHint()
218 if (xlen != nbperpage) { in extHint()
219 jfs_error(ip->i_sb, "corrupt xtree\n"); in extHint()
220 rc = -EIO; in extHint()
223 XADlength(xp, xlen); in extHint()
229 xp->flag = xflag & XAD_NOTRECORDED; in extHint()
244 * ip - inode of the file.
245 * cp - cbuf of the file page.
248 * 0 - success
249 * -EIO - i/o error.
250 * -ENOSPC - insufficient disk resources.
256 txBeginAnon(ip->i_sb); in extRecord()
258 mutex_lock(&JFS_IP(ip)->commit_mutex); in extRecord()
263 mutex_unlock(&JFS_IP(ip)->commit_mutex); in extRecord()
278 * number (i.e. 16 -> 8). we'll continue to round down and
283 * ip - the inode of the file.
284 * hint - disk block number to be used as an allocation hint.
285 * *nblocks - pointer to an s64 value. on entry, this value specifies
289 * blkno - pointer to a block address that is filled in on successful
294 * 0 - success
295 * -EIO - i/o error.
296 * -ENOSPC - insufficient disk resources.
302 struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb); in extBalloc()
304 int rc, nbperpage = sbi->nbperpage; in extBalloc()
305 struct bmap *bmp = sbi->bmap; in extBalloc()
316 if (bmp->db_maxfreebud == -1) in extBalloc()
317 return -ENOSPC; in extBalloc()
319 max = (s64) 1 << bmp->db_maxfreebud; in extBalloc()
330 if (rc != -ENOSPC) in extBalloc()
344 if (S_ISREG(ip->i_mode) && (ji->fileset == FILESYSTEM_I)) { in extBalloc()
346 spin_lock_irq(&ji->ag_lock); in extBalloc()
347 if (ji->active_ag == -1) { in extBalloc()
348 atomic_inc(&bmp->db_active[ag]); in extBalloc()
349 ji->active_ag = ag; in extBalloc()
350 } else if (ji->active_ag != ag) { in extBalloc()
351 atomic_dec(&bmp->db_active[ji->active_ag]); in extBalloc()
352 atomic_inc(&bmp->db_active[ag]); in extBalloc()
353 ji->active_ag = ag; in extBalloc()
355 spin_unlock_irq(&ji->ag_lock); in extBalloc()
368 * nb - the inode of the file.
378 for (i = 0, m = (u64) 1 << 63; i < 64; i++, m >>= 1) { in extRoundDown()
383 i = 63 - i; in extRoundDown()
384 k = (u64) 1 << i; in extRoundDown()
385 k = ((k - 1) & nb) ? k : k >> 1; in extRoundDown()