Lines Matching +full:ip +full:- +full:block

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()
88 xoff = pno << sbi->l2nbperpage; in extAlloc()
104 abnr == ((xp->flag & XAD_NOTRECORDED) ? true : false)) in extAlloc()
107 /* adjust the hint to the last block of the extent */ in extAlloc()
108 hint += (nxlen - 1); in extAlloc()
117 * power of 2 number (i.e. 16 -> 8). it'll continue to round down in extAlloc()
122 if ((rc = extBalloc(ip, hint ? hint : INOHINT(ip), &nxlen, &nxaddr))) { in extAlloc()
123 mutex_unlock(&JFS_IP(ip)->commit_mutex); in extAlloc()
128 rc = dquot_alloc_block(ip, nxlen); in extAlloc()
130 dbFree(ip, nxaddr, (s64) nxlen); in extAlloc()
131 mutex_unlock(&JFS_IP(ip)->commit_mutex); in extAlloc()
143 rc = xtExtend(0, ip, xoff, (int) nxlen, 0); in extAlloc()
145 rc = xtInsert(0, ip, xflag, xoff, (int) nxlen, &nxaddr, 0); in extAlloc()
151 dbFree(ip, nxaddr, nxlen); in extAlloc()
152 dquot_free_block(ip, nxlen); in extAlloc()
153 mutex_unlock(&JFS_IP(ip)->commit_mutex); in extAlloc()
161 xp->flag = xflag; in extAlloc()
163 mark_inode_dirty(ip); in extAlloc()
165 mutex_unlock(&JFS_IP(ip)->commit_mutex); in extAlloc()
171 if (test_and_clear_cflag(COMMIT_Synclist,ip)) in extAlloc()
172 jfs_commit_inode(ip, 0); 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.
192 int extHint(struct inode *ip, s64 offset, xad_t * xp) in extHint() argument
194 struct super_block *sb = ip->i_sb; in extHint()
195 int nbperpage = JFS_SBI(sb)->nbperpage; in extHint()
208 prev = ((offset & ~POFFSET) >> JFS_SBI(sb)->l2bsize) - nbperpage; in extHint()
215 rc = xtLookup(ip, prev, nbperpage, &xflag, &xaddr, &xlen, 0); in extHint()
219 jfs_error(ip->i_sb, "corrupt xtree\n"); in extHint()
220 rc = -EIO; 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.
252 int extRecord(struct inode *ip, xad_t * xp) in extRecord() argument
256 txBeginAnon(ip->i_sb); in extRecord()
258 mutex_lock(&JFS_IP(ip)->commit_mutex); in extRecord()
261 rc = xtUpdate(0, ip, xp); 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
286 * the desired number of block to be allocated. on successful
289 * blkno - pointer to a block address that is filled in on successful
290 * return with the starting block number of the newly
291 * allocated block range.
294 * 0 - success
295 * -EIO - i/o error.
296 * -ENOSPC - insufficient disk resources.
299 extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno) in extBalloc() argument
301 struct jfs_inode_info *ji = JFS_IP(ip); in extBalloc()
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()
326 while ((rc = dbAlloc(ip, hint, nb, &daddr)) != 0) { 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.
383 i = 63 - i; in extRoundDown()
385 k = ((k - 1) & nb) ? k : k >> 1; in extRoundDown()