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 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);
378 return d_splice_alias(inode, dentry);
382 ** looks up the dentry of the parent directory for child.
383 ** taken from ext2_get_parent
385 struct dentry *reiserfs_get_parent(struct dentry *child)
388 struct inode *inode = NULL;
389 struct reiserfs_dir_entry de;
390 INITIALIZE_PATH(path_to_entry);
391 struct dentry *parent;
392 struct inode *dir = child->d_inode;
394 if (dir->i_nlink == 0) {
395 return ERR_PTR(-ENOENT);
397 de.de_gen_number_bit_string = NULL;
399 reiserfs_write_lock(dir->i_sb);
400 retval = reiserfs_find_entry(dir, "..", 2, &path_to_entry, &de);
401 pathrelse(&path_to_entry);
402 if (retval != NAME_FOUND) {
403 reiserfs_write_unlock(dir->i_sb);
404 return ERR_PTR(-ENOENT);
406 inode = reiserfs_iget(dir->i_sb, (struct cpu_key *)&(de.de_dir_id));
407 reiserfs_write_unlock(dir->i_sb);
409 if (!inode || IS_ERR(inode)) {
410 return ERR_PTR(-EACCES);
412 parent = d_alloc_anon(inode);
415 parent = ERR_PTR(-ENOMEM);
420 /* add entry to the directory (entry can be hidden).
422 insert definition of when hidden directories are used here -Hans
424 Does not mark dir inode dirty, do it after successesfull call to it */
426 static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
427 struct inode *dir, const char *name, int namelen,
428 struct inode *inode, int visible)
430 struct cpu_key entry_key;
431 struct reiserfs_de_head *deh;
432 INITIALIZE_PATH(path);
433 struct reiserfs_dir_entry de;
434 DECLARE_BITMAP(bit_string, MAX_GENERATION_NUMBER + 1);
436 char small_buf[32 + DEH_SIZE]; /* 48 bytes now and we avoid kmalloc
437 if we create file with short name */
439 int buflen, paste_size;
442 BUG_ON(!th->t_trans_id);
444 /* cannot allow items to be added into a busy deleted directory */
448 if (namelen > REISERFS_MAX_NAME(dir->i_sb->s_blocksize))
449 return -ENAMETOOLONG;
451 /* each entry has unique key. compose it */
452 make_cpu_key(&entry_key, dir,
453 get_third_component(dir->i_sb, name, namelen),
456 /* get memory for composing the entry */
457 buflen = DEH_SIZE + ROUND_UP(namelen);
458 if (buflen > sizeof(small_buf)) {
459 buffer = kmalloc(buflen, GFP_NOFS);
466 (get_inode_sd_version(dir) ==
467 STAT_DATA_V1) ? (DEH_SIZE + namelen) : buflen;
469 /* fill buffer : directory entry head, name[, dir objectid | , stat data | ,stat data, dir objectid ] */
470 deh = (struct reiserfs_de_head *)buffer;
471 deh->deh_location = 0; /* JDM Endian safe if 0 */
472 put_deh_offset(deh, cpu_key_k_offset(&entry_key));
473 deh->deh_state = 0; /* JDM Endian safe if 0 */
474 /* put key (ino analog) to de */
475 deh->deh_dir_id = INODE_PKEY(inode)->k_dir_id; /* safe: k_dir_id is le */
476 deh->deh_objectid = INODE_PKEY(inode)->k_objectid; /* safe: k_objectid is le */
479 memcpy((char *)(deh + 1), name, namelen);
480 /* padd by 0s to the 4 byte boundary */
481 padd_item((char *)(deh + 1), ROUND_UP(namelen), namelen);
483 /* entry is ready to be pasted into tree, set 'visibility' and 'stat data in entry' attributes */
484 mark_de_without_sd(deh);
485 visible ? mark_de_visible(deh) : mark_de_hidden(deh);
487 /* find the proper place for the new entry */
488 memset(bit_string, 0, sizeof(bit_string));
489 de.de_gen_number_bit_string = bit_string;
490 retval = reiserfs_find_entry(dir, name, namelen, &path, &de);
491 if (retval != NAME_NOT_FOUND) {
492 if (buffer != small_buf)
496 if (retval == IO_ERROR) {
500 if (retval != NAME_FOUND) {
501 reiserfs_warning(dir->i_sb,
502 "zam-7002:%s: \"reiserfs_find_entry\" "
503 "has returned unexpected value (%d)",
504 __FUNCTION__, retval);
511 find_first_zero_bit(bit_string,
512 MAX_GENERATION_NUMBER + 1);
513 if (gen_number > MAX_GENERATION_NUMBER) {
514 /* there is no free generation number */
515 reiserfs_warning(dir->i_sb,
516 "reiserfs_add_entry: Congratulations! we have got hash function screwed up");
517 if (buffer != small_buf)
522 /* adjust offset of directory enrty */
523 put_deh_offset(deh, SET_GENERATION_NUMBER(deh_offset(deh), gen_number));
524 set_cpu_key_k_offset(&entry_key, deh_offset(deh));
526 /* update max-hash-collisions counter in reiserfs_sb_info */
527 PROC_INFO_MAX(th->t_super, max_hash_collisions, gen_number);
529 if (gen_number != 0) { /* we need to re-search for the insertion point */
530 if (search_by_entry_key(dir->i_sb, &entry_key, &path, &de) !=
532 reiserfs_warning(dir->i_sb,
533 "vs-7032: reiserfs_add_entry: "
534 "entry with this key (%K) already exists",
537 if (buffer != small_buf)
544 /* perform the insertion of the entry that we have prepared */
546 reiserfs_paste_into_item(th, &path, &entry_key, dir, buffer,
548 if (buffer != small_buf)
551 reiserfs_check_path(&path);
555 dir->i_size += paste_size;
556 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
557 if (!S_ISDIR(inode->i_mode) && visible)
558 // reiserfs_mkdir or reiserfs_rename will do that by itself
559 reiserfs_update_sd(th, dir);
561 reiserfs_check_path(&path);
565 /* quota utility function, call if you've had to abort after calling
566 ** new_inode_init, and have not called reiserfs_new_inode yet.
567 ** This should only be called on inodes that do not have stat data
568 ** inserted into the tree yet.
570 static int drop_new_inode(struct inode *inode)
573 make_bad_inode(inode);
574 inode->i_flags |= S_NOQUOTA;
579 /* utility function that does setup for reiserfs_new_inode.
580 ** DQUOT_INIT needs lots of credits so it's better to have it
581 ** outside of a transaction, so we had to pull some bits of
582 ** reiserfs_new_inode out into this func.
584 static int new_inode_init(struct inode *inode, struct inode *dir, int mode)
587 /* the quota init calls have to know who to charge the quota to, so
588 ** we have to set uid and gid here
590 inode->i_uid = current->fsuid;
591 inode->i_mode = mode;
592 /* Make inode invalid - just in case we are going to drop it before
593 * the initialization happens */
594 INODE_PKEY(inode)->k_objectid = 0;
596 if (dir->i_mode & S_ISGID) {
597 inode->i_gid = dir->i_gid;
599 inode->i_mode |= S_ISGID;
601 inode->i_gid = current->fsgid;
607 static int reiserfs_create(struct inode *dir, struct dentry *dentry, int mode,
608 struct nameidata *nd)
612 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
614 JOURNAL_PER_BALANCE_CNT * 2 +
615 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
616 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
617 struct reiserfs_transaction_handle th;
620 if (!(inode = new_inode(dir->i_sb))) {
623 new_inode_init(inode, dir, mode);
625 locked = reiserfs_cache_default_acl(dir);
627 reiserfs_write_lock(dir->i_sb);
630 reiserfs_write_lock_xattrs(dir->i_sb);
632 retval = journal_begin(&th, dir->i_sb, jbegin_count);
634 drop_new_inode(inode);
639 reiserfs_new_inode(&th, dir, mode, NULL, 0 /*i_size */ , dentry,
645 reiserfs_write_unlock_xattrs(dir->i_sb);
649 inode->i_op = &reiserfs_file_inode_operations;
650 inode->i_fop = &reiserfs_file_operations;
651 inode->i_mapping->a_ops = &reiserfs_address_space_operations;
654 reiserfs_add_entry(&th, dir, dentry->d_name.name,
655 dentry->d_name.len, inode, 1 /*visible */ );
659 reiserfs_update_sd(&th, inode);
660 err = journal_end(&th, dir->i_sb, jbegin_count);
666 reiserfs_update_inode_transaction(inode);
667 reiserfs_update_inode_transaction(dir);
669 d_instantiate(dentry, inode);
670 retval = journal_end(&th, dir->i_sb, jbegin_count);
674 reiserfs_write_unlock_xattrs(dir->i_sb);
675 reiserfs_write_unlock(dir->i_sb);
679 static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
684 struct reiserfs_transaction_handle th;
685 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
687 JOURNAL_PER_BALANCE_CNT * 3 +
688 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
689 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
692 if (!new_valid_dev(rdev))
695 if (!(inode = new_inode(dir->i_sb))) {
698 new_inode_init(inode, dir, mode);
700 locked = reiserfs_cache_default_acl(dir);
702 reiserfs_write_lock(dir->i_sb);
705 reiserfs_write_lock_xattrs(dir->i_sb);
707 retval = journal_begin(&th, dir->i_sb, jbegin_count);
709 drop_new_inode(inode);
714 reiserfs_new_inode(&th, dir, mode, NULL, 0 /*i_size */ , dentry,
721 reiserfs_write_unlock_xattrs(dir->i_sb);
725 inode->i_op = &reiserfs_special_inode_operations;
726 init_special_inode(inode, inode->i_mode, rdev);
728 //FIXME: needed for block and char devices only
729 reiserfs_update_sd(&th, inode);
731 reiserfs_update_inode_transaction(inode);
732 reiserfs_update_inode_transaction(dir);
735 reiserfs_add_entry(&th, dir, dentry->d_name.name,
736 dentry->d_name.len, inode, 1 /*visible */ );
740 reiserfs_update_sd(&th, inode);
741 err = journal_end(&th, dir->i_sb, jbegin_count);
748 d_instantiate(dentry, inode);
749 retval = journal_end(&th, dir->i_sb, jbegin_count);
753 reiserfs_write_unlock_xattrs(dir->i_sb);
754 reiserfs_write_unlock(dir->i_sb);
758 static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
762 struct reiserfs_transaction_handle th;
763 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
765 JOURNAL_PER_BALANCE_CNT * 3 +
766 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
767 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
770 #ifdef DISPLACE_NEW_PACKING_LOCALITIES
771 /* set flag that new packing locality created and new blocks for the content * of that directory are not displaced yet */
772 REISERFS_I(dir)->new_packing_locality = 1;
774 mode = S_IFDIR | mode;
775 if (!(inode = new_inode(dir->i_sb))) {
778 new_inode_init(inode, dir, mode);
780 locked = reiserfs_cache_default_acl(dir);
782 reiserfs_write_lock(dir->i_sb);
784 reiserfs_write_lock_xattrs(dir->i_sb);
786 retval = journal_begin(&th, dir->i_sb, jbegin_count);
788 drop_new_inode(inode);
792 /* inc the link count now, so another writer doesn't overflow it while
793 ** we sleep later on.
795 INC_DIR_INODE_NLINK(dir)
797 retval = reiserfs_new_inode(&th, dir, mode, NULL /*symlink */ ,
798 old_format_only(dir->i_sb) ?
799 EMPTY_DIR_SIZE_V1 : EMPTY_DIR_SIZE,
807 reiserfs_write_unlock_xattrs(dir->i_sb);
811 reiserfs_update_inode_transaction(inode);
812 reiserfs_update_inode_transaction(dir);
814 inode->i_op = &reiserfs_dir_inode_operations;
815 inode->i_fop = &reiserfs_dir_operations;
817 // note, _this_ add_entry will not update dir's stat data
819 reiserfs_add_entry(&th, dir, dentry->d_name.name,
820 dentry->d_name.len, inode, 1 /*visible */ );
824 DEC_DIR_INODE_NLINK(dir);
825 reiserfs_update_sd(&th, inode);
826 err = journal_end(&th, dir->i_sb, jbegin_count);
832 // the above add_entry did not update dir's stat data
833 reiserfs_update_sd(&th, dir);
835 d_instantiate(dentry, inode);
836 retval = journal_end(&th, dir->i_sb, jbegin_count);
839 reiserfs_write_unlock_xattrs(dir->i_sb);
840 reiserfs_write_unlock(dir->i_sb);
844 static inline int reiserfs_empty_dir(struct inode *inode)
846 /* we can cheat because an old format dir cannot have
847 ** EMPTY_DIR_SIZE, and a new format dir cannot have
848 ** EMPTY_DIR_SIZE_V1. So, if the inode is either size,
849 ** regardless of disk format version, the directory is empty.
851 if (inode->i_size != EMPTY_DIR_SIZE &&
852 inode->i_size != EMPTY_DIR_SIZE_V1) {
858 static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry)
862 struct reiserfs_transaction_handle th;
864 INITIALIZE_PATH(path);
865 struct reiserfs_dir_entry de;
867 /* we will be doing 2 balancings and update 2 stat data, we change quotas
868 * of the owner of the directory and of the owner of the parent directory.
869 * The quota structure is possibly deleted only on last iput => outside
870 * of this transaction */
872 JOURNAL_PER_BALANCE_CNT * 2 + 2 +
873 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
875 reiserfs_write_lock(dir->i_sb);
876 retval = journal_begin(&th, dir->i_sb, jbegin_count);
880 de.de_gen_number_bit_string = NULL;
882 reiserfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len,
883 &path, &de)) == NAME_NOT_FOUND) {
886 } else if (retval == IO_ERROR) {
891 inode = dentry->d_inode;
893 reiserfs_update_inode_transaction(inode);
894 reiserfs_update_inode_transaction(dir);
896 if (de.de_objectid != inode->i_ino) {
897 // FIXME: compare key of an object and a key found in the
902 if (!reiserfs_empty_dir(inode)) {
907 /* cut entry from dir directory */
908 retval = reiserfs_cut_from_item(&th, &path, &(de.de_entry_key), dir, NULL, /* page */
909 0 /*new file size - not used here */ );
913 if (inode->i_nlink != 2 && inode->i_nlink != 1)
914 reiserfs_warning(inode->i_sb, "%s: empty directory has nlink "
915 "!= 2 (%d)", __FUNCTION__, inode->i_nlink);
918 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
919 reiserfs_update_sd(&th, inode);
921 DEC_DIR_INODE_NLINK(dir)
922 dir->i_size -= (DEH_SIZE + de.de_entrylen);
923 reiserfs_update_sd(&th, dir);
925 /* prevent empty directory from getting lost */
926 add_save_link(&th, inode, 0 /* not truncate */ );
928 retval = journal_end(&th, dir->i_sb, jbegin_count);
929 reiserfs_check_path(&path);
931 reiserfs_write_unlock(dir->i_sb);
935 /* we must release path, because we did not call
936 reiserfs_cut_from_item, or reiserfs_cut_from_item does not
937 release path if operation was not complete */
939 err = journal_end(&th, dir->i_sb, jbegin_count);
940 reiserfs_write_unlock(dir->i_sb);
941 return err ? err : retval;
944 static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
948 struct reiserfs_dir_entry de;
949 INITIALIZE_PATH(path);
950 struct reiserfs_transaction_handle th;
952 unsigned long savelink;
954 inode = dentry->d_inode;
956 /* in this transaction we can be doing at max two balancings and update
957 * two stat datas, we change quotas of the owner of the directory and of
958 * the owner of the parent directory. The quota structure is possibly
959 * deleted only on iput => outside of this transaction */
961 JOURNAL_PER_BALANCE_CNT * 2 + 2 +
962 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
964 reiserfs_write_lock(dir->i_sb);
965 retval = journal_begin(&th, dir->i_sb, jbegin_count);
969 de.de_gen_number_bit_string = NULL;
971 reiserfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len,
972 &path, &de)) == NAME_NOT_FOUND) {
975 } else if (retval == IO_ERROR) {
980 reiserfs_update_inode_transaction(inode);
981 reiserfs_update_inode_transaction(dir);
983 if (de.de_objectid != inode->i_ino) {
984 // FIXME: compare key of an object and a key found in the
990 if (!inode->i_nlink) {
991 reiserfs_warning(inode->i_sb, "%s: deleting nonexistent file "
992 "(%s:%lu), %d", __FUNCTION__,
993 reiserfs_bdevname(inode->i_sb), inode->i_ino,
1001 * we schedule before doing the add_save_link call, save the link
1002 * count so we don't race
1004 savelink = inode->i_nlink;
1007 reiserfs_cut_from_item(&th, &path, &(de.de_entry_key), dir, NULL,
1013 inode->i_ctime = CURRENT_TIME_SEC;
1014 reiserfs_update_sd(&th, inode);
1016 dir->i_size -= (de.de_entrylen + DEH_SIZE);
1017 dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
1018 reiserfs_update_sd(&th, dir);
1021 /* prevent file from getting lost */
1022 add_save_link(&th, inode, 0 /* not truncate */ );
1024 retval = journal_end(&th, dir->i_sb, jbegin_count);
1025 reiserfs_check_path(&path);
1026 reiserfs_write_unlock(dir->i_sb);
1031 err = journal_end(&th, dir->i_sb, jbegin_count);
1032 reiserfs_check_path(&path);
1036 reiserfs_write_unlock(dir->i_sb);
1040 static int reiserfs_symlink(struct inode *parent_dir,
1041 struct dentry *dentry, const char *symname)
1044 struct inode *inode;
1047 struct reiserfs_transaction_handle th;
1048 int mode = S_IFLNK | S_IRWXUGO;
1049 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
1051 JOURNAL_PER_BALANCE_CNT * 3 +
1052 2 * (REISERFS_QUOTA_INIT_BLOCKS(parent_dir->i_sb) +
1053 REISERFS_QUOTA_TRANS_BLOCKS(parent_dir->i_sb));
1055 if (!(inode = new_inode(parent_dir->i_sb))) {
1058 new_inode_init(inode, parent_dir, mode);
1060 reiserfs_write_lock(parent_dir->i_sb);
1061 item_len = ROUND_UP(strlen(symname));
1062 if (item_len > MAX_DIRECT_ITEM_LEN(parent_dir->i_sb->s_blocksize)) {
1063 retval = -ENAMETOOLONG;
1064 drop_new_inode(inode);
1068 name = kmalloc(item_len, GFP_NOFS);
1070 drop_new_inode(inode);
1074 memcpy(name, symname, strlen(symname));
1075 padd_item(name, item_len, strlen(symname));
1077 /* We would inherit the default ACL here, but symlinks don't get ACLs */
1079 retval = journal_begin(&th, parent_dir->i_sb, jbegin_count);
1081 drop_new_inode(inode);
1087 reiserfs_new_inode(&th, parent_dir, mode, name, strlen(symname),
1090 if (retval) { /* reiserfs_new_inode iputs for us */
1094 reiserfs_update_inode_transaction(inode);
1095 reiserfs_update_inode_transaction(parent_dir);
1097 inode->i_op = &reiserfs_symlink_inode_operations;
1098 inode->i_mapping->a_ops = &reiserfs_address_space_operations;
1100 // must be sure this inode is written with this transaction
1102 //reiserfs_update_sd (&th, inode, READ_BLOCKS);
1104 retval = reiserfs_add_entry(&th, parent_dir, dentry->d_name.name,
1105 dentry->d_name.len, inode, 1 /*visible */ );
1109 reiserfs_update_sd(&th, inode);
1110 err = journal_end(&th, parent_dir->i_sb, jbegin_count);
1117 d_instantiate(dentry, inode);
1118 retval = journal_end(&th, parent_dir->i_sb, jbegin_count);
1120 reiserfs_write_unlock(parent_dir->i_sb);
1124 static int reiserfs_link(struct dentry *old_dentry, struct inode *dir,
1125 struct dentry *dentry)
1128 struct inode *inode = old_dentry->d_inode;
1129 struct reiserfs_transaction_handle th;
1130 /* We need blocks for transaction + update of quotas for the owners of the directory */
1132 JOURNAL_PER_BALANCE_CNT * 3 +
1133 2 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
1135 reiserfs_write_lock(dir->i_sb);
1136 if (inode->i_nlink >= REISERFS_LINK_MAX) {
1137 //FIXME: sd_nlink is 32 bit for new files
1138 reiserfs_write_unlock(dir->i_sb);
1141 if (inode->i_nlink == 0) {
1142 reiserfs_write_unlock(dir->i_sb);
1146 /* inc before scheduling so reiserfs_unlink knows we are here */
1149 retval = journal_begin(&th, dir->i_sb, jbegin_count);
1152 reiserfs_write_unlock(dir->i_sb);
1156 /* create new entry */
1158 reiserfs_add_entry(&th, dir, dentry->d_name.name,
1159 dentry->d_name.len, inode, 1 /*visible */ );
1161 reiserfs_update_inode_transaction(inode);
1162 reiserfs_update_inode_transaction(dir);
1167 err = journal_end(&th, dir->i_sb, jbegin_count);
1168 reiserfs_write_unlock(dir->i_sb);
1169 return err ? err : retval;
1172 inode->i_ctime = CURRENT_TIME_SEC;
1173 reiserfs_update_sd(&th, inode);
1175 atomic_inc(&inode->i_count);
1176 d_instantiate(dentry, inode);
1177 retval = journal_end(&th, dir->i_sb, jbegin_count);
1178 reiserfs_write_unlock(dir->i_sb);
1182 // de contains information pointing to an entry which
1183 static int de_still_valid(const char *name, int len,
1184 struct reiserfs_dir_entry *de)
1186 struct reiserfs_dir_entry tmp = *de;
1188 // recalculate pointer to name and name length
1189 set_de_name_and_namelen(&tmp);
1190 // FIXME: could check more
1191 if (tmp.de_namelen != len || memcmp(name, de->de_name, len))
1196 static int entry_points_to_object(const char *name, int len,
1197 struct reiserfs_dir_entry *de,
1198 struct inode *inode)
1200 if (!de_still_valid(name, len, de))
1204 if (!de_visible(de->de_deh + de->de_entry_num))
1205 reiserfs_panic(NULL,
1206 "vs-7042: entry_points_to_object: entry must be visible");
1207 return (de->de_objectid == inode->i_ino) ? 1 : 0;
1210 /* this must be added hidden entry */
1211 if (de_visible(de->de_deh + de->de_entry_num))
1212 reiserfs_panic(NULL,
1213 "vs-7043: entry_points_to_object: entry must be visible");
1218 /* sets key of objectid the entry has to point to */
1219 static void set_ino_in_dir_entry(struct reiserfs_dir_entry *de,
1220 struct reiserfs_key *key)
1222 /* JDM These operations are endian safe - both are le */
1223 de->de_deh[de->de_entry_num].deh_dir_id = key->k_dir_id;
1224 de->de_deh[de->de_entry_num].deh_objectid = key->k_objectid;
1228 * process, that is going to call fix_nodes/do_balance must hold only
1229 * one path. If it holds 2 or more, it can get into endless waiting in
1230 * get_empty_nodes or its clones
1232 static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1233 struct inode *new_dir, struct dentry *new_dentry)
1236 INITIALIZE_PATH(old_entry_path);
1237 INITIALIZE_PATH(new_entry_path);
1238 INITIALIZE_PATH(dot_dot_entry_path);
1239 struct item_head new_entry_ih, old_entry_ih, dot_dot_ih;
1240 struct reiserfs_dir_entry old_de, new_de, dot_dot_de;
1241 struct inode *old_inode, *new_dentry_inode;
1242 struct reiserfs_transaction_handle th;
1244 umode_t old_inode_mode;
1245 unsigned long savelink = 1;
1246 struct timespec ctime;
1248 /* three balancings: (1) old name removal, (2) new name insertion
1249 and (3) maybe "save" link insertion
1250 stat data updates: (1) old directory,
1251 (2) new directory and (3) maybe old object stat data (when it is
1252 directory) and (4) maybe stat data of object to which new entry
1253 pointed initially and (5) maybe block containing ".." of
1255 quota updates: two parent directories */
1257 JOURNAL_PER_BALANCE_CNT * 3 + 5 +
1258 4 * REISERFS_QUOTA_TRANS_BLOCKS(old_dir->i_sb);
1260 old_inode = old_dentry->d_inode;
1261 new_dentry_inode = new_dentry->d_inode;
1263 // make sure, that oldname still exists and points to an object we
1264 // are going to rename
1265 old_de.de_gen_number_bit_string = NULL;
1266 reiserfs_write_lock(old_dir->i_sb);
1268 reiserfs_find_entry(old_dir, old_dentry->d_name.name,
1269 old_dentry->d_name.len, &old_entry_path,
1271 pathrelse(&old_entry_path);
1272 if (retval == IO_ERROR) {
1273 reiserfs_write_unlock(old_dir->i_sb);
1277 if (retval != NAME_FOUND || old_de.de_objectid != old_inode->i_ino) {
1278 reiserfs_write_unlock(old_dir->i_sb);
1282 old_inode_mode = old_inode->i_mode;
1283 if (S_ISDIR(old_inode_mode)) {
1284 // make sure, that directory being renamed has correct ".."
1285 // and that its new parent directory has not too many links
1288 if (new_dentry_inode) {
1289 if (!reiserfs_empty_dir(new_dentry_inode)) {
1290 reiserfs_write_unlock(old_dir->i_sb);
1295 /* directory is renamed, its parent directory will be changed,
1296 ** so find ".." entry
1298 dot_dot_de.de_gen_number_bit_string = NULL;
1300 reiserfs_find_entry(old_inode, "..", 2, &dot_dot_entry_path,
1302 pathrelse(&dot_dot_entry_path);
1303 if (retval != NAME_FOUND) {
1304 reiserfs_write_unlock(old_dir->i_sb);
1308 /* inode number of .. must equal old_dir->i_ino */
1309 if (dot_dot_de.de_objectid != old_dir->i_ino) {
1310 reiserfs_write_unlock(old_dir->i_sb);
1315 retval = journal_begin(&th, old_dir->i_sb, jbegin_count);
1317 reiserfs_write_unlock(old_dir->i_sb);
1321 /* add new entry (or find the existing one) */
1323 reiserfs_add_entry(&th, new_dir, new_dentry->d_name.name,
1324 new_dentry->d_name.len, old_inode, 0);
1325 if (retval == -EEXIST) {
1326 if (!new_dentry_inode) {
1327 reiserfs_panic(old_dir->i_sb,
1328 "vs-7050: new entry is found, new inode == 0\n");
1330 } else if (retval) {
1331 int err = journal_end(&th, old_dir->i_sb, jbegin_count);
1332 reiserfs_write_unlock(old_dir->i_sb);
1333 return err ? err : retval;
1336 reiserfs_update_inode_transaction(old_dir);
1337 reiserfs_update_inode_transaction(new_dir);
1339 /* this makes it so an fsync on an open fd for the old name will
1340 ** commit the rename operation
1342 reiserfs_update_inode_transaction(old_inode);
1344 if (new_dentry_inode)
1345 reiserfs_update_inode_transaction(new_dentry_inode);
1348 // look for old name using corresponding entry key (found by reiserfs_find_entry)
1350 search_by_entry_key(new_dir->i_sb, &old_de.de_entry_key,
1352 &old_de)) != NAME_FOUND) {
1353 pathrelse(&old_entry_path);
1354 journal_end(&th, old_dir->i_sb, jbegin_count);
1355 reiserfs_write_unlock(old_dir->i_sb);
1359 copy_item_head(&old_entry_ih, get_ih(&old_entry_path));
1361 reiserfs_prepare_for_journal(old_inode->i_sb, old_de.de_bh, 1);
1363 // look for new name by reiserfs_find_entry
1364 new_de.de_gen_number_bit_string = NULL;
1366 reiserfs_find_entry(new_dir, new_dentry->d_name.name,
1367 new_dentry->d_name.len, &new_entry_path,
1369 // reiserfs_add_entry should not return IO_ERROR, because it is called with essentially same parameters from
1370 // reiserfs_add_entry above, and we'll catch any i/o errors before we get here.
1371 if (retval != NAME_FOUND_INVISIBLE && retval != NAME_FOUND) {
1372 pathrelse(&new_entry_path);
1373 pathrelse(&old_entry_path);
1374 journal_end(&th, old_dir->i_sb, jbegin_count);
1375 reiserfs_write_unlock(old_dir->i_sb);
1379 copy_item_head(&new_entry_ih, get_ih(&new_entry_path));
1381 reiserfs_prepare_for_journal(old_inode->i_sb, new_de.de_bh, 1);
1383 if (S_ISDIR(old_inode->i_mode)) {
1385 search_by_entry_key(new_dir->i_sb,
1386 &dot_dot_de.de_entry_key,
1387 &dot_dot_entry_path,
1388 &dot_dot_de)) != NAME_FOUND) {
1389 pathrelse(&dot_dot_entry_path);
1390 pathrelse(&new_entry_path);
1391 pathrelse(&old_entry_path);
1392 journal_end(&th, old_dir->i_sb, jbegin_count);
1393 reiserfs_write_unlock(old_dir->i_sb);
1396 copy_item_head(&dot_dot_ih,
1397 get_ih(&dot_dot_entry_path));
1398 // node containing ".." gets into transaction
1399 reiserfs_prepare_for_journal(old_inode->i_sb,
1400 dot_dot_de.de_bh, 1);
1402 /* we should check seals here, not do
1403 this stuff, yes? Then, having
1404 gathered everything into RAM we
1405 should lock the buffers, yes? -Hans */
1406 /* probably. our rename needs to hold more
1407 ** than one path at once. The seals would
1408 ** have to be written to deal with multi-path
1411 /* sanity checking before doing the rename - avoid races many
1412 ** of the above checks could have scheduled. We have to be
1413 ** sure our items haven't been shifted by another process.
1415 if (item_moved(&new_entry_ih, &new_entry_path) ||
1416 !entry_points_to_object(new_dentry->d_name.name,
1417 new_dentry->d_name.len,
1418 &new_de, new_dentry_inode) ||
1419 item_moved(&old_entry_ih, &old_entry_path) ||
1420 !entry_points_to_object(old_dentry->d_name.name,
1421 old_dentry->d_name.len,
1422 &old_de, old_inode)) {
1423 reiserfs_restore_prepared_buffer(old_inode->i_sb,
1425 reiserfs_restore_prepared_buffer(old_inode->i_sb,
1427 if (S_ISDIR(old_inode_mode))
1428 reiserfs_restore_prepared_buffer(old_inode->
1434 if (S_ISDIR(old_inode_mode)) {
1435 if (item_moved(&dot_dot_ih, &dot_dot_entry_path) ||
1436 !entry_points_to_object("..", 2, &dot_dot_de,
1438 reiserfs_restore_prepared_buffer(old_inode->
1441 reiserfs_restore_prepared_buffer(old_inode->
1444 reiserfs_restore_prepared_buffer(old_inode->
1452 RFALSE(S_ISDIR(old_inode_mode) &&
1453 !buffer_journal_prepared(dot_dot_de.de_bh), "");
1458 /* ok, all the changes can be done in one fell swoop when we
1459 have claimed all the buffers needed. */
1461 mark_de_visible(new_de.de_deh + new_de.de_entry_num);
1462 set_ino_in_dir_entry(&new_de, INODE_PKEY(old_inode));
1463 journal_mark_dirty(&th, old_dir->i_sb, new_de.de_bh);
1465 mark_de_hidden(old_de.de_deh + old_de.de_entry_num);
1466 journal_mark_dirty(&th, old_dir->i_sb, old_de.de_bh);
1467 ctime = CURRENT_TIME_SEC;
1468 old_dir->i_ctime = old_dir->i_mtime = ctime;
1469 new_dir->i_ctime = new_dir->i_mtime = ctime;
1470 /* thanks to Alex Adriaanse <alex_a@caltech.edu> for patch which adds ctime update of
1472 old_inode->i_ctime = ctime;
1474 if (new_dentry_inode) {
1475 // adjust link number of the victim
1476 if (S_ISDIR(new_dentry_inode->i_mode)) {
1477 new_dentry_inode->i_nlink = 0;
1479 new_dentry_inode->i_nlink--;
1481 new_dentry_inode->i_ctime = ctime;
1482 savelink = new_dentry_inode->i_nlink;
1485 if (S_ISDIR(old_inode_mode)) {
1486 // adjust ".." of renamed directory
1487 set_ino_in_dir_entry(&dot_dot_de, INODE_PKEY(new_dir));
1488 journal_mark_dirty(&th, new_dir->i_sb, dot_dot_de.de_bh);
1490 if (!new_dentry_inode)
1491 /* there (in new_dir) was no directory, so it got new link
1492 (".." of renamed directory) */
1493 INC_DIR_INODE_NLINK(new_dir);
1495 /* old directory lost one link - ".. " of renamed directory */
1496 DEC_DIR_INODE_NLINK(old_dir);
1498 // looks like in 2.3.99pre3 brelse is atomic. so we can use pathrelse
1499 pathrelse(&new_entry_path);
1500 pathrelse(&dot_dot_entry_path);
1502 // FIXME: this reiserfs_cut_from_item's return value may screw up
1503 // anybody, but it will panic if will not be able to find the
1504 // entry. This needs one more clean up
1505 if (reiserfs_cut_from_item
1506 (&th, &old_entry_path, &(old_de.de_entry_key), old_dir, NULL,
1508 reiserfs_warning(old_dir->i_sb,
1509 "vs-7060: reiserfs_rename: couldn't not cut old name. Fsck later?");
1511 old_dir->i_size -= DEH_SIZE + old_de.de_entrylen;
1513 reiserfs_update_sd(&th, old_dir);
1514 reiserfs_update_sd(&th, new_dir);
1515 reiserfs_update_sd(&th, old_inode);
1517 if (new_dentry_inode) {
1519 add_save_link(&th, new_dentry_inode,
1520 0 /* not truncate */ );
1521 reiserfs_update_sd(&th, new_dentry_inode);
1524 retval = journal_end(&th, old_dir->i_sb, jbegin_count);
1525 reiserfs_write_unlock(old_dir->i_sb);
1530 * directories can handle most operations...
1532 struct inode_operations reiserfs_dir_inode_operations = {
1533 //&reiserfs_dir_operations, /* default_file_ops */
1534 .create = reiserfs_create,
1535 .lookup = reiserfs_lookup,
1536 .link = reiserfs_link,
1537 .unlink = reiserfs_unlink,
1538 .symlink = reiserfs_symlink,
1539 .mkdir = reiserfs_mkdir,
1540 .rmdir = reiserfs_rmdir,
1541 .mknod = reiserfs_mknod,
1542 .rename = reiserfs_rename,
1543 .setattr = reiserfs_setattr,
1544 .setxattr = reiserfs_setxattr,
1545 .getxattr = reiserfs_getxattr,
1546 .listxattr = reiserfs_listxattr,
1547 .removexattr = reiserfs_removexattr,
1548 .permission = reiserfs_permission,
1552 * symlink operations.. same as page_symlink_inode_operations, with xattr
1555 struct inode_operations reiserfs_symlink_inode_operations = {
1556 .readlink = generic_readlink,
1557 .follow_link = page_follow_link_light,
1558 .put_link = page_put_link,
1559 .setattr = reiserfs_setattr,
1560 .setxattr = reiserfs_setxattr,
1561 .getxattr = reiserfs_getxattr,
1562 .listxattr = reiserfs_listxattr,
1563 .removexattr = reiserfs_removexattr,
1564 .permission = reiserfs_permission,
1569 * special file operations.. just xattr/acl stuff
1571 struct inode_operations reiserfs_special_inode_operations = {
1572 .setattr = reiserfs_setattr,
1573 .setxattr = reiserfs_setxattr,
1574 .getxattr = reiserfs_getxattr,
1575 .listxattr = reiserfs_listxattr,
1576 .removexattr = reiserfs_removexattr,
1577 .permission = reiserfs_permission,