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
4 * Portions Copyright (C) Christoph Hellwig, 2001-2002
38 dxd_t *ea = &JFS_IP(inode)->ea; in free_ea_wmap()
40 if (ea->flag & DXD_EXTENT) { in free_ea_wmap()
45 ea->flag = 0; in free_ea_wmap()
54 * PARAMETER: dip - parent directory vnode
55 * dentry - dentry of new file
56 * mode - create mode (rwxrwxrwx).
57 * nd- nd struct
98 tid = txBegin(dip->i_sb, 0); in jfs_create()
100 mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT); in jfs_create()
101 mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD); in jfs_create()
107 rc = jfs_init_security(tid, ip, dip, &dentry->d_name); in jfs_create()
120 tblk->xflag |= COMMIT_CREATE; in jfs_create()
121 tblk->ino = ip->i_ino; in jfs_create()
122 tblk->u.ixpxd = JFS_IP(ip)->ixpxd; in jfs_create()
125 iplist[1] = ip; in jfs_create()
128 * initialize the child XAD tree root in-line in inode in jfs_create()
136 ino = ip->i_ino; in jfs_create()
138 if (rc == -EIO) { in jfs_create()
139 jfs_err("jfs_create: dtInsert returned -EIO"); in jfs_create()
140 txAbort(tid, 1); /* Marks Filesystem dirty */ in jfs_create()
146 ip->i_op = &jfs_file_inode_operations; in jfs_create()
147 ip->i_fop = &jfs_file_operations; in jfs_create()
148 ip->i_mapping->a_ops = &jfs_aops; in jfs_create()
160 mutex_unlock(&JFS_IP(ip)->commit_mutex); in jfs_create()
161 mutex_unlock(&JFS_IP(dip)->commit_mutex); in jfs_create()
186 * PARAMETER: dip - parent directory vnode
187 * dentry - dentry of child directory
188 * mode - create mode (rwxrwxrwx).
231 tid = txBegin(dip->i_sb, 0); in jfs_mkdir()
233 mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT); in jfs_mkdir()
234 mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD); in jfs_mkdir()
240 rc = jfs_init_security(tid, ip, dip, &dentry->d_name); in jfs_mkdir()
253 tblk->xflag |= COMMIT_CREATE; in jfs_mkdir()
254 tblk->ino = ip->i_ino; in jfs_mkdir()
255 tblk->u.ixpxd = JFS_IP(ip)->ixpxd; in jfs_mkdir()
258 iplist[1] = ip; in jfs_mkdir()
261 * initialize the child directory in-line in inode in jfs_mkdir()
263 dtInitRoot(tid, ip, dip->i_ino); in jfs_mkdir()
269 ino = ip->i_ino; in jfs_mkdir()
271 if (rc == -EIO) { in jfs_mkdir()
272 jfs_err("jfs_mkdir: dtInsert returned -EIO"); in jfs_mkdir()
273 txAbort(tid, 1); /* Marks Filesystem dirty */ in jfs_mkdir()
280 ip->i_op = &jfs_dir_inode_operations; in jfs_mkdir()
281 ip->i_fop = &jfs_dir_operations; in jfs_mkdir()
294 mutex_unlock(&JFS_IP(ip)->commit_mutex); in jfs_mkdir()
295 mutex_unlock(&JFS_IP(dip)->commit_mutex); in jfs_mkdir()
319 * PARAMETER: dip - parent inode
320 * dentry - child directory dentry
322 * RETURN: -EINVAL - if name is . or ..
323 * -EINVAL - if . or .. exist but are invalid.
355 rc = -ENOTEMPTY; in jfs_rmdir()
363 tid = txBegin(dip->i_sb, 0); in jfs_rmdir()
365 mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT); in jfs_rmdir()
366 mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD); in jfs_rmdir()
369 iplist[1] = ip; in jfs_rmdir()
372 tblk->xflag |= COMMIT_DELETE; in jfs_rmdir()
373 tblk->u.ip = ip; in jfs_rmdir()
378 ino = ip->i_ino; in jfs_rmdir()
381 if (rc == -EIO) in jfs_rmdir()
382 txAbort(tid, 1); in jfs_rmdir()
384 mutex_unlock(&JFS_IP(ip)->commit_mutex); in jfs_rmdir()
385 mutex_unlock(&JFS_IP(dip)->commit_mutex); in jfs_rmdir()
400 if (JFS_IP(ip)->ea.flag & DXD_EXTENT) { in jfs_rmdir()
402 txEA(tid, ip, &JFS_IP(ip)->ea, NULL); in jfs_rmdir()
404 JFS_IP(ip)->ea.flag = 0; in jfs_rmdir()
407 if (JFS_IP(ip)->acl.flag & DXD_EXTENT) { in jfs_rmdir()
409 txEA(tid, ip, &JFS_IP(ip)->acl, NULL); in jfs_rmdir()
411 JFS_IP(ip)->acl.flag = 0; in jfs_rmdir()
421 mutex_unlock(&JFS_IP(ip)->commit_mutex); in jfs_rmdir()
422 mutex_unlock(&JFS_IP(dip)->commit_mutex); in jfs_rmdir()
429 if (dip->i_size > 1) in jfs_rmdir()
449 * PARAMETER: dip - inode of parent directory
450 * dentry - dentry of object to be removed
490 tid = txBegin(dip->i_sb, 0); in jfs_unlink()
492 mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT); in jfs_unlink()
493 mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD); in jfs_unlink()
496 iplist[1] = ip; in jfs_unlink()
501 ino = ip->i_ino; in jfs_unlink()
504 if (rc == -EIO) in jfs_unlink()
505 txAbort(tid, 1); /* Marks FS Dirty */ in jfs_unlink()
507 mutex_unlock(&JFS_IP(ip)->commit_mutex); in jfs_unlink()
508 mutex_unlock(&JFS_IP(dip)->commit_mutex); in jfs_unlink()
513 ASSERT(ip->i_nlink); in jfs_unlink()
525 if (ip->i_nlink == 0) { in jfs_unlink()
529 txAbort(tid, 1); /* Marks FS Dirty */ in jfs_unlink()
531 mutex_unlock(&JFS_IP(ip)->commit_mutex); in jfs_unlink()
532 mutex_unlock(&JFS_IP(dip)->commit_mutex); in jfs_unlink()
538 tblk->xflag |= COMMIT_DELETE; in jfs_unlink()
539 tblk->u.ip = ip; in jfs_unlink()
560 mutex_unlock(&JFS_IP(ip)->commit_mutex); in jfs_unlink()
561 mutex_unlock(&JFS_IP(dip)->commit_mutex); in jfs_unlink()
564 tid = txBegin(dip->i_sb, 0); in jfs_unlink()
565 mutex_lock(&JFS_IP(ip)->commit_mutex); in jfs_unlink()
568 txAbort(tid, 1); /* Marks FS Dirty */ in jfs_unlink()
573 mutex_unlock(&JFS_IP(ip)->commit_mutex); in jfs_unlink()
576 if (ip->i_nlink == 0) in jfs_unlink()
586 if (dip->i_size > 1) in jfs_unlink()
602 * FUNCTION: for non-directory, called by jfs_remove(),
614 * (? for temporary file - memory object is cached even
616 * reference count > 0 - )
618 * PARAMETERS: cd - pointer to commit data structure.
630 filetype = ip->i_mode & S_IFMT; in commitZeroLink()
636 if (ip->i_size < IDATASIZE) { in commitZeroLink()
637 ip->i_size = 0; in commitZeroLink()
650 tblk->xflag |= COMMIT_PMAP; in commitZeroLink()
655 if (JFS_IP(ip)->ea.flag & DXD_EXTENT) in commitZeroLink()
657 txEA(tid, ip, &JFS_IP(ip)->ea, NULL); in commitZeroLink()
662 if (JFS_IP(ip)->acl.flag & DXD_EXTENT) in commitZeroLink()
664 txEA(tid, ip, &JFS_IP(ip)->acl, NULL); in commitZeroLink()
672 if (ip->i_size) in commitZeroLink()
682 * FUNCTION: for non-directory, called by iClose(),
687 * PARAMETER: ip - pointer to inode of file.
698 type = ip->i_mode & S_IFMT; in jfs_free_zero_link()
705 if (ip->i_size < IDATASIZE) in jfs_free_zero_link()
715 if (JFS_IP(ip)->ea.flag & DXD_EXTENT) { in jfs_free_zero_link()
716 s64 xaddr = addressDXD(&JFS_IP(ip)->ea); in jfs_free_zero_link()
717 int xlen = lengthDXD(&JFS_IP(ip)->ea); in jfs_free_zero_link() local
722 invalidate_dxd_metapages(ip, JFS_IP(ip)->ea); in jfs_free_zero_link()
725 maplock.index = 1; in jfs_free_zero_link()
727 pxdlock->flag = mlckFREEPXD; in jfs_free_zero_link()
728 PXDaddress(&pxdlock->pxd, xaddr); in jfs_free_zero_link()
729 PXDlength(&pxdlock->pxd, xlen); in jfs_free_zero_link()
736 if (JFS_IP(ip)->acl.flag & DXD_EXTENT) { in jfs_free_zero_link()
737 s64 xaddr = addressDXD(&JFS_IP(ip)->acl); in jfs_free_zero_link()
738 int xlen = lengthDXD(&JFS_IP(ip)->acl); in jfs_free_zero_link() local
742 invalidate_dxd_metapages(ip, JFS_IP(ip)->acl); in jfs_free_zero_link()
745 maplock.index = 1; in jfs_free_zero_link()
747 pxdlock->flag = mlckFREEPXD; in jfs_free_zero_link()
748 PXDaddress(&pxdlock->pxd, xaddr); in jfs_free_zero_link()
749 PXDlength(&pxdlock->pxd, xlen); in jfs_free_zero_link()
758 if (ip->i_size) in jfs_free_zero_link()
768 * PARAMETER: vp - target object
769 * dvp - parent directory of new link
770 * name - name of new link to target object
771 * crp - credential
804 jfs_error(ip->i_sb, "read-only filesystem\n"); in jfs_link()
805 return -EROFS; in jfs_link()
808 tid = txBegin(ip->i_sb, 0); in jfs_link()
810 mutex_lock_nested(&JFS_IP(dir)->commit_mutex, COMMIT_MUTEX_PARENT); in jfs_link()
811 mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD); in jfs_link()
825 ino = ip->i_ino; in jfs_link()
837 iplist[1] = dir; in jfs_link()
852 mutex_unlock(&JFS_IP(ip)->commit_mutex); in jfs_link()
853 mutex_unlock(&JFS_IP(dir)->commit_mutex); in jfs_link()
866 * PARAMETER: dip - parent directory vnode
867 * dentry - dentry of symbolic link
868 * name - the path name of the existing object
888 s64 xlen = 0; in jfs_symlink() local
903 ssize = strlen(name) + 1; in jfs_symlink()
914 * allocate on-disk/in-memory inode for symbolic link: in jfs_symlink()
923 tid = txBegin(dip->i_sb, 0); in jfs_symlink()
925 mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT); in jfs_symlink()
926 mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD); in jfs_symlink()
928 rc = jfs_init_security(tid, ip, dip, &dentry->d_name); in jfs_symlink()
933 tblk->xflag |= COMMIT_CREATE; in jfs_symlink()
934 tblk->ino = ip->i_ino; in jfs_symlink()
935 tblk->u.ixpxd = JFS_IP(ip)->ixpxd; in jfs_symlink()
941 ip->i_mode |= 0777; in jfs_symlink()
949 * write source path name inline in on-disk inode (fast symbolic link) in jfs_symlink()
953 ip->i_op = &jfs_fast_symlink_inode_operations; in jfs_symlink()
955 ip->i_link = JFS_IP(ip)->i_inline_all; in jfs_symlink()
956 memcpy(ip->i_link, name, ssize); in jfs_symlink()
957 ip->i_size = ssize - 1; in jfs_symlink()
963 if (ssize > sizeof (JFS_IP(ip)->i_inline)) in jfs_symlink()
964 JFS_IP(ip)->mode2 &= ~INLINEEA; in jfs_symlink()
975 ip->i_op = &jfs_symlink_inode_operations; in jfs_symlink()
977 ip->i_mapping->a_ops = &jfs_aops; in jfs_symlink()
981 * path name) is treated as non-journaled user data, in jfs_symlink()
984 sb = ip->i_sb; in jfs_symlink()
985 bmask = JFS_SBI(sb)->bsize - 1; in jfs_symlink()
988 xlen = xsize >> JFS_SBI(sb)->l2bsize; in jfs_symlink()
989 if ((rc = xtInsert(tid, ip, 0, 0, xlen, &xaddr, 0))) { in jfs_symlink()
993 ip->i_size = ssize - 1; in jfs_symlink()
998 mp = get_metapage(ip, xaddr, PSIZE, 1); in jfs_symlink()
1002 rc = -EIO; in jfs_symlink()
1006 memcpy(mp->data, name, copy_size); in jfs_symlink()
1008 ssize -= copy_size; in jfs_symlink()
1010 xaddr += JFS_SBI(sb)->nbperpage; in jfs_symlink()
1019 ino = ip->i_ino; in jfs_symlink()
1023 if (xlen) in jfs_symlink()
1039 iplist[1] = ip; in jfs_symlink()
1044 mutex_unlock(&JFS_IP(ip)->commit_mutex); in jfs_symlink()
1045 mutex_unlock(&JFS_IP(dip)->commit_mutex); in jfs_symlink()
1090 return -EINVAL; in jfs_rename()
1114 if (rc || (ino != old_ip->i_ino)) { in jfs_rename()
1115 rc = -ENOENT; in jfs_rename()
1124 if ((!new_ip) || (ino != new_ip->i_ino)) { in jfs_rename()
1125 rc = -ESTALE; in jfs_rename()
1128 } else if (rc != -ENOENT) in jfs_rename()
1132 rc = -ESTALE; in jfs_rename()
1136 if (S_ISDIR(old_ip->i_mode)) { in jfs_rename()
1139 rc = -ENOTEMPTY; in jfs_rename()
1154 tid = txBegin(new_dir->i_sb, 0); in jfs_rename()
1162 mutex_lock_nested(&JFS_IP(new_dir)->commit_mutex, COMMIT_MUTEX_PARENT); in jfs_rename()
1163 mutex_lock_nested(&JFS_IP(old_ip)->commit_mutex, COMMIT_MUTEX_CHILD); in jfs_rename()
1165 mutex_lock_nested(&JFS_IP(old_dir)->commit_mutex, in jfs_rename()
1169 mutex_lock_nested(&JFS_IP(new_ip)->commit_mutex, in jfs_rename()
1174 ino = new_ip->i_ino; in jfs_rename()
1176 old_ip->i_ino, JFS_RENAME); in jfs_rename()
1180 if (S_ISDIR(new_ip->i_mode)) { in jfs_rename()
1182 if (new_ip->i_nlink) { in jfs_rename()
1183 mutex_unlock(&JFS_IP(new_ip)->commit_mutex); in jfs_rename()
1185 mutex_unlock(&JFS_IP(old_dir)->commit_mutex); in jfs_rename()
1186 mutex_unlock(&JFS_IP(old_ip)->commit_mutex); in jfs_rename()
1187 mutex_unlock(&JFS_IP(new_dir)->commit_mutex); in jfs_rename()
1188 if (!S_ISDIR(old_ip->i_mode) && new_ip) in jfs_rename()
1190 jfs_error(new_ip->i_sb, in jfs_rename()
1191 "new_ip->i_nlink != 0\n"); in jfs_rename()
1192 return -EIO; in jfs_rename()
1195 tblk->xflag |= COMMIT_DELETE; in jfs_rename()
1196 tblk->u.ip = new_ip; in jfs_rename()
1197 } else if (new_ip->i_nlink == 0) { in jfs_rename()
1201 txAbort(tid, 1); /* Marks FS Dirty */ in jfs_rename()
1206 tblk->xflag |= COMMIT_DELETE; in jfs_rename()
1207 tblk->u.ip = new_ip; in jfs_rename()
1224 ino = old_ip->i_ino; in jfs_rename()
1227 if (rc == -EIO) in jfs_rename()
1228 jfs_err("jfs_rename: dtInsert returned -EIO"); in jfs_rename()
1231 if (S_ISDIR(old_ip->i_mode)) in jfs_rename()
1238 ino = old_ip->i_ino; in jfs_rename()
1243 txAbort(tid, 1); /* Marks Filesystem dirty */ in jfs_rename()
1246 if (S_ISDIR(old_ip->i_mode)) { in jfs_rename()
1253 JFS_IP(old_ip)->i_dtroot.header.idotdot = in jfs_rename()
1254 cpu_to_le32(new_dir->i_ino); in jfs_rename()
1258 (struct metapage *) &JFS_IP(old_ip)->bxflag, in jfs_rename()
1260 dtlck = (struct dt_lock *) & tlck->lock; in jfs_rename()
1261 ASSERT(dtlck->index == 0); in jfs_rename()
1262 lv = & dtlck->lv[0]; in jfs_rename()
1263 lv->offset = 0; in jfs_rename()
1264 lv->length = 1; in jfs_rename()
1265 dtlck->index++; in jfs_rename()
1307 mutex_unlock(&JFS_IP(new_ip)->commit_mutex); in jfs_rename()
1309 mutex_unlock(&JFS_IP(old_dir)->commit_mutex); in jfs_rename()
1310 mutex_unlock(&JFS_IP(old_ip)->commit_mutex); in jfs_rename()
1311 mutex_unlock(&JFS_IP(new_dir)->commit_mutex); in jfs_rename()
1314 tid = txBegin(new_ip->i_sb, 0); in jfs_rename()
1315 mutex_lock(&JFS_IP(new_ip)->commit_mutex); in jfs_rename()
1318 txAbort(tid, 1); in jfs_rename()
1321 rc = txCommit(tid, 1, &new_ip, COMMIT_SYNC); in jfs_rename()
1323 mutex_unlock(&JFS_IP(new_ip)->commit_mutex); in jfs_rename()
1325 if (new_ip && (new_ip->i_nlink == 0)) in jfs_rename()
1332 if (old_dir->i_size > 1) in jfs_rename()
1338 if (new_ip && !S_ISDIR(new_ip->i_mode)) in jfs_rename()
1384 tid = txBegin(dir->i_sb, 0); in jfs_mknod()
1386 mutex_lock_nested(&JFS_IP(dir)->commit_mutex, COMMIT_MUTEX_PARENT); in jfs_mknod()
1387 mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD); in jfs_mknod()
1393 rc = jfs_init_security(tid, ip, dir, &dentry->d_name); in jfs_mknod()
1405 tblk->xflag |= COMMIT_CREATE; in jfs_mknod()
1406 tblk->ino = ip->i_ino; in jfs_mknod()
1407 tblk->u.ixpxd = JFS_IP(ip)->ixpxd; in jfs_mknod()
1409 ino = ip->i_ino; in jfs_mknod()
1415 ip->i_op = &jfs_file_inode_operations; in jfs_mknod()
1416 jfs_ip->dev = new_encode_dev(rdev); in jfs_mknod()
1417 init_special_inode(ip, ip->i_mode, rdev); in jfs_mknod()
1426 iplist[1] = ip; in jfs_mknod()
1431 mutex_unlock(&JFS_IP(ip)->commit_mutex); in jfs_mknod()
1432 mutex_unlock(&JFS_IP(dir)->commit_mutex); in jfs_mknod()
1463 if (rc == -ENOENT) { in jfs_lookup()
1469 ip = jfs_iget(dip->i_sb, inum); in jfs_lookup()
1483 return ERR_PTR(-ESTALE); in jfs_nfs_get_inode()
1488 if (generation && inode->i_generation != generation) { in jfs_nfs_get_inode()
1490 return ERR_PTR(-ESTALE); in jfs_nfs_get_inode()
1515 le32_to_cpu(JFS_IP(d_inode(dentry))->i_dtroot.header.idotdot); in jfs_get_parent()
1517 return d_obtain_alias(jfs_iget(dentry->d_sb, parent_ino)); in jfs_get_parent()
1556 for (i=0; i < this->len; i++) in jfs_ci_hash()
1557 hash = partial_name_hash(tolower(this->name[i]), hash); in jfs_ci_hash()
1558 this->hash = end_name_hash(hash); in jfs_ci_hash()
1566 int i, result = 1; in jfs_ci_compare()
1568 if (len != name->len) in jfs_ci_compare()
1571 if (tolower(str[i]) != tolower(name->name[i])) in jfs_ci_compare()
1584 * Note, rename() to existing directory entry will have ->d_inode, in jfs_ci_revalidate()
1592 return 1; in jfs_ci_revalidate()
1608 return 1; in jfs_ci_revalidate()