2 * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
4 * Trivial changes by Alan Cox to remove EHASHCOLLISION for compatibility
7 * Rights granted to Hans Reiser to redistribute under other terms providing
8 * he accepts all liability including but not limited to patent, fitness
9 * for purpose, and direct or indirect claims arising from failure to perform.
14 #include <linux/config.h>
15 #include <linux/time.h>
16 #include <linux/bitops.h>
17 #include <linux/reiserfs_fs.h>
18 #include <linux/reiserfs_acl.h>
19 #include <linux/reiserfs_xattr.h>
20 #include <linux/smp_lock.h>
21 #include <linux/quotaops.h>
23 #define INC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) { i->i_nlink++; if (i->i_nlink >= REISERFS_LINK_MAX) i->i_nlink=1; }
24 #define DEC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) i->i_nlink--;
26 // directory item contains array of entry headers. This performs
27 // binary search through that array
28 static int bin_search_in_dir_item(struct reiserfs_dir_entry *de, loff_t off)
30 struct item_head *ih = de->de_ih;
31 struct reiserfs_de_head *deh = de->de_deh;
32 int rbound, lbound, j;
35 rbound = I_ENTRY_COUNT(ih) - 1;
37 for (j = (rbound + lbound) / 2; lbound <= rbound;
38 j = (rbound + lbound) / 2) {
39 if (off < deh_offset(deh + j)) {
43 if (off > deh_offset(deh + j)) {
47 // this is not name found, but matched third key component
52 de->de_entry_num = lbound;
53 return NAME_NOT_FOUND;
56 // comment? maybe something like set de to point to what the path points to?
57 static inline void set_de_item_location(struct reiserfs_dir_entry *de,
60 de->de_bh = get_last_bh(path);
61 de->de_ih = get_ih(path);
62 de->de_deh = B_I_DEH(de->de_bh, de->de_ih);
63 de->de_item_num = PATH_LAST_POSITION(path);
66 // de_bh, de_ih, de_deh (points to first element of array), de_item_num is set
67 inline void set_de_name_and_namelen(struct reiserfs_dir_entry *de)
69 struct reiserfs_de_head *deh = de->de_deh + de->de_entry_num;
71 if (de->de_entry_num >= ih_entry_count(de->de_ih))
74 de->de_entrylen = entry_length(de->de_bh, de->de_ih, de->de_entry_num);
75 de->de_namelen = de->de_entrylen - (de_with_sd(deh) ? SD_SIZE : 0);
76 de->de_name = B_I_PITEM(de->de_bh, de->de_ih) + deh_location(deh);
77 if (de->de_name[de->de_namelen - 1] == 0)
78 de->de_namelen = strlen(de->de_name);
81 // what entry points to
82 static inline void set_de_object_key(struct reiserfs_dir_entry *de)
84 if (de->de_entry_num >= ih_entry_count(de->de_ih))
86 de->de_dir_id = deh_dir_id(&(de->de_deh[de->de_entry_num]));
87 de->de_objectid = deh_objectid(&(de->de_deh[de->de_entry_num]));
90 static inline void store_de_entry_key(struct reiserfs_dir_entry *de)
92 struct reiserfs_de_head *deh = de->de_deh + de->de_entry_num;
94 if (de->de_entry_num >= ih_entry_count(de->de_ih))
97 /* store key of the found entry */
98 de->de_entry_key.version = KEY_FORMAT_3_5;
99 de->de_entry_key.on_disk_key.k_dir_id =
100 le32_to_cpu(de->de_ih->ih_key.k_dir_id);
101 de->de_entry_key.on_disk_key.k_objectid =
102 le32_to_cpu(de->de_ih->ih_key.k_objectid);
103 set_cpu_key_k_offset(&(de->de_entry_key), deh_offset(deh));
104 set_cpu_key_k_type(&(de->de_entry_key), TYPE_DIRENTRY);
107 /* We assign a key to each directory item, and place multiple entries
108 in a single directory item. A directory item has a key equal to the
109 key of the first directory entry in it.
111 This function first calls search_by_key, then, if item whose first
112 entry matches is not found it looks for the entry inside directory
113 item found by search_by_key. Fills the path to the entry, and to the
114 entry position in the item
118 /* The function is NOT SCHEDULE-SAFE! */
119 int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,
120 struct path *path, struct reiserfs_dir_entry *de)
124 retval = search_item(sb, key, path);
127 if (!PATH_LAST_POSITION(path)) {
129 "vs-7000: search_by_entry_key: search_by_key returned item position == 0");
133 PATH_LAST_POSITION(path)--;
144 "vs-7002: search_by_entry_key: no path to here");
148 set_de_item_location(de, path);
150 #ifdef CONFIG_REISERFS_CHECK
151 if (!is_direntry_le_ih(de->de_ih) ||
152 COMP_SHORT_KEYS(&(de->de_ih->ih_key), key)) {
153 print_block(de->de_bh, 0, -1, -1);
155 "vs-7005: search_by_entry_key: found item %h is not directory item or "
156 "does not belong to the same directory as key %K",
159 #endif /* CONFIG_REISERFS_CHECK */
161 /* binary search in directory item by third componen t of the
162 key. sets de->de_entry_num of de */
163 retval = bin_search_in_dir_item(de, cpu_key_k_offset(key));
164 path->pos_in_item = de->de_entry_num;
165 if (retval != NAME_NOT_FOUND) {
166 // ugly, but rename needs de_bh, de_deh, de_name, de_namelen, de_objectid set
167 set_de_name_and_namelen(de);
168 set_de_object_key(de);
173 /* Keyed 32-bit hash function using TEA in a Davis-Meyer function */
175 /* The third component is hashed, and you can choose from more than
176 one hash function. Per directory hashes are not yet implemented
177 but are thought about. This function should be moved to hashes.c
178 Jedi, please do so. -Hans */
180 static __u32 get_third_component(struct super_block *s,
181 const char *name, int len)
185 if (!len || (len == 1 && name[0] == '.'))
187 if (len == 2 && name[0] == '.' && name[1] == '.')
188 return DOT_DOT_OFFSET;
190 res = REISERFS_SB(s)->s_hash_function(name, len);
192 // take bits from 7-th to 30-th including both bounds
193 res = GET_HASH_VALUE(res);
195 // needed to have no names before "." and ".." those have hash
196 // value == 0 and generation conters 1 and 2 accordingly
198 return res + MAX_GENERATION_NUMBER;
201 static int reiserfs_match(struct reiserfs_dir_entry *de,
202 const char *name, int namelen)
204 int retval = NAME_NOT_FOUND;
206 if ((namelen == de->de_namelen) &&
207 !memcmp(de->de_name, name, de->de_namelen))
209 (de_visible(de->de_deh + de->de_entry_num) ? NAME_FOUND :
210 NAME_FOUND_INVISIBLE);
215 /* de's de_bh, de_ih, de_deh, de_item_num, de_entry_num are set already */
217 /* used when hash collisions exist */
219 static int linear_search_in_dir_item(struct cpu_key *key,
220 struct reiserfs_dir_entry *de,
221 const char *name, int namelen)
223 struct reiserfs_de_head *deh = de->de_deh;
227 i = de->de_entry_num;
229 if (i == I_ENTRY_COUNT(de->de_ih) ||
230 GET_HASH_VALUE(deh_offset(deh + i)) !=
231 GET_HASH_VALUE(cpu_key_k_offset(key))) {
235 RFALSE(de->de_deh != B_I_DEH(de->de_bh, de->de_ih),
236 "vs-7010: array of entry headers not found");
240 for (; i >= 0; i--, deh--) {
241 if (GET_HASH_VALUE(deh_offset(deh)) !=
242 GET_HASH_VALUE(cpu_key_k_offset(key))) {
243 // hash value does not match, no need to check whole name
244 return NAME_NOT_FOUND;
247 /* mark, that this generation number is used */
248 if (de->de_gen_number_bit_string)
249 set_bit(GET_GENERATION_NUMBER(deh_offset(deh)),
250 (unsigned long *)de->de_gen_number_bit_string);
252 // calculate pointer to name and namelen
253 de->de_entry_num = i;
254 set_de_name_and_namelen(de);
257 reiserfs_match(de, name, namelen)) != NAME_NOT_FOUND) {
258 // de's de_name, de_namelen, de_recordlen are set. Fill the rest:
260 // key of pointed object
261 set_de_object_key(de);
263 store_de_entry_key(de);
265 // retval can be NAME_FOUND or NAME_FOUND_INVISIBLE
270 if (GET_GENERATION_NUMBER(le_ih_k_offset(de->de_ih)) == 0)
271 /* we have reached left most entry in the node. In common we
272 have to go to the left neighbor, but if generation counter
273 is 0 already, we know for sure, that there is no name with
274 the same hash value */
275 // FIXME: this work correctly only because hash value can not
276 // be 0. Btw, in case of Yura's hash it is probably possible,
278 return NAME_NOT_FOUND;
280 RFALSE(de->de_item_num,
281 "vs-7015: two diritems of the same directory in one node?");
283 return GOTO_PREVIOUS_ITEM;
286 // may return NAME_FOUND, NAME_FOUND_INVISIBLE, NAME_NOT_FOUND
287 // FIXME: should add something like IOERROR
288 static int reiserfs_find_entry(struct inode *dir, const char *name, int namelen,
289 struct path *path_to_entry,
290 struct reiserfs_dir_entry *de)
292 struct cpu_key key_to_search;
295 if (namelen > REISERFS_MAX_NAME(dir->i_sb->s_blocksize))
296 return NAME_NOT_FOUND;
298 /* we will search for this key in the tree */
299 make_cpu_key(&key_to_search, dir,
300 get_third_component(dir->i_sb, name, namelen),
305 search_by_entry_key(dir->i_sb, &key_to_search,
307 if (retval == IO_ERROR) {
308 reiserfs_warning(dir->i_sb, "zam-7001: io error in %s",
313 /* compare names for all entries having given hash value */
315 linear_search_in_dir_item(&key_to_search, de, name,
317 if (retval != GOTO_PREVIOUS_ITEM) {
318 /* there is no need to scan directory anymore. Given entry found or does not exist */
319 path_to_entry->pos_in_item = de->de_entry_num;
323 /* there is left neighboring item of this directory and given entry can be there */
324 set_cpu_key_k_offset(&key_to_search,
325 le_ih_k_offset(de->de_ih) - 1);
326 pathrelse(path_to_entry);
331 static struct dentry *reiserfs_lookup(struct inode *dir, struct dentry *dentry,
332 struct nameidata *nd)
335 struct inode *inode = NULL;
336 struct reiserfs_dir_entry de;
337 INITIALIZE_PATH(path_to_entry);
339 if (REISERFS_MAX_NAME(dir->i_sb->s_blocksize) < dentry->d_name.len)
340 return ERR_PTR(-ENAMETOOLONG);
342 reiserfs_write_lock(dir->i_sb);
343 de.de_gen_number_bit_string = NULL;
345 reiserfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len,
346 &path_to_entry, &de);
347 pathrelse(&path_to_entry);
348 if (retval == NAME_FOUND) {
349 /* Hide the .reiserfs_priv directory */
350 if (reiserfs_xattrs(dir->i_sb) &&
351 !old_format_only(dir->i_sb) &&
352 REISERFS_SB(dir->i_sb)->priv_root &&
353 REISERFS_SB(dir->i_sb)->priv_root->d_inode &&
355 le32_to_cpu(INODE_PKEY
356 (REISERFS_SB(dir->i_sb)->priv_root->d_inode)->
358 reiserfs_write_unlock(dir->i_sb);
359 return ERR_PTR(-EACCES);
363 reiserfs_iget(dir->i_sb, (struct cpu_key *)&(de.de_dir_id));
364 if (!inode || IS_ERR(inode)) {
365 reiserfs_write_unlock(dir->i_sb);
366 return ERR_PTR(-EACCES);
369 /* Propogate the priv_object flag so we know we're in the priv tree */
370 if (is_reiserfs_priv_object(dir))
371 reiserfs_mark_inode_private(inode);
373 reiserfs_write_unlock(dir->i_sb);
374 if (retval == IO_ERROR) {
375 return ERR_PTR(-EIO);
379 return d_splice_alias(inode, dentry);
381 d_add(dentry, inode);
386 ** looks up the dentry of the parent directory for child.
387 ** taken from ext2_get_parent
389 struct dentry *reiserfs_get_parent(struct dentry *child)
392 struct inode *inode = NULL;
393 struct reiserfs_dir_entry de;
394 INITIALIZE_PATH(path_to_entry);
395 struct dentry *parent;
396 struct inode *dir = child->d_inode;
398 if (dir->i_nlink == 0) {
399 return ERR_PTR(-ENOENT);
401 de.de_gen_number_bit_string = NULL;
403 reiserfs_write_lock(dir->i_sb);
404 retval = reiserfs_find_entry(dir, "..", 2, &path_to_entry, &de);
405 pathrelse(&path_to_entry);
406 if (retval != NAME_FOUND) {
407 reiserfs_write_unlock(dir->i_sb);
408 return ERR_PTR(-ENOENT);
410 inode = reiserfs_iget(dir->i_sb, (struct cpu_key *)&(de.de_dir_id));
411 reiserfs_write_unlock(dir->i_sb);
413 if (!inode || IS_ERR(inode)) {
414 return ERR_PTR(-EACCES);
416 parent = d_alloc_anon(inode);
419 parent = ERR_PTR(-ENOMEM);
424 /* add entry to the directory (entry can be hidden).
426 insert definition of when hidden directories are used here -Hans
428 Does not mark dir inode dirty, do it after successesfull call to it */
430 static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
431 struct inode *dir, const char *name, int namelen,
432 struct inode *inode, int visible)
434 struct cpu_key entry_key;
435 struct reiserfs_de_head *deh;
436 INITIALIZE_PATH(path);
437 struct reiserfs_dir_entry de;
438 int bit_string[MAX_GENERATION_NUMBER / (sizeof(int) * 8) + 1];
440 char small_buf[32 + DEH_SIZE]; /* 48 bytes now and we avoid kmalloc
441 if we create file with short name */
443 int buflen, paste_size;
446 BUG_ON(!th->t_trans_id);
448 /* cannot allow items to be added into a busy deleted directory */
452 if (namelen > REISERFS_MAX_NAME(dir->i_sb->s_blocksize))
453 return -ENAMETOOLONG;
455 /* each entry has unique key. compose it */
456 make_cpu_key(&entry_key, dir,
457 get_third_component(dir->i_sb, name, namelen),
460 /* get memory for composing the entry */
461 buflen = DEH_SIZE + ROUND_UP(namelen);
462 if (buflen > sizeof(small_buf)) {
463 buffer = reiserfs_kmalloc(buflen, GFP_NOFS, dir->i_sb);
470 (get_inode_sd_version(dir) ==
471 STAT_DATA_V1) ? (DEH_SIZE + namelen) : buflen;
473 /* fill buffer : directory entry head, name[, dir objectid | , stat data | ,stat data, dir objectid ] */
474 deh = (struct reiserfs_de_head *)buffer;
475 deh->deh_location = 0; /* JDM Endian safe if 0 */
476 put_deh_offset(deh, cpu_key_k_offset(&entry_key));
477 deh->deh_state = 0; /* JDM Endian safe if 0 */
478 /* put key (ino analog) to de */
479 deh->deh_dir_id = INODE_PKEY(inode)->k_dir_id; /* safe: k_dir_id is le */
480 deh->deh_objectid = INODE_PKEY(inode)->k_objectid; /* safe: k_objectid is le */
483 memcpy((char *)(deh + 1), name, namelen);
484 /* padd by 0s to the 4 byte boundary */
485 padd_item((char *)(deh + 1), ROUND_UP(namelen), namelen);
487 /* entry is ready to be pasted into tree, set 'visibility' and 'stat data in entry' attributes */
488 mark_de_without_sd(deh);
489 visible ? mark_de_visible(deh) : mark_de_hidden(deh);
491 /* find the proper place for the new entry */
492 memset(bit_string, 0, sizeof(bit_string));
493 de.de_gen_number_bit_string = (char *)bit_string;
494 retval = reiserfs_find_entry(dir, name, namelen, &path, &de);
495 if (retval != NAME_NOT_FOUND) {
496 if (buffer != small_buf)
497 reiserfs_kfree(buffer, buflen, dir->i_sb);
500 if (retval == IO_ERROR) {
504 if (retval != NAME_FOUND) {
505 reiserfs_warning(dir->i_sb,
506 "zam-7002:%s: \"reiserfs_find_entry\" "
507 "has returned unexpected value (%d)",
508 __FUNCTION__, retval);
515 find_first_zero_bit((unsigned long *)bit_string,
516 MAX_GENERATION_NUMBER + 1);
517 if (gen_number > MAX_GENERATION_NUMBER) {
518 /* there is no free generation number */
519 reiserfs_warning(dir->i_sb,
520 "reiserfs_add_entry: Congratulations! we have got hash function screwed up");
521 if (buffer != small_buf)
522 reiserfs_kfree(buffer, buflen, dir->i_sb);
526 /* adjust offset of directory enrty */
527 put_deh_offset(deh, SET_GENERATION_NUMBER(deh_offset(deh), gen_number));
528 set_cpu_key_k_offset(&entry_key, deh_offset(deh));
530 /* update max-hash-collisions counter in reiserfs_sb_info */
531 PROC_INFO_MAX(th->t_super, max_hash_collisions, gen_number);
533 if (gen_number != 0) { /* we need to re-search for the insertion point */
534 if (search_by_entry_key(dir->i_sb, &entry_key, &path, &de) !=
536 reiserfs_warning(dir->i_sb,
537 "vs-7032: reiserfs_add_entry: "
538 "entry with this key (%K) already exists",
541 if (buffer != small_buf)
542 reiserfs_kfree(buffer, buflen, dir->i_sb);
548 /* perform the insertion of the entry that we have prepared */
550 reiserfs_paste_into_item(th, &path, &entry_key, dir, buffer,
552 if (buffer != small_buf)
553 reiserfs_kfree(buffer, buflen, dir->i_sb);
555 reiserfs_check_path(&path);
559 dir->i_size += paste_size;
560 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
561 if (!S_ISDIR(inode->i_mode) && visible)
562 // reiserfs_mkdir or reiserfs_rename will do that by itself
563 reiserfs_update_sd(th, dir);
565 reiserfs_check_path(&path);
569 /* quota utility function, call if you've had to abort after calling
570 ** new_inode_init, and have not called reiserfs_new_inode yet.
571 ** This should only be called on inodes that do not have stat data
572 ** inserted into the tree yet.
574 static int drop_new_inode(struct inode *inode)
577 make_bad_inode(inode);
578 inode->i_flags |= S_NOQUOTA;
583 /* utility function that does setup for reiserfs_new_inode.
584 ** DQUOT_INIT needs lots of credits so it's better to have it
585 ** outside of a transaction, so we had to pull some bits of
586 ** reiserfs_new_inode out into this func.
588 static int new_inode_init(struct inode *inode, struct inode *dir, int mode)
591 /* the quota init calls have to know who to charge the quota to, so
592 ** we have to set uid and gid here
594 inode->i_uid = current->fsuid;
595 inode->i_mode = mode;
597 if (dir->i_mode & S_ISGID) {
598 inode->i_gid = dir->i_gid;
600 inode->i_mode |= S_ISGID;
602 inode->i_gid = current->fsgid;
608 static int reiserfs_create(struct inode *dir, struct dentry *dentry, int mode,
609 struct nameidata *nd)
613 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
615 JOURNAL_PER_BALANCE_CNT * 2 +
616 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
617 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
618 struct reiserfs_transaction_handle th;
621 if (!(inode = new_inode(dir->i_sb))) {
624 new_inode_init(inode, dir, mode);
626 locked = reiserfs_cache_default_acl(dir);
628 reiserfs_write_lock(dir->i_sb);
631 reiserfs_write_lock_xattrs(dir->i_sb);
633 retval = journal_begin(&th, dir->i_sb, jbegin_count);
635 drop_new_inode(inode);
640 reiserfs_new_inode(&th, dir, mode, NULL, 0 /*i_size */ , dentry,
646 reiserfs_write_unlock_xattrs(dir->i_sb);
650 inode->i_op = &reiserfs_file_inode_operations;
651 inode->i_fop = &reiserfs_file_operations;
652 inode->i_mapping->a_ops = &reiserfs_address_space_operations;
655 reiserfs_add_entry(&th, dir, dentry->d_name.name,
656 dentry->d_name.len, inode, 1 /*visible */ );
660 reiserfs_update_sd(&th, inode);
661 err = journal_end(&th, dir->i_sb, jbegin_count);
667 reiserfs_update_inode_transaction(inode);
668 reiserfs_update_inode_transaction(dir);
670 d_instantiate(dentry, inode);
671 retval = journal_end(&th, dir->i_sb, jbegin_count);
675 reiserfs_write_unlock_xattrs(dir->i_sb);
676 reiserfs_write_unlock(dir->i_sb);
680 static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
685 struct reiserfs_transaction_handle th;
686 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
688 JOURNAL_PER_BALANCE_CNT * 3 +
689 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
690 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
693 if (!new_valid_dev(rdev))
696 if (!(inode = new_inode(dir->i_sb))) {
699 new_inode_init(inode, dir, mode);
701 locked = reiserfs_cache_default_acl(dir);
703 reiserfs_write_lock(dir->i_sb);
706 reiserfs_write_lock_xattrs(dir->i_sb);
708 retval = journal_begin(&th, dir->i_sb, jbegin_count);
710 drop_new_inode(inode);
715 reiserfs_new_inode(&th, dir, mode, NULL, 0 /*i_size */ , dentry,
722 reiserfs_write_unlock_xattrs(dir->i_sb);
726 inode->i_op = &reiserfs_special_inode_operations;
727 init_special_inode(inode, inode->i_mode, rdev);
729 //FIXME: needed for block and char devices only
730 reiserfs_update_sd(&th, inode);
732 reiserfs_update_inode_transaction(inode);
733 reiserfs_update_inode_transaction(dir);
736 reiserfs_add_entry(&th, dir, dentry->d_name.name,
737 dentry->d_name.len, inode, 1 /*visible */ );
741 reiserfs_update_sd(&th, inode);
742 err = journal_end(&th, dir->i_sb, jbegin_count);
749 d_instantiate(dentry, inode);
750 retval = journal_end(&th, dir->i_sb, jbegin_count);
754 reiserfs_write_unlock_xattrs(dir->i_sb);
755 reiserfs_write_unlock(dir->i_sb);
759 static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
763 struct reiserfs_transaction_handle th;
764 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
766 JOURNAL_PER_BALANCE_CNT * 3 +
767 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
768 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
771 #ifdef DISPLACE_NEW_PACKING_LOCALITIES
772 /* set flag that new packing locality created and new blocks for the content * of that directory are not displaced yet */
773 REISERFS_I(dir)->new_packing_locality = 1;
775 mode = S_IFDIR | mode;
776 if (!(inode = new_inode(dir->i_sb))) {
779 new_inode_init(inode, dir, mode);
781 locked = reiserfs_cache_default_acl(dir);
783 reiserfs_write_lock(dir->i_sb);
785 reiserfs_write_lock_xattrs(dir->i_sb);
787 retval = journal_begin(&th, dir->i_sb, jbegin_count);
789 drop_new_inode(inode);
793 /* inc the link count now, so another writer doesn't overflow it while
794 ** we sleep later on.
796 INC_DIR_INODE_NLINK(dir)
798 retval = reiserfs_new_inode(&th, dir, mode, NULL /*symlink */ ,
799 old_format_only(dir->i_sb) ?
800 EMPTY_DIR_SIZE_V1 : EMPTY_DIR_SIZE,
808 reiserfs_write_unlock_xattrs(dir->i_sb);
812 reiserfs_update_inode_transaction(inode);
813 reiserfs_update_inode_transaction(dir);
815 inode->i_op = &reiserfs_dir_inode_operations;
816 inode->i_fop = &reiserfs_dir_operations;
818 // note, _this_ add_entry will not update dir's stat data
820 reiserfs_add_entry(&th, dir, dentry->d_name.name,
821 dentry->d_name.len, inode, 1 /*visible */ );
825 DEC_DIR_INODE_NLINK(dir);
826 reiserfs_update_sd(&th, inode);
827 err = journal_end(&th, dir->i_sb, jbegin_count);
833 // the above add_entry did not update dir's stat data
834 reiserfs_update_sd(&th, dir);
836 d_instantiate(dentry, inode);
837 retval = journal_end(&th, dir->i_sb, jbegin_count);
840 reiserfs_write_unlock_xattrs(dir->i_sb);
841 reiserfs_write_unlock(dir->i_sb);
845 static inline int reiserfs_empty_dir(struct inode *inode)
847 /* we can cheat because an old format dir cannot have
848 ** EMPTY_DIR_SIZE, and a new format dir cannot have
849 ** EMPTY_DIR_SIZE_V1. So, if the inode is either size,
850 ** regardless of disk format version, the directory is empty.
852 if (inode->i_size != EMPTY_DIR_SIZE &&
853 inode->i_size != EMPTY_DIR_SIZE_V1) {
859 static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry)
863 struct reiserfs_transaction_handle th;
865 INITIALIZE_PATH(path);
866 struct reiserfs_dir_entry de;
868 /* we will be doing 2 balancings and update 2 stat data, we change quotas
869 * of the owner of the directory and of the owner of the parent directory.
870 * The quota structure is possibly deleted only on last iput => outside
871 * of this transaction */
873 JOURNAL_PER_BALANCE_CNT * 2 + 2 +
874 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
876 reiserfs_write_lock(dir->i_sb);
877 retval = journal_begin(&th, dir->i_sb, jbegin_count);
881 de.de_gen_number_bit_string = NULL;
883 reiserfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len,
884 &path, &de)) == NAME_NOT_FOUND) {
887 } else if (retval == IO_ERROR) {
892 inode = dentry->d_inode;
894 reiserfs_update_inode_transaction(inode);
895 reiserfs_update_inode_transaction(dir);
897 if (de.de_objectid != inode->i_ino) {
898 // FIXME: compare key of an object and a key found in the
903 if (!reiserfs_empty_dir(inode)) {
908 /* cut entry from dir directory */
909 retval = reiserfs_cut_from_item(&th, &path, &(de.de_entry_key), dir, NULL, /* page */
910 0 /*new file size - not used here */ );
914 if (inode->i_nlink != 2 && inode->i_nlink != 1)
915 reiserfs_warning(inode->i_sb, "%s: empty directory has nlink "
916 "!= 2 (%d)", __FUNCTION__, inode->i_nlink);
919 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
920 reiserfs_update_sd(&th, inode);
922 DEC_DIR_INODE_NLINK(dir)
923 dir->i_size -= (DEH_SIZE + de.de_entrylen);
924 reiserfs_update_sd(&th, dir);
926 /* prevent empty directory from getting lost */
927 add_save_link(&th, inode, 0 /* not truncate */ );
929 retval = journal_end(&th, dir->i_sb, jbegin_count);
930 reiserfs_check_path(&path);
932 reiserfs_write_unlock(dir->i_sb);
936 /* we must release path, because we did not call
937 reiserfs_cut_from_item, or reiserfs_cut_from_item does not
938 release path if operation was not complete */
940 err = journal_end(&th, dir->i_sb, jbegin_count);
941 reiserfs_write_unlock(dir->i_sb);
942 return err ? err : retval;
945 static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
949 struct reiserfs_dir_entry de;
950 INITIALIZE_PATH(path);
951 struct reiserfs_transaction_handle th;
953 unsigned long savelink;
955 inode = dentry->d_inode;
957 /* in this transaction we can be doing at max two balancings and update
958 * two stat datas, we change quotas of the owner of the directory and of
959 * the owner of the parent directory. The quota structure is possibly
960 * deleted only on iput => outside of this transaction */
962 JOURNAL_PER_BALANCE_CNT * 2 + 2 +
963 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
965 reiserfs_write_lock(dir->i_sb);
966 retval = journal_begin(&th, dir->i_sb, jbegin_count);
970 de.de_gen_number_bit_string = NULL;
972 reiserfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len,
973 &path, &de)) == NAME_NOT_FOUND) {
976 } else if (retval == IO_ERROR) {
981 reiserfs_update_inode_transaction(inode);
982 reiserfs_update_inode_transaction(dir);
984 if (de.de_objectid != inode->i_ino) {
985 // FIXME: compare key of an object and a key found in the
991 if (!inode->i_nlink) {
992 reiserfs_warning(inode->i_sb, "%s: deleting nonexistent file "
993 "(%s:%lu), %d", __FUNCTION__,
994 reiserfs_bdevname(inode->i_sb), inode->i_ino,
1002 * we schedule before doing the add_save_link call, save the link
1003 * count so we don't race
1005 savelink = inode->i_nlink;
1008 reiserfs_cut_from_item(&th, &path, &(de.de_entry_key), dir, NULL,
1014 inode->i_ctime = CURRENT_TIME_SEC;
1015 reiserfs_update_sd(&th, inode);
1017 dir->i_size -= (de.de_entrylen + DEH_SIZE);
1018 dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
1019 reiserfs_update_sd(&th, dir);
1022 /* prevent file from getting lost */
1023 add_save_link(&th, inode, 0 /* not truncate */ );
1025 retval = journal_end(&th, dir->i_sb, jbegin_count);
1026 reiserfs_check_path(&path);
1027 reiserfs_write_unlock(dir->i_sb);
1032 err = journal_end(&th, dir->i_sb, jbegin_count);
1033 reiserfs_check_path(&path);
1037 reiserfs_write_unlock(dir->i_sb);
1041 static int reiserfs_symlink(struct inode *parent_dir,
1042 struct dentry *dentry, const char *symname)
1045 struct inode *inode;
1048 struct reiserfs_transaction_handle th;
1049 int mode = S_IFLNK | S_IRWXUGO;
1050 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
1052 JOURNAL_PER_BALANCE_CNT * 3 +
1053 2 * (REISERFS_QUOTA_INIT_BLOCKS(parent_dir->i_sb) +
1054 REISERFS_QUOTA_TRANS_BLOCKS(parent_dir->i_sb));
1056 if (!(inode = new_inode(parent_dir->i_sb))) {
1059 new_inode_init(inode, parent_dir, mode);
1061 reiserfs_write_lock(parent_dir->i_sb);
1062 item_len = ROUND_UP(strlen(symname));
1063 if (item_len > MAX_DIRECT_ITEM_LEN(parent_dir->i_sb->s_blocksize)) {
1064 retval = -ENAMETOOLONG;
1065 drop_new_inode(inode);
1069 name = reiserfs_kmalloc(item_len, GFP_NOFS, parent_dir->i_sb);
1071 drop_new_inode(inode);
1075 memcpy(name, symname, strlen(symname));
1076 padd_item(name, item_len, strlen(symname));
1078 /* We would inherit the default ACL here, but symlinks don't get ACLs */
1080 retval = journal_begin(&th, parent_dir->i_sb, jbegin_count);
1082 drop_new_inode(inode);
1083 reiserfs_kfree(name, item_len, parent_dir->i_sb);
1088 reiserfs_new_inode(&th, parent_dir, mode, name, strlen(symname),
1090 reiserfs_kfree(name, item_len, parent_dir->i_sb);
1091 if (retval) { /* reiserfs_new_inode iputs for us */
1095 reiserfs_update_inode_transaction(inode);
1096 reiserfs_update_inode_transaction(parent_dir);
1098 inode->i_op = &reiserfs_symlink_inode_operations;
1099 inode->i_mapping->a_ops = &reiserfs_address_space_operations;
1101 // must be sure this inode is written with this transaction
1103 //reiserfs_update_sd (&th, inode, READ_BLOCKS);
1105 retval = reiserfs_add_entry(&th, parent_dir, dentry->d_name.name,
1106 dentry->d_name.len, inode, 1 /*visible */ );
1110 reiserfs_update_sd(&th, inode);
1111 err = journal_end(&th, parent_dir->i_sb, jbegin_count);
1118 d_instantiate(dentry, inode);
1119 retval = journal_end(&th, parent_dir->i_sb, jbegin_count);
1121 reiserfs_write_unlock(parent_dir->i_sb);
1125 static int reiserfs_link(struct dentry *old_dentry, struct inode *dir,
1126 struct dentry *dentry)
1129 struct inode *inode = old_dentry->d_inode;
1130 struct reiserfs_transaction_handle th;
1131 /* We need blocks for transaction + update of quotas for the owners of the directory */
1133 JOURNAL_PER_BALANCE_CNT * 3 +
1134 2 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
1136 reiserfs_write_lock(dir->i_sb);
1137 if (inode->i_nlink >= REISERFS_LINK_MAX) {
1138 //FIXME: sd_nlink is 32 bit for new files
1139 reiserfs_write_unlock(dir->i_sb);
1142 if (inode->i_nlink == 0) {
1143 reiserfs_write_unlock(dir->i_sb);
1147 /* inc before scheduling so reiserfs_unlink knows we are here */
1150 retval = journal_begin(&th, dir->i_sb, jbegin_count);
1153 reiserfs_write_unlock(dir->i_sb);
1157 /* create new entry */
1159 reiserfs_add_entry(&th, dir, dentry->d_name.name,
1160 dentry->d_name.len, inode, 1 /*visible */ );
1162 reiserfs_update_inode_transaction(inode);
1163 reiserfs_update_inode_transaction(dir);
1168 err = journal_end(&th, dir->i_sb, jbegin_count);
1169 reiserfs_write_unlock(dir->i_sb);
1170 return err ? err : retval;
1173 inode->i_ctime = CURRENT_TIME_SEC;
1174 reiserfs_update_sd(&th, inode);
1176 atomic_inc(&inode->i_count);
1177 d_instantiate(dentry, inode);
1178 retval = journal_end(&th, dir->i_sb, jbegin_count);
1179 reiserfs_write_unlock(dir->i_sb);
1183 // de contains information pointing to an entry which
1184 static int de_still_valid(const char *name, int len,
1185 struct reiserfs_dir_entry *de)
1187 struct reiserfs_dir_entry tmp = *de;
1189 // recalculate pointer to name and name length
1190 set_de_name_and_namelen(&tmp);
1191 // FIXME: could check more
1192 if (tmp.de_namelen != len || memcmp(name, de->de_name, len))
1197 static int entry_points_to_object(const char *name, int len,
1198 struct reiserfs_dir_entry *de,
1199 struct inode *inode)
1201 if (!de_still_valid(name, len, de))
1205 if (!de_visible(de->de_deh + de->de_entry_num))
1206 reiserfs_panic(NULL,
1207 "vs-7042: entry_points_to_object: entry must be visible");
1208 return (de->de_objectid == inode->i_ino) ? 1 : 0;
1211 /* this must be added hidden entry */
1212 if (de_visible(de->de_deh + de->de_entry_num))
1213 reiserfs_panic(NULL,
1214 "vs-7043: entry_points_to_object: entry must be visible");
1219 /* sets key of objectid the entry has to point to */
1220 static void set_ino_in_dir_entry(struct reiserfs_dir_entry *de,
1221 struct reiserfs_key *key)
1223 /* JDM These operations are endian safe - both are le */
1224 de->de_deh[de->de_entry_num].deh_dir_id = key->k_dir_id;
1225 de->de_deh[de->de_entry_num].deh_objectid = key->k_objectid;
1229 * process, that is going to call fix_nodes/do_balance must hold only
1230 * one path. If it holds 2 or more, it can get into endless waiting in
1231 * get_empty_nodes or its clones
1233 static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1234 struct inode *new_dir, struct dentry *new_dentry)
1237 INITIALIZE_PATH(old_entry_path);
1238 INITIALIZE_PATH(new_entry_path);
1239 INITIALIZE_PATH(dot_dot_entry_path);
1240 struct item_head new_entry_ih, old_entry_ih, dot_dot_ih;
1241 struct reiserfs_dir_entry old_de, new_de, dot_dot_de;
1242 struct inode *old_inode, *new_dentry_inode;
1243 struct reiserfs_transaction_handle th;
1245 umode_t old_inode_mode;
1246 unsigned long savelink = 1;
1247 struct timespec ctime;
1249 /* three balancings: (1) old name removal, (2) new name insertion
1250 and (3) maybe "save" link insertion
1251 stat data updates: (1) old directory,
1252 (2) new directory and (3) maybe old object stat data (when it is
1253 directory) and (4) maybe stat data of object to which new entry
1254 pointed initially and (5) maybe block containing ".." of
1256 quota updates: two parent directories */
1258 JOURNAL_PER_BALANCE_CNT * 3 + 5 +
1259 4 * REISERFS_QUOTA_TRANS_BLOCKS(old_dir->i_sb);
1261 old_inode = old_dentry->d_inode;
1262 new_dentry_inode = new_dentry->d_inode;
1264 // make sure, that oldname still exists and points to an object we
1265 // are going to rename
1266 old_de.de_gen_number_bit_string = NULL;
1267 reiserfs_write_lock(old_dir->i_sb);
1269 reiserfs_find_entry(old_dir, old_dentry->d_name.name,
1270 old_dentry->d_name.len, &old_entry_path,
1272 pathrelse(&old_entry_path);
1273 if (retval == IO_ERROR) {
1274 reiserfs_write_unlock(old_dir->i_sb);
1278 if (retval != NAME_FOUND || old_de.de_objectid != old_inode->i_ino) {
1279 reiserfs_write_unlock(old_dir->i_sb);
1283 old_inode_mode = old_inode->i_mode;
1284 if (S_ISDIR(old_inode_mode)) {
1285 // make sure, that directory being renamed has correct ".."
1286 // and that its new parent directory has not too many links
1289 if (new_dentry_inode) {
1290 if (!reiserfs_empty_dir(new_dentry_inode)) {
1291 reiserfs_write_unlock(old_dir->i_sb);
1296 /* directory is renamed, its parent directory will be changed,
1297 ** so find ".." entry
1299 dot_dot_de.de_gen_number_bit_string = NULL;
1301 reiserfs_find_entry(old_inode, "..", 2, &dot_dot_entry_path,
1303 pathrelse(&dot_dot_entry_path);
1304 if (retval != NAME_FOUND) {
1305 reiserfs_write_unlock(old_dir->i_sb);
1309 /* inode number of .. must equal old_dir->i_ino */
1310 if (dot_dot_de.de_objectid != old_dir->i_ino) {
1311 reiserfs_write_unlock(old_dir->i_sb);
1316 retval = journal_begin(&th, old_dir->i_sb, jbegin_count);
1318 reiserfs_write_unlock(old_dir->i_sb);
1322 /* add new entry (or find the existing one) */
1324 reiserfs_add_entry(&th, new_dir, new_dentry->d_name.name,
1325 new_dentry->d_name.len, old_inode, 0);
1326 if (retval == -EEXIST) {
1327 if (!new_dentry_inode) {
1328 reiserfs_panic(old_dir->i_sb,
1329 "vs-7050: new entry is found, new inode == 0\n");
1331 } else if (retval) {
1332 int err = journal_end(&th, old_dir->i_sb, jbegin_count);
1333 reiserfs_write_unlock(old_dir->i_sb);
1334 return err ? err : retval;
1337 reiserfs_update_inode_transaction(old_dir);
1338 reiserfs_update_inode_transaction(new_dir);
1340 /* this makes it so an fsync on an open fd for the old name will
1341 ** commit the rename operation
1343 reiserfs_update_inode_transaction(old_inode);
1345 if (new_dentry_inode)
1346 reiserfs_update_inode_transaction(new_dentry_inode);
1349 // look for old name using corresponding entry key (found by reiserfs_find_entry)
1351 search_by_entry_key(new_dir->i_sb, &old_de.de_entry_key,
1353 &old_de)) != NAME_FOUND) {
1354 pathrelse(&old_entry_path);
1355 journal_end(&th, old_dir->i_sb, jbegin_count);
1356 reiserfs_write_unlock(old_dir->i_sb);
1360 copy_item_head(&old_entry_ih, get_ih(&old_entry_path));
1362 reiserfs_prepare_for_journal(old_inode->i_sb, old_de.de_bh, 1);
1364 // look for new name by reiserfs_find_entry
1365 new_de.de_gen_number_bit_string = NULL;
1367 reiserfs_find_entry(new_dir, new_dentry->d_name.name,
1368 new_dentry->d_name.len, &new_entry_path,
1370 // reiserfs_add_entry should not return IO_ERROR, because it is called with essentially same parameters from
1371 // reiserfs_add_entry above, and we'll catch any i/o errors before we get here.
1372 if (retval != NAME_FOUND_INVISIBLE && retval != NAME_FOUND) {
1373 pathrelse(&new_entry_path);
1374 pathrelse(&old_entry_path);
1375 journal_end(&th, old_dir->i_sb, jbegin_count);
1376 reiserfs_write_unlock(old_dir->i_sb);
1380 copy_item_head(&new_entry_ih, get_ih(&new_entry_path));
1382 reiserfs_prepare_for_journal(old_inode->i_sb, new_de.de_bh, 1);
1384 if (S_ISDIR(old_inode->i_mode)) {
1386 search_by_entry_key(new_dir->i_sb,
1387 &dot_dot_de.de_entry_key,
1388 &dot_dot_entry_path,
1389 &dot_dot_de)) != NAME_FOUND) {
1390 pathrelse(&dot_dot_entry_path);
1391 pathrelse(&new_entry_path);
1392 pathrelse(&old_entry_path);
1393 journal_end(&th, old_dir->i_sb, jbegin_count);
1394 reiserfs_write_unlock(old_dir->i_sb);
1397 copy_item_head(&dot_dot_ih,
1398 get_ih(&dot_dot_entry_path));
1399 // node containing ".." gets into transaction
1400 reiserfs_prepare_for_journal(old_inode->i_sb,
1401 dot_dot_de.de_bh, 1);
1403 /* we should check seals here, not do
1404 this stuff, yes? Then, having
1405 gathered everything into RAM we
1406 should lock the buffers, yes? -Hans */
1407 /* probably. our rename needs to hold more
1408 ** than one path at once. The seals would
1409 ** have to be written to deal with multi-path
1412 /* sanity checking before doing the rename - avoid races many
1413 ** of the above checks could have scheduled. We have to be
1414 ** sure our items haven't been shifted by another process.
1416 if (item_moved(&new_entry_ih, &new_entry_path) ||
1417 !entry_points_to_object(new_dentry->d_name.name,
1418 new_dentry->d_name.len,
1419 &new_de, new_dentry_inode) ||
1420 item_moved(&old_entry_ih, &old_entry_path) ||
1421 !entry_points_to_object(old_dentry->d_name.name,
1422 old_dentry->d_name.len,
1423 &old_de, old_inode)) {
1424 reiserfs_restore_prepared_buffer(old_inode->i_sb,
1426 reiserfs_restore_prepared_buffer(old_inode->i_sb,
1428 if (S_ISDIR(old_inode_mode))
1429 reiserfs_restore_prepared_buffer(old_inode->
1435 if (S_ISDIR(old_inode_mode)) {
1436 if (item_moved(&dot_dot_ih, &dot_dot_entry_path) ||
1437 !entry_points_to_object("..", 2, &dot_dot_de,
1439 reiserfs_restore_prepared_buffer(old_inode->
1442 reiserfs_restore_prepared_buffer(old_inode->
1445 reiserfs_restore_prepared_buffer(old_inode->
1453 RFALSE(S_ISDIR(old_inode_mode) &&
1454 !buffer_journal_prepared(dot_dot_de.de_bh), "");
1459 /* ok, all the changes can be done in one fell swoop when we
1460 have claimed all the buffers needed. */
1462 mark_de_visible(new_de.de_deh + new_de.de_entry_num);
1463 set_ino_in_dir_entry(&new_de, INODE_PKEY(old_inode));
1464 journal_mark_dirty(&th, old_dir->i_sb, new_de.de_bh);
1466 mark_de_hidden(old_de.de_deh + old_de.de_entry_num);
1467 journal_mark_dirty(&th, old_dir->i_sb, old_de.de_bh);
1468 ctime = CURRENT_TIME_SEC;
1469 old_dir->i_ctime = old_dir->i_mtime = ctime;
1470 new_dir->i_ctime = new_dir->i_mtime = ctime;
1471 /* thanks to Alex Adriaanse <alex_a@caltech.edu> for patch which adds ctime update of
1473 old_inode->i_ctime = ctime;
1475 if (new_dentry_inode) {
1476 // adjust link number of the victim
1477 if (S_ISDIR(new_dentry_inode->i_mode)) {
1478 new_dentry_inode->i_nlink = 0;
1480 new_dentry_inode->i_nlink--;
1482 new_dentry_inode->i_ctime = ctime;
1483 savelink = new_dentry_inode->i_nlink;
1486 if (S_ISDIR(old_inode_mode)) {
1487 // adjust ".." of renamed directory
1488 set_ino_in_dir_entry(&dot_dot_de, INODE_PKEY(new_dir));
1489 journal_mark_dirty(&th, new_dir->i_sb, dot_dot_de.de_bh);
1491 if (!new_dentry_inode)
1492 /* there (in new_dir) was no directory, so it got new link
1493 (".." of renamed directory) */
1494 INC_DIR_INODE_NLINK(new_dir);
1496 /* old directory lost one link - ".. " of renamed directory */
1497 DEC_DIR_INODE_NLINK(old_dir);
1499 // looks like in 2.3.99pre3 brelse is atomic. so we can use pathrelse
1500 pathrelse(&new_entry_path);
1501 pathrelse(&dot_dot_entry_path);
1503 // FIXME: this reiserfs_cut_from_item's return value may screw up
1504 // anybody, but it will panic if will not be able to find the
1505 // entry. This needs one more clean up
1506 if (reiserfs_cut_from_item
1507 (&th, &old_entry_path, &(old_de.de_entry_key), old_dir, NULL,
1509 reiserfs_warning(old_dir->i_sb,
1510 "vs-7060: reiserfs_rename: couldn't not cut old name. Fsck later?");
1512 old_dir->i_size -= DEH_SIZE + old_de.de_entrylen;
1514 reiserfs_update_sd(&th, old_dir);
1515 reiserfs_update_sd(&th, new_dir);
1516 reiserfs_update_sd(&th, old_inode);
1518 if (new_dentry_inode) {
1520 add_save_link(&th, new_dentry_inode,
1521 0 /* not truncate */ );
1522 reiserfs_update_sd(&th, new_dentry_inode);
1525 retval = journal_end(&th, old_dir->i_sb, jbegin_count);
1526 reiserfs_write_unlock(old_dir->i_sb);
1531 * directories can handle most operations...
1533 struct inode_operations reiserfs_dir_inode_operations = {
1534 //&reiserfs_dir_operations, /* default_file_ops */
1535 .create = reiserfs_create,
1536 .lookup = reiserfs_lookup,
1537 .link = reiserfs_link,
1538 .unlink = reiserfs_unlink,
1539 .symlink = reiserfs_symlink,
1540 .mkdir = reiserfs_mkdir,
1541 .rmdir = reiserfs_rmdir,
1542 .mknod = reiserfs_mknod,
1543 .rename = reiserfs_rename,
1544 .setattr = reiserfs_setattr,
1545 .setxattr = reiserfs_setxattr,
1546 .getxattr = reiserfs_getxattr,
1547 .listxattr = reiserfs_listxattr,
1548 .removexattr = reiserfs_removexattr,
1549 .permission = reiserfs_permission,
1553 * symlink operations.. same as page_symlink_inode_operations, with xattr
1556 struct inode_operations reiserfs_symlink_inode_operations = {
1557 .readlink = generic_readlink,
1558 .follow_link = page_follow_link_light,
1559 .put_link = page_put_link,
1560 .setattr = reiserfs_setattr,
1561 .setxattr = reiserfs_setxattr,
1562 .getxattr = reiserfs_getxattr,
1563 .listxattr = reiserfs_listxattr,
1564 .removexattr = reiserfs_removexattr,
1565 .permission = reiserfs_permission,
1570 * special file operations.. just xattr/acl stuff
1572 struct inode_operations reiserfs_special_inode_operations = {
1573 .setattr = reiserfs_setattr,
1574 .setxattr = reiserfs_setxattr,
1575 .getxattr = reiserfs_getxattr,
1576 .listxattr = reiserfs_listxattr,
1577 .removexattr = reiserfs_removexattr,
1578 .permission = reiserfs_permission,