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 jfs_error(ip->i_sb, "read-only filesystem\n"); in extAlloc()
79 return -EIO; in extAlloc()
83 txBeginAnon(ip->i_sb); in extAlloc()
86 mutex_lock(&JFS_IP(ip)->commit_mutex); in extAlloc()
89 if (xlen > MAXXLEN) in extAlloc()
90 xlen = MAXXLEN; in extAlloc()
93 xoff = pno << sbi->l2nbperpage; in extAlloc()
109 abnr == ((xp->flag & XAD_NOTRECORDED) ? true : false)) in extAlloc()
113 hint += (nxlen - 1); in extAlloc()
117 * will try to allocate disk blocks for the requested size (xlen). in extAlloc()
118 * if this fails (xlen contiguous free blocks not available), it'll in extAlloc()
122 * power of 2 number (i.e. 16 -> 8). it'll continue to round down in extAlloc()
126 nxlen = xlen; in extAlloc()
128 mutex_unlock(&JFS_IP(ip)->commit_mutex); in extAlloc()
136 mutex_unlock(&JFS_IP(ip)->commit_mutex); in extAlloc()
158 mutex_unlock(&JFS_IP(ip)->commit_mutex); in extAlloc()
166 xp->flag = xflag; in extAlloc()
170 mutex_unlock(&JFS_IP(ip)->commit_mutex); in extAlloc()
188 * ip - the inode of the file.
189 * offset - file offset for which the hint is needed.
190 * xp - pointer to the xad that is to be filled in with
194 * 0 - success
195 * -EIO - i/o error.
199 struct super_block *sb = ip->i_sb; in extHint()
200 int nbperpage = JFS_SBI(sb)->nbperpage; in extHint()
204 int xlen; in extHint() local
213 prev = ((offset & ~POFFSET) >> JFS_SBI(sb)->l2bsize) - nbperpage; in extHint()
220 rc = xtLookup(ip, prev, nbperpage, &xflag, &xaddr, &xlen, 0); in extHint()
222 if ((rc == 0) && xlen) { in extHint()
223 if (xlen != nbperpage) { in extHint()
224 jfs_error(ip->i_sb, "corrupt xtree\n"); in extHint()
225 rc = -EIO; in extHint()
228 XADlength(xp, xlen); in extHint()
234 xp->flag = xflag & XAD_NOTRECORDED; in extHint()
249 * ip - inode of the file.
250 * cp - cbuf of the file page.
253 * 0 - success
254 * -EIO - i/o error.
255 * -ENOSPC - insufficient disk resources.
262 jfs_error(ip->i_sb, "read-only filesystem\n"); in extRecord()
263 return -EIO; in extRecord()
266 txBeginAnon(ip->i_sb); in extRecord()
268 mutex_lock(&JFS_IP(ip)->commit_mutex); in extRecord()
273 mutex_unlock(&JFS_IP(ip)->commit_mutex); in extRecord()
288 * number (i.e. 16 -> 8). we'll continue to round down and
293 * ip - the inode of the file.
294 * hint - disk block number to be used as an allocation hint.
295 * *nblocks - pointer to an s64 value. on entry, this value specifies
299 * blkno - pointer to a block address that is filled in on successful
304 * 0 - success
305 * -EIO - i/o error.
306 * -ENOSPC - insufficient disk resources.
312 struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb); in extBalloc()
314 int rc, nbperpage = sbi->nbperpage; in extBalloc()
315 struct bmap *bmp = sbi->bmap; in extBalloc()
326 if (bmp->db_maxfreebud == -1) in extBalloc()
327 return -ENOSPC; in extBalloc()
329 max = (s64) 1 << bmp->db_maxfreebud; in extBalloc()
340 if (rc != -ENOSPC) in extBalloc()
354 if (S_ISREG(ip->i_mode) && (ji->fileset == FILESYSTEM_I)) { in extBalloc()
356 spin_lock_irq(&ji->ag_lock); in extBalloc()
357 if (ji->active_ag == -1) { in extBalloc()
358 atomic_inc(&bmp->db_active[ag]); in extBalloc()
359 ji->active_ag = ag; in extBalloc()
360 } else if (ji->active_ag != ag) { in extBalloc()
361 atomic_dec(&bmp->db_active[ji->active_ag]); in extBalloc()
362 atomic_inc(&bmp->db_active[ag]); in extBalloc()
363 ji->active_ag = ag; in extBalloc()
365 spin_unlock_irq(&ji->ag_lock); in extBalloc()
378 * nb - the inode of the file.
388 for (i = 0, m = (u64) 1 << 63; i < 64; i++, m >>= 1) { in extRoundDown()
393 i = 63 - i; in extRoundDown()
394 k = (u64) 1 << i; in extRoundDown()
395 k = ((k - 1) & nb) ? k : k >> 1; in extRoundDown()