1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * This code is issued under the GNU General Public License.
5 * See the file COPYING in this distribution
7 * Copyright (C) 1992, 1993, 1994, 1995
8 * Remy Card (card@masi.ibp.fr)
9 * Laboratoire MASI - Institut Blaise Pascal
10 * Universite Pierre et Marie Curie (Paris VI)
14 * linux/fs/ext2/namei.c
16 * Copyright (C) 1991, 1992 Linus Torvalds
18 * Big-endian to little-endian byte-swapping/bitmaps by
19 * David S. Miller (davem@caip.rutgers.edu), 1995
20 * Directory entry file type support and forward compatibility hooks
21 * for B-tree directories by Theodore Ts'o (tytso@mit.edu), 1998
23 * Changes for use in OBDFS
24 * Copyright (c) 1999, Seagate Technology Inc.
25 * Copyright (C) 2001, Cluster File Systems, Inc.
26 * Rewritten based on recent ext2 page cache use.
31 #include <linux/sched.h>
33 #include <linux/smp_lock.h>
34 #include <linux/quotaops.h>
35 #include <linux/highmem.h>
36 #include <linux/pagemap.h>
38 #define DEBUG_SUBSYSTEM S_LLITE
40 #include <linux/obd_support.h>
41 #include <linux/lustre_lite.h>
42 #include <linux/lustre_dlm.h>
43 #include <linux/obd_lov.h>
45 extern struct address_space_operations ll_aops;
48 extern void ll_change_inode(struct inode *inode);
49 extern int ll_setattr(struct dentry *de, struct iattr *attr);
52 extern int ll_add_link (struct dentry *dentry, struct inode *inode);
53 obd_id ll_inode_by_name(struct inode * dir, struct dentry *dentry, int *typ);
54 int ext2_make_empty(struct inode *inode, struct inode *parent);
55 struct ext2_dir_entry_2 * ext2_find_entry (struct inode * dir,
56 struct dentry *dentry, struct page ** res_page);
57 int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page );
58 int ext2_empty_dir (struct inode * inode);
59 struct ext2_dir_entry_2 * ext2_dotdot (struct inode *dir, struct page **p);
60 void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de,
61 struct page *page, struct inode *inode);
64 * Couple of helper functions - make the code slightly cleaner.
66 static inline void ext2_inc_count(struct inode *inode)
71 /* postpone the disk update until the inode really goes away */
72 static inline void ext2_dec_count(struct inode *inode)
77 static inline int ext2_add_nondir(struct dentry *dentry, struct inode *inode)
80 err = ll_add_link(dentry, inode);
82 d_instantiate(dentry, inode);
85 ext2_dec_count(inode);
92 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
93 static int ll_find_inode(struct inode *inode, unsigned long ino, void *opaque)
95 static int ll_test_inode(struct inode *inode, void *opaque)
98 struct ll_read_inode2_cookie *lic = opaque;
99 struct mds_body *body = lic->lic_body;
101 if (inode->i_generation != lic->lic_body->generation)
104 /* Apply the attributes in 'opaque' to this inode */
105 ll_update_inode(inode, body);
110 extern struct dentry_operations ll_d_ops;
112 int ll_unlock(__u32 mode, struct lustre_handle *lockh)
116 ldlm_lock_decref(lockh, mode);
121 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
122 extern int ll_read_inode2(struct inode *inode, void *opaque);
123 struct inode *ll_iget(struct super_block *sb, ino_t hash,
124 struct ll_read_inode2_cookie *lic)
128 inode = iget5_locked(sb, hash, ll_test_inode, ll_read_inode2, lic);
131 return ERR_PTR(-ENOMEM);
133 if (inode->i_state & I_NEW) {
135 unlock_new_inode(inode);
138 // XXX Coda always fills inodes, should Lustre?
142 struct inode *ll_iget(struct super_block *sb, ino_t hash,
143 struct ll_read_inode2_cookie *lic)
146 inode = iget4(sb, hash, ll_find_inode, lic);
151 static int ll_intent_to_lock_mode(struct lookup_intent *it)
153 /* CREAT needs to be tested before open (both could be set) */
154 if ((it->it_op & (IT_CREAT | IT_MKDIR | IT_SETATTR | IT_MKNOD))) {
156 } else if (it->it_op & (IT_READDIR | IT_GETATTR | IT_OPEN | IT_UNLINK |
157 IT_RMDIR | IT_RENAME | IT_RENAME2 | IT_READLINK|
158 IT_LINK | IT_LINK2 | IT_LOOKUP | IT_SYMLINK)) {
166 #define LL_LOOKUP_POSITIVE 1
167 #define LL_LOOKUP_NEGATIVE 2
169 int ll_intent_lock(struct inode *parent, struct dentry **de,
170 struct lookup_intent *it,
171 intent_finish_cb intent_finish)
173 struct dentry *dentry = *de;
174 struct ll_sb_info *sbi = ll_i2sbi(parent);
175 struct lustre_handle lockh;
176 struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
177 struct ptlrpc_request *request = NULL;
179 int rc, lock_mode, tgtlen = 0, offset, flag = LL_LOOKUP_POSITIVE;
187 CDEBUG(D_INFO, "name: %*s, intent: %s\n", dentry->d_name.len,
188 dentry->d_name.name, ldlm_it2str(it->it_op));
190 if (dentry->d_name.len > EXT2_NAME_LEN)
191 RETURN(-ENAMETOOLONG);
193 lock_mode = ll_intent_to_lock_mode(it);
194 if (it->it_op & IT_SYMLINK) {
196 tgtlen = strlen(tgt);
200 rc = mdc_enqueue(&sbi->ll_mdc_conn, LDLM_PLAIN, it, lock_mode, parent,
201 dentry, &lockh, tgt, tgtlen, parent, sizeof(*parent));
204 memcpy(it->it_lock_handle, &lockh, sizeof(lockh));
206 request = (struct ptlrpc_request *)it->it_data;
207 if (it->it_disposition) {
208 struct mds_body *mds_body;
209 int mode, symlen = 0;
212 /* it_disposition == 1 indicates that the server performed the
213 * intent on our behalf. This long block is all about fixing up
214 * the local state so that it is correct as of the moment
215 * _before_ the operation was applied; that way, the VFS will
216 * think that everything is normal and call Lustre's regular
219 * If we're performing a creation, that means that unless the
220 * creation failed with EEXIST, we should fake up a negative
221 * dentry. Likewise for the target of a hard link.
223 * For everything else, we want to lookup to succeed. */
225 /* One additional note: we add an extra reference to the request
226 * because we need to keep it around until ll_create gets
227 * called. For anything else which results in
228 * LL_LOOKUP_POSITIVE, we can do the iget() immediately with the
229 * contents of the reply (in the intent_finish callback). In
230 * the create case, however, we need to wait until
231 * ll_create_node to do the iget() or the VFS will abort with
235 mds_body = lustre_msg_buf(request->rq_repmsg, offset);
236 ino = mds_body->fid1.id;
237 mode = mds_body->mode;
238 if (it->it_op & (IT_CREAT | IT_MKDIR | IT_SYMLINK | IT_MKNOD)) {
239 mdc_store_create_replay_data(request, parent->i_sb);
240 /* For create ops, we want the lookup to be negative,
241 * unless the create failed in a way that indicates
242 * that the file is already there */
243 if (it->it_status != -EEXIST) {
244 atomic_inc(&request->rq_refcount);
245 GOTO(out, flag = LL_LOOKUP_NEGATIVE);
247 /* Fall through to update attibutes. */
248 } else if (it->it_op & (IT_GETATTR | IT_SETATTR | IT_LOOKUP |
250 /* For check ops, we want the lookup to succeed */
253 GOTO(out, flag = LL_LOOKUP_NEGATIVE);
254 /* Fall through to update attibutes. */
255 } else if (it->it_op & (IT_RENAME | IT_LINK)) {
256 /* For rename, we want the source lookup to succeed */
259 GOTO(drop_req, rc = it->it_status);
261 it->it_data = dentry;
262 /* Fall through to update attibutes. */
263 } else if (it->it_op & (IT_UNLINK | IT_RMDIR)) {
264 /* For remove ops, we want the lookup to succeed unless
265 * the file truly doesn't exist */
267 if (it->it_status == -ENOENT)
268 GOTO(out, flag = LL_LOOKUP_NEGATIVE);
269 /* No point in updating attributes that we're about to
271 GOTO(out, flag = LL_LOOKUP_POSITIVE);
272 } else if (it->it_op == IT_OPEN) {
274 if (it->it_status && it->it_status != -EEXIST)
275 GOTO(out, flag = LL_LOOKUP_NEGATIVE);
276 /* Fall through to update attibutes. */
277 } else if (it->it_op & (IT_RENAME2 | IT_LINK2)) {
279 /* This means the target lookup is negative */
280 if (mds_body->valid == 0)
281 GOTO(out, flag = LL_LOOKUP_NEGATIVE);
282 /* XXX bug 289: should we maybe fall through here? -p */
283 GOTO(out, flag = LL_LOOKUP_POSITIVE);
286 /* Do a getattr now that we have the lock */
287 valid = OBD_MD_FLNOTOBD | OBD_MD_FLEASIZE;
288 if (it->it_op == IT_READLINK) {
289 valid |= OBD_MD_LINKNAME;
290 symlen = mds_body->size;
292 ptlrpc_req_finished(request);
294 rc = mdc_getattr(&sbi->ll_mdc_conn, ino, mode,
295 valid, symlen, &request);
297 CERROR("failure %d inode "LPX64"\n", rc, ino);
298 GOTO(drop_req, rc = -abs(rc));
302 struct ll_inode_info *lli = ll_i2info(parent);
305 /* it_disposition == 0 indicates that it just did a simple lock
306 * request, for which we are very thankful. move along with
307 * the local lookup then. */
309 memcpy(&lli->lli_intent_lock_handle, &lockh, sizeof(lockh));
312 ino = ll_inode_by_name(parent, dentry, &mode);
314 CERROR("inode %*s not found by name\n",
315 dentry->d_name.len, dentry->d_name.name);
316 GOTO(drop_lock, rc = -ENOENT);
319 rc = mdc_getattr(&sbi->ll_mdc_conn, ino, mode,
320 OBD_MD_FLNOTOBD|OBD_MD_FLEASIZE, 0, &request);
322 CERROR("failure %d inode "LPX64"\n", rc, ino);
323 GOTO(drop_req, rc = -abs(rc));
329 if (intent_finish != NULL) {
330 rc = intent_finish(flag, request, de, it, offset, ino);
331 dentry = *de; /* intent_finish may change *de */
333 ptlrpc_req_finished(request);
336 if (it->it_op == IT_LOOKUP || rc < 0)
337 ll_intent_release(dentry, it);
342 ptlrpc_free_req(request);
344 #warning FIXME: must release lock here
348 /* Search "inode"'s alias list for a dentry that has the same name and parent as
349 * de. If found, return it. If not found, return de. */
350 struct dentry *ll_find_alias(struct inode *inode, struct dentry *de)
352 struct list_head *tmp;
354 spin_lock(&dcache_lock);
355 list_for_each(tmp, &inode->i_dentry) {
356 struct dentry *dentry = list_entry(tmp, struct dentry, d_alias);
358 /* We are called here with 'de' already on the aliases list. */
362 if (!atomic_read(&dentry->d_count))
365 if (!list_empty(&dentry->d_lru))
368 if (dentry->d_parent != de->d_parent)
371 if (dentry->d_name.len != de->d_name.len)
374 if (memcmp(dentry->d_name.name, de->d_name.name,
375 de->d_name.len) != 0)
378 list_del_init(&dentry->d_hash);
380 spin_unlock(&dcache_lock);
382 atomic_inc(&dentry->d_count);
387 spin_unlock(&dcache_lock);
393 lookup2_finish(int flag, struct ptlrpc_request *request, struct dentry **de,
394 struct lookup_intent *it, int offset, obd_id ino)
396 struct dentry *dentry = *de, *saved = *de;
397 struct inode *inode = NULL;
398 struct ll_read_inode2_cookie lic;
400 if (flag == LL_LOOKUP_POSITIVE) {
402 lic.lic_body = lustre_msg_buf(request->rq_repmsg, offset);
404 if (S_ISREG(lic.lic_body->mode) &&
405 lic.lic_body->valid & OBD_MD_FLEASIZE) {
406 LASSERT(request->rq_repmsg->bufcount > offset);
407 lic.lic_lmm = lustre_msg_buf(request->rq_repmsg,
413 /* No rpc's happen during iget4, -ENOMEM's are possible */
415 inode = ll_iget(dentry->d_sb, ino, &lic);
417 /* XXX make sure that request is freed in this case;
418 * I think it is, but double-check refcounts. -phil */
422 dentry = *de = ll_find_alias(inode, dentry);
424 /* We asked for a lock on the directory, and may have been
425 * granted a lock on the inode. Just in case, fixup the data
427 ldlm_lock_set_data((struct lustre_handle *)it->it_lock_handle,
428 inode, sizeof(*inode));
435 ptlrpc_req_finished(request);
437 dentry->d_op = &ll_d_ops;
438 if (ll_d2d(dentry) == NULL) {
443 d_add(dentry, inode);
445 if (it->it_status == 0 && it->it_op != IT_RENAME2) {
446 LL_SAVE_INTENT(dentry, it);
450 "D_IT dentry %p fsdata %p intent: %s status %d\n",
451 dentry, ll_d2d(dentry), ldlm_it2str(it->it_op),
458 static struct dentry *ll_lookup2(struct inode *parent, struct dentry *dentry,
459 struct lookup_intent *it)
461 struct dentry *save = dentry;
464 rc = ll_intent_lock(parent, &dentry, it, lookup2_finish);
466 CERROR("ll_intent_lock: %d\n", rc);
476 static struct inode *ll_create_node(struct inode *dir, const char *name,
477 int namelen, const char *tgt, int tgtlen,
478 int mode, __u64 extra,
479 struct lookup_intent *it,
480 struct lov_stripe_md *lsm)
483 struct ptlrpc_request *request = NULL;
484 struct mds_body *body;
485 time_t time = CURRENT_TIME;
486 struct ll_sb_info *sbi = ll_i2sbi(dir);
487 struct ll_read_inode2_cookie lic;
488 struct lov_mds_md *lmm = NULL;
491 if (it && it->it_disposition) {
492 int rc = it->it_status;
494 CERROR("error creating MDS inode for %*s: rc = %d\n",
498 ll_invalidate_inode_pages(dir);
499 request = it->it_data;
500 body = lustre_msg_buf(request->rq_repmsg, 1);
503 int gid = current->fsgid;
507 OBD_ALLOC(lmm, lsm->lsm_mds_easize);
509 RETURN(ERR_PTR(-ENOMEM));
510 lov_packmd(lmm, lsm);
515 if (dir->i_mode & S_ISGID) {
521 rc = mdc_create(&sbi->ll_mdc_conn, dir, name, namelen, tgt,
522 tgtlen, mode, current->fsuid, gid,
523 time, extra, lsm, &request);
528 body = lustre_msg_buf(request->rq_repmsg, 0);
533 LASSERT(body->ino != 0);
534 inode = ll_iget(dir->i_sb, body->ino, &lic);
536 int rc = PTR_ERR(inode);
537 CERROR("new_inode -fatal: rc %d\n", rc);
542 if (!list_empty(&inode->i_dentry)) {
543 CERROR("new_inode -fatal: inode %d, ct %d lnk %d\n",
544 body->ino, atomic_read(&inode->i_count),
548 inode = ERR_PTR(-EIO);
552 if (it && it->it_disposition) {
553 /* We asked for a lock on the directory, but were
554 * granted a lock on the inode. Since we finally have
555 * an inode pointer, stuff it in the lock. */
556 ldlm_lock_set_data((struct lustre_handle *)it->it_lock_handle,
557 inode, sizeof(*inode));
563 OBD_FREE(lmm, lsm->lsm_mds_easize);
564 ptlrpc_req_finished(request);
568 static int ll_mdc_unlink(struct inode *dir, struct inode *child, __u32 mode,
569 const char *name, int len)
571 struct ptlrpc_request *request = NULL;
572 struct ll_sb_info *sbi = ll_i2sbi(dir);
577 err = mdc_unlink(&sbi->ll_mdc_conn, dir, child, mode, name, len,
579 ptlrpc_req_finished(request);
584 int ll_mdc_link(struct dentry *src, struct inode *dir,
585 const char *name, int len)
587 struct ptlrpc_request *request = NULL;
589 struct ll_sb_info *sbi = ll_i2sbi(dir);
593 err = mdc_link(&sbi->ll_mdc_conn, src, dir, name, len, &request);
594 ptlrpc_req_finished(request);
599 int ll_mdc_rename(struct inode *src, struct inode *tgt,
600 struct dentry *old, struct dentry *new)
602 struct ptlrpc_request *request = NULL;
603 struct ll_sb_info *sbi = ll_i2sbi(src);
608 err = mdc_rename(&sbi->ll_mdc_conn, src, tgt,
609 old->d_name.name, old->d_name.len,
610 new->d_name.name, new->d_name.len, &request);
611 ptlrpc_req_finished(request);
617 * By the time this is called, we already have created the directory cache
618 * entry for the new file, but it is so far negative - it has no inode.
619 * We defer creating the OBD object(s) until open, to keep the intent and
620 * non-intent code paths similar, and also because we do not have the MDS
621 * inode number before calling ll_create_node() (which is needed for LOV),
622 * so we would need to do yet another RPC to the MDS to store the LOV EA
625 * If the create succeeds, we fill in the inode information
626 * with d_instantiate().
628 static int ll_create(struct inode *dir, struct dentry *dentry, int mode)
630 struct lookup_intent *it;
635 LL_GET_INTENT(dentry, it);
637 inode = ll_create_node(dir, dentry->d_name.name, dentry->d_name.len,
638 NULL, 0, mode, 0, it, NULL);
641 RETURN(PTR_ERR(inode));
643 if (it->it_disposition) {
644 struct ll_inode_info *lli = ll_i2info(inode);
645 memcpy(&lli->lli_intent_lock_handle, it->it_lock_handle,
646 sizeof(lli->lli_intent_lock_handle));
647 d_instantiate(dentry, inode);
649 /* no directory data updates when intents rule */
650 rc = ext2_add_nondir(dentry, inode);
656 static int ll_mknod(struct inode *dir, struct dentry *dentry, int mode,
659 struct lookup_intent *it;
663 LL_GET_INTENT(dentry, it);
665 inode = ll_create_node(dir, dentry->d_name.name, dentry->d_name.len,
666 NULL, 0, mode, rdev, it, NULL);
669 RETURN(PTR_ERR(inode));
671 /* no directory data updates when intents rule */
672 if (it && it->it_disposition)
673 d_instantiate(dentry, inode);
675 rc = ext2_add_nondir(dentry, inode);
680 static int ll_symlink(struct inode *dir, struct dentry *dentry,
683 struct lookup_intent *it;
684 unsigned l = strlen(symname);
686 struct ll_inode_info *lli;
690 LL_GET_INTENT(dentry, it);
692 inode = ll_create_node(dir, dentry->d_name.name, dentry->d_name.len,
693 symname, l, S_IFLNK | S_IRWXUGO, 0, it, NULL);
695 RETURN(PTR_ERR(inode));
697 lli = ll_i2info(inode);
699 OBD_ALLOC(lli->lli_symlink_name, l + 1);
700 /* this _could_ be a non-fatal error, since the symlink is already
701 * stored on the MDS by this point, and we can re-get it in readlink.
703 if (!lli->lli_symlink_name)
706 memcpy(lli->lli_symlink_name, symname, l + 1);
709 /* no directory data updates when intents rule */
710 if (it && it->it_disposition)
711 d_instantiate(dentry, inode);
713 err = ext2_add_nondir(dentry, inode);
718 static int ll_link(struct dentry *old_dentry, struct inode * dir,
719 struct dentry *dentry)
721 struct lookup_intent *it;
722 struct inode *inode = old_dentry->d_inode;
725 LL_GET_INTENT(dentry, it);
727 if (it && it->it_disposition) {
729 RETURN(it->it_status);
730 inode->i_ctime = CURRENT_TIME;
731 ext2_inc_count(inode);
732 atomic_inc(&inode->i_count);
733 d_instantiate(dentry, inode);
734 ll_invalidate_inode_pages(dir);
738 if (S_ISDIR(inode->i_mode))
741 if (inode->i_nlink >= EXT2_LINK_MAX)
744 rc = ll_mdc_link(old_dentry, dir,
745 dentry->d_name.name, dentry->d_name.len);
749 inode->i_ctime = CURRENT_TIME;
750 ext2_inc_count(inode);
751 atomic_inc(&inode->i_count);
753 return ext2_add_nondir(dentry, inode);
756 static int ll_mkdir(struct inode *dir, struct dentry *dentry, int mode)
758 struct lookup_intent *it;
759 struct inode * inode;
763 LL_GET_INTENT(dentry, it);
765 if (dir->i_nlink >= EXT2_LINK_MAX)
769 inode = ll_create_node(dir, dentry->d_name.name, dentry->d_name.len,
770 NULL, 0, S_IFDIR | mode, 0, it, NULL);
771 err = PTR_ERR(inode);
775 ext2_inc_count(inode);
777 err = ext2_make_empty(inode, dir);
781 /* no directory data updates when intents rule */
782 if (!it || !it->it_disposition) {
783 err = ll_add_link(dentry, inode);
788 d_instantiate(dentry, inode);
794 ext2_dec_count(inode);
795 ext2_dec_count(inode);
804 static int ll_common_unlink(struct inode *dir, struct dentry *dentry,
805 struct lookup_intent *it, __u32 mode)
807 struct inode *inode = dentry->d_inode;
808 struct ext2_dir_entry_2 * de;
812 if (it && it->it_disposition) {
814 ll_invalidate_inode_pages(dir);
820 de = ext2_find_entry(dir, dentry, &page);
822 GOTO(out, rc = -ENOENT);
823 rc = ll_mdc_unlink(dir, dentry->d_inode, mode,
824 dentry->d_name.name, dentry->d_name.len);
828 rc = ext2_delete_entry(de, page);
832 /* AED: not sure if needed - directory lock revocation should do it
833 * in the case where the client has cached it for non-intent ops.
835 ll_invalidate_inode_pages(dir);
837 inode->i_ctime = dir->i_ctime;
839 ext2_dec_count(inode);
844 static int ll_unlink(struct inode *dir, struct dentry *dentry)
846 struct lookup_intent * it;
848 LL_GET_INTENT(dentry, it);
850 return ll_common_unlink(dir, dentry, it, S_IFREG);
853 static int ll_rmdir(struct inode *dir, struct dentry *dentry)
855 struct inode * inode = dentry->d_inode;
856 struct lookup_intent *it;
860 LL_GET_INTENT(dentry, it);
862 if ((!it || !it->it_disposition) && !ext2_empty_dir(inode))
865 rc = ll_common_unlink(dir, dentry, it, S_IFDIR);
868 ext2_dec_count(inode);
875 static int ll_rename(struct inode * old_dir, struct dentry * old_dentry,
876 struct inode * new_dir, struct dentry * new_dentry)
878 struct lookup_intent *it;
879 struct inode * old_inode = old_dentry->d_inode;
880 struct inode * tgt_inode = new_dentry->d_inode;
881 struct page * dir_page = NULL;
882 struct ext2_dir_entry_2 * dir_de = NULL;
883 struct ext2_dir_entry_2 * old_de;
884 struct page * old_page;
887 LL_GET_INTENT(old_dentry, it);
889 if (it && it->it_disposition) {
891 tgt_inode->i_ctime = CURRENT_TIME;
892 tgt_inode->i_nlink--;
894 ll_invalidate_inode_pages(old_dir);
895 ll_invalidate_inode_pages(new_dir);
896 GOTO(out, err = it->it_status);
899 err = ll_mdc_rename(old_dir, new_dir, old_dentry, new_dentry);
903 old_de = ext2_find_entry (old_dir, old_dentry, &old_page);
907 if (S_ISDIR(old_inode->i_mode)) {
909 dir_de = ext2_dotdot(old_inode, &dir_page);
915 struct page *new_page;
916 struct ext2_dir_entry_2 *new_de;
919 if (dir_de && !ext2_empty_dir (tgt_inode))
923 new_de = ext2_find_entry (new_dir, new_dentry, &new_page);
926 ext2_inc_count(old_inode);
927 ext2_set_link(new_dir, new_de, new_page, old_inode);
928 tgt_inode->i_ctime = CURRENT_TIME;
930 tgt_inode->i_nlink--;
931 ext2_dec_count(tgt_inode);
935 if (new_dir->i_nlink >= EXT2_LINK_MAX)
938 ext2_inc_count(old_inode);
939 err = ll_add_link(new_dentry, old_inode);
941 ext2_dec_count(old_inode);
945 ext2_inc_count(new_dir);
948 ext2_delete_entry (old_de, old_page);
949 ext2_dec_count(old_inode);
952 ext2_set_link(old_inode, dir_de, dir_page, new_dir);
953 ext2_dec_count(old_dir);
960 page_cache_release(dir_page);
964 page_cache_release(old_page);
969 struct inode_operations ll_dir_inode_operations = {