Lines Matching +full:rc +full:- +full:map +full:- +full:name
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
31 * NAME: free_ea_wmap(inode)
33 * FUNCTION: free uncommitted extended attributes from working map
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()
49 * NAME: jfs_create(dip, dentry, mode)
52 * with name = <from dentry> and mode = <mode>
54 * PARAMETER: dip - parent directory vnode
55 * dentry - dentry of new file
56 * mode - create mode (rwxrwxrwx).
57 * nd- nd struct
65 int rc = 0; in jfs_create() local
69 struct component_name dname; /* child directory name */ in jfs_create()
74 jfs_info("jfs_create: dip:0x%p name:%pd", dip, dentry); in jfs_create()
76 rc = dquot_initialize(dip); in jfs_create()
77 if (rc) in jfs_create()
84 if ((rc = get_UCSname(&dname, dentry))) in jfs_create()
94 rc = PTR_ERR(ip); in jfs_create()
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()
103 rc = jfs_init_acl(tid, ip, dip); in jfs_create()
104 if (rc) in jfs_create()
107 rc = jfs_init_security(tid, ip, dip, &dentry->d_name); in jfs_create()
108 if (rc) { in jfs_create()
113 if ((rc = dtSearch(dip, &dname, &ino, &btstack, JFS_CREATE))) { in jfs_create()
114 jfs_err("jfs_create: dtSearch returned %d", rc); 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()
128 * initialize the child XAD tree root in-line in inode in jfs_create()
136 ino = ip->i_ino; in jfs_create()
137 if ((rc = dtInsert(tid, dip, &dname, &ino, &btstack))) { in jfs_create()
138 if (rc == -EIO) { in jfs_create()
139 jfs_err("jfs_create: dtInsert returned -EIO"); 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()
156 rc = txCommit(tid, 2, &iplist[0], 0); 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()
162 if (rc) { in jfs_create()
175 jfs_info("jfs_create: rc:%d", rc); in jfs_create()
176 return rc; in jfs_create()
181 * NAME: jfs_mkdir(dip, dentry, mode)
184 * with name = <from dentry> and mode = <mode>
186 * PARAMETER: dip - parent directory vnode
187 * dentry - dentry of child directory
188 * mode - create mode (rwxrwxrwx).
198 int rc = 0; in jfs_mkdir() local
202 struct component_name dname; /* child directory name */ in jfs_mkdir()
207 jfs_info("jfs_mkdir: dip:0x%p name:%pd", dip, dentry); in jfs_mkdir()
209 rc = dquot_initialize(dip); in jfs_mkdir()
210 if (rc) in jfs_mkdir()
217 if ((rc = get_UCSname(&dname, dentry))) in jfs_mkdir()
227 rc = PTR_ERR(ip); in jfs_mkdir()
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()
236 rc = jfs_init_acl(tid, ip, dip); in jfs_mkdir()
237 if (rc) in jfs_mkdir()
240 rc = jfs_init_security(tid, ip, dip, &dentry->d_name); in jfs_mkdir()
241 if (rc) { in jfs_mkdir()
246 if ((rc = dtSearch(dip, &dname, &ino, &btstack, JFS_CREATE))) { in jfs_mkdir()
247 jfs_err("jfs_mkdir: dtSearch returned %d", rc); 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()
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()
270 if ((rc = dtInsert(tid, dip, &dname, &ino, &btstack))) { in jfs_mkdir()
271 if (rc == -EIO) { in jfs_mkdir()
272 jfs_err("jfs_mkdir: dtInsert returned -EIO"); in jfs_mkdir()
280 ip->i_op = &jfs_dir_inode_operations; in jfs_mkdir()
281 ip->i_fop = &jfs_dir_operations; in jfs_mkdir()
290 rc = txCommit(tid, 2, &iplist[0], 0); 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()
296 if (rc) { in jfs_mkdir()
310 jfs_info("jfs_mkdir: rc:%d", rc); in jfs_mkdir()
311 return rc; in jfs_mkdir()
315 * NAME: jfs_rmdir(dip, dentry)
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.
335 int rc; in jfs_rmdir() local
343 jfs_info("jfs_rmdir: dip:0x%p name:%pd", dip, dentry); in jfs_rmdir()
346 rc = dquot_initialize(dip); in jfs_rmdir()
347 if (rc) in jfs_rmdir()
349 rc = dquot_initialize(ip); in jfs_rmdir()
350 if (rc) in jfs_rmdir()
355 rc = -ENOTEMPTY; in jfs_rmdir()
359 if ((rc = get_UCSname(&dname, dentry))) { 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()
372 tblk->xflag |= COMMIT_DELETE; in jfs_rmdir()
373 tblk->u.ip = ip; in jfs_rmdir()
378 ino = ip->i_ino; in jfs_rmdir()
379 if ((rc = dtDelete(tid, dip, &dname, &ino, JFS_REMOVE))) { in jfs_rmdir()
380 jfs_err("jfs_rmdir: dtDelete returned %d", rc); in jfs_rmdir()
381 if (rc == -EIO) 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()
399 /* free EA from both persistent and working map */ 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()
406 /* free ACL from both persistent and working map */ 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()
417 rc = txCommit(tid, 2, &iplist[0], 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()
439 jfs_info("jfs_rmdir: rc:%d", rc); in jfs_rmdir()
440 return rc; in jfs_rmdir()
444 * NAME: jfs_unlink(dip, dentry)
446 * FUNCTION: remove a link to object <vp> named by <name>
449 * PARAMETER: dip - inode of parent directory
450 * dentry - dentry of object to be removed
465 int rc; in jfs_unlink() local
469 struct component_name dname; /* object name */ in jfs_unlink()
475 jfs_info("jfs_unlink: dip:0x%p name:%pd", dip, dentry); in jfs_unlink()
478 rc = dquot_initialize(dip); in jfs_unlink()
479 if (rc) in jfs_unlink()
481 rc = dquot_initialize(ip); in jfs_unlink()
482 if (rc) in jfs_unlink()
485 if ((rc = get_UCSname(&dname, dentry))) in jfs_unlink()
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()
501 ino = ip->i_ino; in jfs_unlink()
502 if ((rc = dtDelete(tid, dip, &dname, &ino, JFS_REMOVE))) { in jfs_unlink()
503 jfs_err("jfs_unlink: dtDelete returned %d", rc); in jfs_unlink()
504 if (rc == -EIO) 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()
531 mutex_unlock(&JFS_IP(ip)->commit_mutex); in jfs_unlink()
532 mutex_unlock(&JFS_IP(dip)->commit_mutex); in jfs_unlink()
534 rc = new_size; in jfs_unlink()
538 tblk->xflag |= COMMIT_DELETE; in jfs_unlink()
539 tblk->u.ip = ip; in jfs_unlink()
556 rc = txCommit(tid, 2, &iplist[0], commit_flag); 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()
563 while (new_size && (rc == 0)) { in jfs_unlink()
564 tid = txBegin(dip->i_sb, 0); in jfs_unlink()
565 mutex_lock(&JFS_IP(ip)->commit_mutex); in jfs_unlink()
569 rc = new_size; in jfs_unlink()
571 rc = txCommit(tid, 2, &iplist[0], COMMIT_SYNC); 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()
595 jfs_info("jfs_unlink: rc:%d", rc); in jfs_unlink()
596 return rc; in jfs_unlink()
600 * NAME: commitZeroLink()
602 * FUNCTION: for non-directory, called by jfs_remove(),
608 * only permanent disk and inode map resources are freed,
611 * map by ctrunc1.
613 * freed in both work and permanent map.
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()
648 /* mark transaction of block map update type */ in commitZeroLink()
650 tblk->xflag |= COMMIT_PMAP; in commitZeroLink()
655 if (JFS_IP(ip)->ea.flag & DXD_EXTENT) in commitZeroLink()
656 /* acquire maplock on EA to be freed from block map */ in commitZeroLink()
657 txEA(tid, ip, &JFS_IP(ip)->ea, NULL); in commitZeroLink()
662 if (JFS_IP(ip)->acl.flag & DXD_EXTENT) in commitZeroLink()
663 /* acquire maplock on EA to be freed from block map */ in commitZeroLink()
664 txEA(tid, ip, &JFS_IP(ip)->acl, NULL); in commitZeroLink()
669 * free xtree/data blocks from persistent block map, and in commitZeroLink()
670 * free xtree/data blocks from working block map if COMMIT_PWMAP; in commitZeroLink()
672 if (ip->i_size) in commitZeroLink()
680 * NAME: jfs_free_zero_link()
682 * FUNCTION: for non-directory, called by iClose(),
683 * free resources of a file from cache and WORKING map
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()
722 invalidate_dxd_metapages(ip, JFS_IP(ip)->ea); in jfs_free_zero_link()
724 /* free EA extent from working block map */ 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()
742 invalidate_dxd_metapages(ip, JFS_IP(ip)->acl); in jfs_free_zero_link()
744 /* free ACL extent from working block map */ 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()
756 * free xtree/data blocks from working block map; in jfs_free_zero_link()
758 if (ip->i_size) in jfs_free_zero_link()
763 * NAME: jfs_link(vp, dvp, name, crp)
765 * FUNCTION: create a link to <vp> by the name = <name>
768 * PARAMETER: vp - target object
769 * dvp - parent directory of new link
770 * name - name of new link to target object
771 * crp - credential
789 int rc; in jfs_link() local
799 rc = dquot_initialize(dir); in jfs_link()
800 if (rc) in jfs_link()
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()
816 if ((rc = get_UCSname(&dname, dentry))) in jfs_link()
819 if ((rc = dtSearch(dir, &dname, &ino, &btstack, JFS_CREATE))) in jfs_link()
825 ino = ip->i_ino; in jfs_link()
826 if ((rc = dtInsert(tid, dir, &dname, &ino, &btstack))) in jfs_link()
838 rc = txCommit(tid, 2, &iplist[0], 0); in jfs_link()
840 if (rc) { 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()
856 jfs_info("jfs_link: rc:%d", rc); in jfs_link()
857 return rc; in jfs_link()
861 * NAME: jfs_symlink(dip, dentry, name)
863 * FUNCTION: creates a symbolic link to <symlink> by name <name>
866 * PARAMETER: dip - parent directory vnode
867 * dentry - dentry of symbolic link
868 * name - the path name of the existing object
879 struct dentry *dentry, const char *name) in jfs_symlink() argument
881 int rc; in jfs_symlink() local
897 jfs_info("jfs_symlink: dip:0x%p name:%s", dip, name); in jfs_symlink()
899 rc = dquot_initialize(dip); in jfs_symlink()
900 if (rc) in jfs_symlink()
903 ssize = strlen(name) + 1; in jfs_symlink()
910 if ((rc = get_UCSname(&dname, dentry))) in jfs_symlink()
914 * allocate on-disk/in-memory inode for symbolic link: in jfs_symlink()
919 rc = PTR_ERR(ip); 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()
929 if (rc) 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()
944 * write symbolic link target path name 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()
966 jfs_info("jfs_symlink: fast symlink added ssize:%u name:%s ", in jfs_symlink()
967 ssize, name); in jfs_symlink()
970 * write source path name in a single extent 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()
1002 rc = -EIO; in jfs_symlink()
1006 memcpy(mp->data, name, copy_size); in jfs_symlink()
1008 ssize -= copy_size; in jfs_symlink()
1009 name += copy_size; in jfs_symlink()
1010 xaddr += JFS_SBI(sb)->nbperpage; in jfs_symlink()
1017 rc = dtSearch(dip, &dname, &ino, &btstack, JFS_CREATE); in jfs_symlink()
1018 if (rc == 0) { in jfs_symlink()
1019 ino = ip->i_ino; in jfs_symlink()
1020 rc = dtInsert(tid, dip, &dname, &ino, &btstack); in jfs_symlink()
1022 if (rc) { in jfs_symlink()
1040 rc = txCommit(tid, 2, &iplist[0], 0); 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()
1046 if (rc) { in jfs_symlink()
1058 jfs_info("jfs_symlink: rc:%d", rc); in jfs_symlink()
1059 return rc; in jfs_symlink()
1064 * NAME: jfs_rename
1078 int rc; in jfs_rename() local
1090 return -EINVAL; in jfs_rename()
1094 rc = dquot_initialize(old_dir); in jfs_rename()
1095 if (rc) in jfs_rename()
1097 rc = dquot_initialize(new_dir); in jfs_rename()
1098 if (rc) in jfs_rename()
1104 if ((rc = get_UCSname(&old_dname, old_dentry))) in jfs_rename()
1107 if ((rc = get_UCSname(&new_dname, new_dentry))) in jfs_rename()
1113 rc = dtSearch(old_dir, &old_dname, &ino, &btstack, JFS_LOOKUP); in jfs_rename()
1114 if (rc || (ino != old_ip->i_ino)) { in jfs_rename()
1115 rc = -ENOENT; in jfs_rename()
1122 rc = dtSearch(new_dir, &new_dname, &ino, &btstack, JFS_LOOKUP); in jfs_rename()
1123 if (!rc) { 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()
1146 rc = dquot_initialize(new_ip); in jfs_rename()
1147 if (rc) 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()
1175 rc = dtModify(tid, new_dir, &new_dname, &ino, in jfs_rename()
1176 old_ip->i_ino, JFS_RENAME); in jfs_rename()
1177 if (rc) 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()
1202 rc = new_size; in jfs_rename()
1206 tblk->xflag |= COMMIT_DELETE; in jfs_rename()
1207 tblk->u.ip = new_ip; in jfs_rename()
1216 rc = dtSearch(new_dir, &new_dname, &ino, &btstack, in jfs_rename()
1218 if (rc) { in jfs_rename()
1219 jfs_err("jfs_rename didn't expect dtSearch to fail w/rc = %d", in jfs_rename()
1220 rc); in jfs_rename()
1224 ino = old_ip->i_ino; in jfs_rename()
1225 rc = dtInsert(tid, new_dir, &new_dname, &ino, &btstack); in jfs_rename()
1226 if (rc) { 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()
1239 rc = dtDelete(tid, old_dir, &old_dname, &ino, JFS_REMOVE); in jfs_rename()
1240 if (rc) { in jfs_rename()
1241 jfs_err("jfs_rename did not expect dtDelete to return rc = %d", in jfs_rename()
1242 rc); 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()
1302 rc = txCommit(tid, ipcount, iplist, commit_flag); 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()
1313 while (new_size && (rc == 0)) { 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()
1319 rc = new_size; 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()
1345 jfs_info("jfs_rename: returning %d", rc); in jfs_rename()
1346 return rc; in jfs_rename()
1351 * NAME: jfs_mknod
1364 int rc; in jfs_mknod() local
1370 rc = dquot_initialize(dir); in jfs_mknod()
1371 if (rc) in jfs_mknod()
1374 if ((rc = get_UCSname(&dname, dentry))) in jfs_mknod()
1379 rc = PTR_ERR(ip); in jfs_mknod()
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()
1389 rc = jfs_init_acl(tid, ip, dir); in jfs_mknod()
1390 if (rc) in jfs_mknod()
1393 rc = jfs_init_security(tid, ip, dir, &dentry->d_name); in jfs_mknod()
1394 if (rc) { in jfs_mknod()
1399 if ((rc = dtSearch(dir, &dname, &ino, &btstack, JFS_CREATE))) { 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()
1410 if ((rc = dtInsert(tid, dir, &dname, &ino, &btstack))) { 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()
1427 rc = txCommit(tid, 2, iplist, 0); 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()
1433 if (rc) { in jfs_mknod()
1445 jfs_info("jfs_mknod: returning %d", rc); in jfs_mknod()
1446 return rc; in jfs_mknod()
1455 int rc; in jfs_lookup() local
1457 jfs_info("jfs_lookup: name = %pd", dentry); in jfs_lookup()
1459 if ((rc = get_UCSname(&key, dentry))) in jfs_lookup()
1460 return ERR_PTR(rc); in jfs_lookup()
1461 rc = dtSearch(dip, &key, &inum, &btstack, JFS_LOOKUP); in jfs_lookup()
1463 if (rc == -ENOENT) { in jfs_lookup()
1465 } else if (rc) { in jfs_lookup()
1466 jfs_err("jfs_lookup: dtSearch returned %d", rc); in jfs_lookup()
1467 ip = ERR_PTR(rc); 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()
1564 unsigned int len, const char *str, const struct qstr *name) in jfs_ci_compare() argument
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()
1585 * and will use existing name which isn't specified name by user. in jfs_ci_revalidate()
1603 * case sensitive name which is specified by user if this is in jfs_ci_revalidate()