aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/namei.c
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2014-04-23 10:00:36 -0400
committerJan Kara <jack@suse.cz>2014-05-06 16:52:19 -0400
commit098297b27d23ad9d0fc302e3417474d9342c6c14 (patch)
tree58f2054cd9933225ef1ae9c7febedc9160041af6 /fs/reiserfs/namei.c
parent4cf5f7addf18ecae2ea49b11944976cbd26d5281 (diff)
reiserfs: cleanup, reformat comments to normal kernel style
This patch reformats comments in the reiserfs code to fit in 80 columns and to follow the style rules. There is no functional change but it helps make my eyes bleed less. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/reiserfs/namei.c')
-rw-r--r--fs/reiserfs/namei.c420
1 files changed, 261 insertions, 159 deletions
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index 1ce8fbea4749..6bc38de8357f 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -22,8 +22,10 @@
22#define INC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) { inc_nlink(i); if (i->i_nlink >= REISERFS_LINK_MAX) set_nlink(i, 1); } 22#define INC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) { inc_nlink(i); if (i->i_nlink >= REISERFS_LINK_MAX) set_nlink(i, 1); }
23#define DEC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) drop_nlink(i); 23#define DEC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) drop_nlink(i);
24 24
25// directory item contains array of entry headers. This performs 25/*
26// binary search through that array 26 * directory item contains array of entry headers. This performs
27 * binary search through that array
28 */
27static int bin_search_in_dir_item(struct reiserfs_dir_entry *de, loff_t off) 29static int bin_search_in_dir_item(struct reiserfs_dir_entry *de, loff_t off)
28{ 30{
29 struct item_head *ih = de->de_ih; 31 struct item_head *ih = de->de_ih;
@@ -43,7 +45,7 @@ static int bin_search_in_dir_item(struct reiserfs_dir_entry *de, loff_t off)
43 lbound = j + 1; 45 lbound = j + 1;
44 continue; 46 continue;
45 } 47 }
46 // this is not name found, but matched third key component 48 /* this is not name found, but matched third key component */
47 de->de_entry_num = j; 49 de->de_entry_num = j;
48 return NAME_FOUND; 50 return NAME_FOUND;
49 } 51 }
@@ -52,7 +54,9 @@ static int bin_search_in_dir_item(struct reiserfs_dir_entry *de, loff_t off)
52 return NAME_NOT_FOUND; 54 return NAME_NOT_FOUND;
53} 55}
54 56
55// comment? maybe something like set de to point to what the path points to? 57/*
58 * comment? maybe something like set de to point to what the path points to?
59 */
56static inline void set_de_item_location(struct reiserfs_dir_entry *de, 60static inline void set_de_item_location(struct reiserfs_dir_entry *de,
57 struct treepath *path) 61 struct treepath *path)
58{ 62{
@@ -62,7 +66,9 @@ static inline void set_de_item_location(struct reiserfs_dir_entry *de,
62 de->de_item_num = PATH_LAST_POSITION(path); 66 de->de_item_num = PATH_LAST_POSITION(path);
63} 67}
64 68
65// de_bh, de_ih, de_deh (points to first element of array), de_item_num is set 69/*
70 * de_bh, de_ih, de_deh (points to first element of array), de_item_num is set
71 */
66inline void set_de_name_and_namelen(struct reiserfs_dir_entry *de) 72inline void set_de_name_and_namelen(struct reiserfs_dir_entry *de)
67{ 73{
68 struct reiserfs_de_head *deh = de->de_deh + de->de_entry_num; 74 struct reiserfs_de_head *deh = de->de_deh + de->de_entry_num;
@@ -76,7 +82,7 @@ inline void set_de_name_and_namelen(struct reiserfs_dir_entry *de)
76 de->de_namelen = strlen(de->de_name); 82 de->de_namelen = strlen(de->de_name);
77} 83}
78 84
79// what entry points to 85/* what entry points to */
80static inline void set_de_object_key(struct reiserfs_dir_entry *de) 86static inline void set_de_object_key(struct reiserfs_dir_entry *de)
81{ 87{
82 BUG_ON(de->de_entry_num >= ih_entry_count(de->de_ih)); 88 BUG_ON(de->de_entry_num >= ih_entry_count(de->de_ih));
@@ -100,17 +106,16 @@ static inline void store_de_entry_key(struct reiserfs_dir_entry *de)
100 set_cpu_key_k_type(&(de->de_entry_key), TYPE_DIRENTRY); 106 set_cpu_key_k_type(&(de->de_entry_key), TYPE_DIRENTRY);
101} 107}
102 108
103/* We assign a key to each directory item, and place multiple entries 109/*
104in a single directory item. A directory item has a key equal to the 110 * We assign a key to each directory item, and place multiple entries in a
105key of the first directory entry in it. 111 * single directory item. A directory item has a key equal to the key of
106 112 * the first directory entry in it.
107This function first calls search_by_key, then, if item whose first 113
108entry matches is not found it looks for the entry inside directory 114 * This function first calls search_by_key, then, if item whose first entry
109item found by search_by_key. Fills the path to the entry, and to the 115 * matches is not found it looks for the entry inside directory item found
110entry position in the item 116 * by search_by_key. Fills the path to the entry, and to the entry position
111 117 * in the item
112*/ 118 */
113
114/* The function is NOT SCHEDULE-SAFE! */ 119/* The function is NOT SCHEDULE-SAFE! */
115int search_by_entry_key(struct super_block *sb, const struct cpu_key *key, 120int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,
116 struct treepath *path, struct reiserfs_dir_entry *de) 121 struct treepath *path, struct reiserfs_dir_entry *de)
@@ -152,12 +157,17 @@ int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,
152 } 157 }
153#endif /* CONFIG_REISERFS_CHECK */ 158#endif /* CONFIG_REISERFS_CHECK */
154 159
155 /* binary search in directory item by third componen t of the 160 /*
156 key. sets de->de_entry_num of de */ 161 * binary search in directory item by third component of the
162 * key. sets de->de_entry_num of de
163 */
157 retval = bin_search_in_dir_item(de, cpu_key_k_offset(key)); 164 retval = bin_search_in_dir_item(de, cpu_key_k_offset(key));
158 path->pos_in_item = de->de_entry_num; 165 path->pos_in_item = de->de_entry_num;
159 if (retval != NAME_NOT_FOUND) { 166 if (retval != NAME_NOT_FOUND) {
160 // ugly, but rename needs de_bh, de_deh, de_name, de_namelen, de_objectid set 167 /*
168 * ugly, but rename needs de_bh, de_deh, de_name,
169 * de_namelen, de_objectid set
170 */
161 set_de_name_and_namelen(de); 171 set_de_name_and_namelen(de);
162 set_de_object_key(de); 172 set_de_object_key(de);
163 } 173 }
@@ -166,11 +176,12 @@ int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,
166 176
167/* Keyed 32-bit hash function using TEA in a Davis-Meyer function */ 177/* Keyed 32-bit hash function using TEA in a Davis-Meyer function */
168 178
169/* The third component is hashed, and you can choose from more than 179/*
170 one hash function. Per directory hashes are not yet implemented 180 * The third component is hashed, and you can choose from more than
171 but are thought about. This function should be moved to hashes.c 181 * one hash function. Per directory hashes are not yet implemented
172 Jedi, please do so. -Hans */ 182 * but are thought about. This function should be moved to hashes.c
173 183 * Jedi, please do so. -Hans
184 */
174static __u32 get_third_component(struct super_block *s, 185static __u32 get_third_component(struct super_block *s,
175 const char *name, int len) 186 const char *name, int len)
176{ 187{
@@ -183,11 +194,13 @@ static __u32 get_third_component(struct super_block *s,
183 194
184 res = REISERFS_SB(s)->s_hash_function(name, len); 195 res = REISERFS_SB(s)->s_hash_function(name, len);
185 196
186 // take bits from 7-th to 30-th including both bounds 197 /* take bits from 7-th to 30-th including both bounds */
187 res = GET_HASH_VALUE(res); 198 res = GET_HASH_VALUE(res);
188 if (res == 0) 199 if (res == 0)
189 // needed to have no names before "." and ".." those have hash 200 /*
190 // value == 0 and generation conters 1 and 2 accordingly 201 * needed to have no names before "." and ".." those have hash
202 * value == 0 and generation conters 1 and 2 accordingly
203 */
191 res = 128; 204 res = 128;
192 return res + MAX_GENERATION_NUMBER; 205 return res + MAX_GENERATION_NUMBER;
193} 206}
@@ -208,7 +221,7 @@ static int reiserfs_match(struct reiserfs_dir_entry *de,
208 221
209/* de's de_bh, de_ih, de_deh, de_item_num, de_entry_num are set already */ 222/* de's de_bh, de_ih, de_deh, de_item_num, de_entry_num are set already */
210 223
211 /* used when hash collisions exist */ 224/* used when hash collisions exist */
212 225
213static int linear_search_in_dir_item(struct cpu_key *key, 226static int linear_search_in_dir_item(struct cpu_key *key,
214 struct reiserfs_dir_entry *de, 227 struct reiserfs_dir_entry *de,
@@ -232,43 +245,50 @@ static int linear_search_in_dir_item(struct cpu_key *key,
232 deh += i; 245 deh += i;
233 246
234 for (; i >= 0; i--, deh--) { 247 for (; i >= 0; i--, deh--) {
248 /* hash value does not match, no need to check whole name */
235 if (GET_HASH_VALUE(deh_offset(deh)) != 249 if (GET_HASH_VALUE(deh_offset(deh)) !=
236 GET_HASH_VALUE(cpu_key_k_offset(key))) { 250 GET_HASH_VALUE(cpu_key_k_offset(key))) {
237 // hash value does not match, no need to check whole name
238 return NAME_NOT_FOUND; 251 return NAME_NOT_FOUND;
239 } 252 }
240 253
241 /* mark, that this generation number is used */ 254 /* mark that this generation number is used */
242 if (de->de_gen_number_bit_string) 255 if (de->de_gen_number_bit_string)
243 set_bit(GET_GENERATION_NUMBER(deh_offset(deh)), 256 set_bit(GET_GENERATION_NUMBER(deh_offset(deh)),
244 de->de_gen_number_bit_string); 257 de->de_gen_number_bit_string);
245 258
246 // calculate pointer to name and namelen 259 /* calculate pointer to name and namelen */
247 de->de_entry_num = i; 260 de->de_entry_num = i;
248 set_de_name_and_namelen(de); 261 set_de_name_and_namelen(de);
249 262
263 /*
264 * de's de_name, de_namelen, de_recordlen are set.
265 * Fill the rest.
266 */
250 if ((retval = 267 if ((retval =
251 reiserfs_match(de, name, namelen)) != NAME_NOT_FOUND) { 268 reiserfs_match(de, name, namelen)) != NAME_NOT_FOUND) {
252 // de's de_name, de_namelen, de_recordlen are set. Fill the rest:
253 269
254 // key of pointed object 270 /* key of pointed object */
255 set_de_object_key(de); 271 set_de_object_key(de);
256 272
257 store_de_entry_key(de); 273 store_de_entry_key(de);
258 274
259 // retval can be NAME_FOUND or NAME_FOUND_INVISIBLE 275 /* retval can be NAME_FOUND or NAME_FOUND_INVISIBLE */
260 return retval; 276 return retval;
261 } 277 }
262 } 278 }
263 279
264 if (GET_GENERATION_NUMBER(le_ih_k_offset(de->de_ih)) == 0) 280 if (GET_GENERATION_NUMBER(le_ih_k_offset(de->de_ih)) == 0)
265 /* we have reached left most entry in the node. In common we 281 /*
266 have to go to the left neighbor, but if generation counter 282 * we have reached left most entry in the node. In common we
267 is 0 already, we know for sure, that there is no name with 283 * have to go to the left neighbor, but if generation counter
268 the same hash value */ 284 * is 0 already, we know for sure, that there is no name with
269 // FIXME: this work correctly only because hash value can not 285 * the same hash value
270 // be 0. Btw, in case of Yura's hash it is probably possible, 286 */
271 // so, this is a bug 287 /*
288 * FIXME: this work correctly only because hash value can not
289 * be 0. Btw, in case of Yura's hash it is probably possible,
290 * so, this is a bug
291 */
272 return NAME_NOT_FOUND; 292 return NAME_NOT_FOUND;
273 293
274 RFALSE(de->de_item_num, 294 RFALSE(de->de_item_num,
@@ -277,8 +297,10 @@ static int linear_search_in_dir_item(struct cpu_key *key,
277 return GOTO_PREVIOUS_ITEM; 297 return GOTO_PREVIOUS_ITEM;
278} 298}
279 299
280// may return NAME_FOUND, NAME_FOUND_INVISIBLE, NAME_NOT_FOUND 300/*
281// FIXME: should add something like IOERROR 301 * may return NAME_FOUND, NAME_FOUND_INVISIBLE, NAME_NOT_FOUND
302 * FIXME: should add something like IOERROR
303 */
282static int reiserfs_find_entry(struct inode *dir, const char *name, int namelen, 304static int reiserfs_find_entry(struct inode *dir, const char *name, int namelen,
283 struct treepath *path_to_entry, 305 struct treepath *path_to_entry,
284 struct reiserfs_dir_entry *de) 306 struct reiserfs_dir_entry *de)
@@ -307,13 +329,19 @@ static int reiserfs_find_entry(struct inode *dir, const char *name, int namelen,
307 retval = 329 retval =
308 linear_search_in_dir_item(&key_to_search, de, name, 330 linear_search_in_dir_item(&key_to_search, de, name,
309 namelen); 331 namelen);
332 /*
333 * there is no need to scan directory anymore.
334 * Given entry found or does not exist
335 */
310 if (retval != GOTO_PREVIOUS_ITEM) { 336 if (retval != GOTO_PREVIOUS_ITEM) {
311 /* there is no need to scan directory anymore. Given entry found or does not exist */
312 path_to_entry->pos_in_item = de->de_entry_num; 337 path_to_entry->pos_in_item = de->de_entry_num;
313 return retval; 338 return retval;
314 } 339 }
315 340
316 /* there is left neighboring item of this directory and given entry can be there */ 341 /*
342 * there is left neighboring item of this directory
343 * and given entry can be there
344 */
317 set_cpu_key_k_offset(&key_to_search, 345 set_cpu_key_k_offset(&key_to_search,
318 le_ih_k_offset(de->de_ih) - 1); 346 le_ih_k_offset(de->de_ih) - 1);
319 pathrelse(path_to_entry); 347 pathrelse(path_to_entry);
@@ -347,8 +375,10 @@ static struct dentry *reiserfs_lookup(struct inode *dir, struct dentry *dentry,
347 return ERR_PTR(-EACCES); 375 return ERR_PTR(-EACCES);
348 } 376 }
349 377
350 /* Propagate the private flag so we know we're 378 /*
351 * in the priv tree */ 379 * Propagate the private flag so we know we're
380 * in the priv tree
381 */
352 if (IS_PRIVATE(dir)) 382 if (IS_PRIVATE(dir))
353 inode->i_flags |= S_PRIVATE; 383 inode->i_flags |= S_PRIVATE;
354 } 384 }
@@ -361,9 +391,9 @@ static struct dentry *reiserfs_lookup(struct inode *dir, struct dentry *dentry,
361} 391}
362 392
363/* 393/*
364** looks up the dentry of the parent directory for child. 394 * looks up the dentry of the parent directory for child.
365** taken from ext2_get_parent 395 * taken from ext2_get_parent
366*/ 396 */
367struct dentry *reiserfs_get_parent(struct dentry *child) 397struct dentry *reiserfs_get_parent(struct dentry *child)
368{ 398{
369 int retval; 399 int retval;
@@ -406,8 +436,13 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
406 struct reiserfs_dir_entry de; 436 struct reiserfs_dir_entry de;
407 DECLARE_BITMAP(bit_string, MAX_GENERATION_NUMBER + 1); 437 DECLARE_BITMAP(bit_string, MAX_GENERATION_NUMBER + 1);
408 int gen_number; 438 int gen_number;
409 char small_buf[32 + DEH_SIZE]; /* 48 bytes now and we avoid kmalloc 439
410 if we create file with short name */ 440 /*
441 * 48 bytes now and we avoid kmalloc if we
442 * create file with short name
443 */
444 char small_buf[32 + DEH_SIZE];
445
411 char *buffer; 446 char *buffer;
412 int buflen, paste_size; 447 int buflen, paste_size;
413 int retval; 448 int retval;
@@ -439,21 +474,30 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
439 (get_inode_sd_version(dir) == 474 (get_inode_sd_version(dir) ==
440 STAT_DATA_V1) ? (DEH_SIZE + namelen) : buflen; 475 STAT_DATA_V1) ? (DEH_SIZE + namelen) : buflen;
441 476
442 /* fill buffer : directory entry head, name[, dir objectid | , stat data | ,stat data, dir objectid ] */ 477 /*
478 * fill buffer : directory entry head, name[, dir objectid | ,
479 * stat data | ,stat data, dir objectid ]
480 */
443 deh = (struct reiserfs_de_head *)buffer; 481 deh = (struct reiserfs_de_head *)buffer;
444 deh->deh_location = 0; /* JDM Endian safe if 0 */ 482 deh->deh_location = 0; /* JDM Endian safe if 0 */
445 put_deh_offset(deh, cpu_key_k_offset(&entry_key)); 483 put_deh_offset(deh, cpu_key_k_offset(&entry_key));
446 deh->deh_state = 0; /* JDM Endian safe if 0 */ 484 deh->deh_state = 0; /* JDM Endian safe if 0 */
447 /* put key (ino analog) to de */ 485 /* put key (ino analog) to de */
448 deh->deh_dir_id = INODE_PKEY(inode)->k_dir_id; /* safe: k_dir_id is le */ 486
449 deh->deh_objectid = INODE_PKEY(inode)->k_objectid; /* safe: k_objectid is le */ 487 /* safe: k_dir_id is le */
488 deh->deh_dir_id = INODE_PKEY(inode)->k_dir_id;
489 /* safe: k_objectid is le */
490 deh->deh_objectid = INODE_PKEY(inode)->k_objectid;
450 491
451 /* copy name */ 492 /* copy name */
452 memcpy((char *)(deh + 1), name, namelen); 493 memcpy((char *)(deh + 1), name, namelen);
453 /* padd by 0s to the 4 byte boundary */ 494 /* padd by 0s to the 4 byte boundary */
454 padd_item((char *)(deh + 1), ROUND_UP(namelen), namelen); 495 padd_item((char *)(deh + 1), ROUND_UP(namelen), namelen);
455 496
456 /* entry is ready to be pasted into tree, set 'visibility' and 'stat data in entry' attributes */ 497 /*
498 * entry is ready to be pasted into tree, set 'visibility'
499 * and 'stat data in entry' attributes
500 */
457 mark_de_without_sd(deh); 501 mark_de_without_sd(deh);
458 visible ? mark_de_visible(deh) : mark_de_hidden(deh); 502 visible ? mark_de_visible(deh) : mark_de_hidden(deh);
459 503
@@ -499,7 +543,8 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
499 /* update max-hash-collisions counter in reiserfs_sb_info */ 543 /* update max-hash-collisions counter in reiserfs_sb_info */
500 PROC_INFO_MAX(th->t_super, max_hash_collisions, gen_number); 544 PROC_INFO_MAX(th->t_super, max_hash_collisions, gen_number);
501 545
502 if (gen_number != 0) { /* we need to re-search for the insertion point */ 546 /* we need to re-search for the insertion point */
547 if (gen_number != 0) {
503 if (search_by_entry_key(dir->i_sb, &entry_key, &path, &de) != 548 if (search_by_entry_key(dir->i_sb, &entry_key, &path, &de) !=
504 NAME_NOT_FOUND) { 549 NAME_NOT_FOUND) {
505 reiserfs_warning(dir->i_sb, "vs-7032", 550 reiserfs_warning(dir->i_sb, "vs-7032",
@@ -527,18 +572,19 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
527 dir->i_size += paste_size; 572 dir->i_size += paste_size;
528 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; 573 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
529 if (!S_ISDIR(inode->i_mode) && visible) 574 if (!S_ISDIR(inode->i_mode) && visible)
530 // reiserfs_mkdir or reiserfs_rename will do that by itself 575 /* reiserfs_mkdir or reiserfs_rename will do that by itself */
531 reiserfs_update_sd(th, dir); 576 reiserfs_update_sd(th, dir);
532 577
533 reiserfs_check_path(&path); 578 reiserfs_check_path(&path);
534 return 0; 579 return 0;
535} 580}
536 581
537/* quota utility function, call if you've had to abort after calling 582/*
538** new_inode_init, and have not called reiserfs_new_inode yet. 583 * quota utility function, call if you've had to abort after calling
539** This should only be called on inodes that do not have stat data 584 * new_inode_init, and have not called reiserfs_new_inode yet.
540** inserted into the tree yet. 585 * This should only be called on inodes that do not have stat data
541*/ 586 * inserted into the tree yet.
587 */
542static int drop_new_inode(struct inode *inode) 588static int drop_new_inode(struct inode *inode)
543{ 589{
544 dquot_drop(inode); 590 dquot_drop(inode);
@@ -548,18 +594,23 @@ static int drop_new_inode(struct inode *inode)
548 return 0; 594 return 0;
549} 595}
550 596
551/* utility function that does setup for reiserfs_new_inode. 597/*
552** dquot_initialize needs lots of credits so it's better to have it 598 * utility function that does setup for reiserfs_new_inode.
553** outside of a transaction, so we had to pull some bits of 599 * dquot_initialize needs lots of credits so it's better to have it
554** reiserfs_new_inode out into this func. 600 * outside of a transaction, so we had to pull some bits of
555*/ 601 * reiserfs_new_inode out into this func.
602 */
556static int new_inode_init(struct inode *inode, struct inode *dir, umode_t mode) 603static int new_inode_init(struct inode *inode, struct inode *dir, umode_t mode)
557{ 604{
558 /* Make inode invalid - just in case we are going to drop it before 605 /*
559 * the initialization happens */ 606 * Make inode invalid - just in case we are going to drop it before
607 * the initialization happens
608 */
560 INODE_PKEY(inode)->k_objectid = 0; 609 INODE_PKEY(inode)->k_objectid = 0;
561 /* the quota init calls have to know who to charge the quota to, so 610
562 ** we have to set uid and gid here 611 /*
612 * the quota init calls have to know who to charge the quota to, so
613 * we have to set uid and gid here
563 */ 614 */
564 inode_init_owner(inode, dir, mode); 615 inode_init_owner(inode, dir, mode);
565 dquot_initialize(inode); 616 dquot_initialize(inode);
@@ -571,7 +622,10 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, umode_t mod
571{ 622{
572 int retval; 623 int retval;
573 struct inode *inode; 624 struct inode *inode;
574 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */ 625 /*
626 * We need blocks for transaction + (user+group)*(quotas
627 * for new inode + update of quota for directory owner)
628 */
575 int jbegin_count = 629 int jbegin_count =
576 JOURNAL_PER_BALANCE_CNT * 2 + 630 JOURNAL_PER_BALANCE_CNT * 2 +
577 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + 631 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
@@ -644,7 +698,10 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode
644 struct inode *inode; 698 struct inode *inode;
645 struct reiserfs_transaction_handle th; 699 struct reiserfs_transaction_handle th;
646 struct reiserfs_security_handle security; 700 struct reiserfs_security_handle security;
647 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */ 701 /*
702 * We need blocks for transaction + (user+group)*(quotas
703 * for new inode + update of quota for directory owner)
704 */
648 int jbegin_count = 705 int jbegin_count =
649 JOURNAL_PER_BALANCE_CNT * 3 + 706 JOURNAL_PER_BALANCE_CNT * 3 +
650 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + 707 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
@@ -685,7 +742,7 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode
685 inode->i_op = &reiserfs_special_inode_operations; 742 inode->i_op = &reiserfs_special_inode_operations;
686 init_special_inode(inode, inode->i_mode, rdev); 743 init_special_inode(inode, inode->i_mode, rdev);
687 744
688 //FIXME: needed for block and char devices only 745 /* FIXME: needed for block and char devices only */
689 reiserfs_update_sd(&th, inode); 746 reiserfs_update_sd(&th, inode);
690 747
691 reiserfs_update_inode_transaction(inode); 748 reiserfs_update_inode_transaction(inode);
@@ -721,7 +778,10 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
721 struct inode *inode; 778 struct inode *inode;
722 struct reiserfs_transaction_handle th; 779 struct reiserfs_transaction_handle th;
723 struct reiserfs_security_handle security; 780 struct reiserfs_security_handle security;
724 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */ 781 /*
782 * We need blocks for transaction + (user+group)*(quotas
783 * for new inode + update of quota for directory owner)
784 */
725 int jbegin_count = 785 int jbegin_count =
726 JOURNAL_PER_BALANCE_CNT * 3 + 786 JOURNAL_PER_BALANCE_CNT * 3 +
727 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + 787 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
@@ -730,7 +790,10 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
730 dquot_initialize(dir); 790 dquot_initialize(dir);
731 791
732#ifdef DISPLACE_NEW_PACKING_LOCALITIES 792#ifdef DISPLACE_NEW_PACKING_LOCALITIES
733 /* set flag that new packing locality created and new blocks for the content * of that directory are not displaced yet */ 793 /*
794 * set flag that new packing locality created and new blocks
795 * for the content of that directory are not displaced yet
796 */
734 REISERFS_I(dir)->new_packing_locality = 1; 797 REISERFS_I(dir)->new_packing_locality = 1;
735#endif 798#endif
736 mode = S_IFDIR | mode; 799 mode = S_IFDIR | mode;
@@ -754,8 +817,9 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
754 goto out_failed; 817 goto out_failed;
755 } 818 }
756 819
757 /* inc the link count now, so another writer doesn't overflow it while 820 /*
758 ** we sleep later on. 821 * inc the link count now, so another writer doesn't overflow
822 * it while we sleep later on.
759 */ 823 */
760 INC_DIR_INODE_NLINK(dir) 824 INC_DIR_INODE_NLINK(dir)
761 825
@@ -774,7 +838,7 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
774 inode->i_op = &reiserfs_dir_inode_operations; 838 inode->i_op = &reiserfs_dir_inode_operations;
775 inode->i_fop = &reiserfs_dir_operations; 839 inode->i_fop = &reiserfs_dir_operations;
776 840
777 // note, _this_ add_entry will not update dir's stat data 841 /* note, _this_ add_entry will not update dir's stat data */
778 retval = 842 retval =
779 reiserfs_add_entry(&th, dir, dentry->d_name.name, 843 reiserfs_add_entry(&th, dir, dentry->d_name.name,
780 dentry->d_name.len, inode, 1 /*visible */ ); 844 dentry->d_name.len, inode, 1 /*visible */ );
@@ -790,7 +854,7 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
790 iput(inode); 854 iput(inode);
791 goto out_failed; 855 goto out_failed;
792 } 856 }
793 // the above add_entry did not update dir's stat data 857 /* the above add_entry did not update dir's stat data */
794 reiserfs_update_sd(&th, dir); 858 reiserfs_update_sd(&th, dir);
795 859
796 unlock_new_inode(inode); 860 unlock_new_inode(inode);
@@ -803,10 +867,11 @@ out_failed:
803 867
804static inline int reiserfs_empty_dir(struct inode *inode) 868static inline int reiserfs_empty_dir(struct inode *inode)
805{ 869{
806 /* we can cheat because an old format dir cannot have 870 /*
807 ** EMPTY_DIR_SIZE, and a new format dir cannot have 871 * we can cheat because an old format dir cannot have
808 ** EMPTY_DIR_SIZE_V1. So, if the inode is either size, 872 * EMPTY_DIR_SIZE, and a new format dir cannot have
809 ** regardless of disk format version, the directory is empty. 873 * EMPTY_DIR_SIZE_V1. So, if the inode is either size,
874 * regardless of disk format version, the directory is empty.
810 */ 875 */
811 if (inode->i_size != EMPTY_DIR_SIZE && 876 if (inode->i_size != EMPTY_DIR_SIZE &&
812 inode->i_size != EMPTY_DIR_SIZE_V1) { 877 inode->i_size != EMPTY_DIR_SIZE_V1) {
@@ -824,10 +889,12 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry)
824 INITIALIZE_PATH(path); 889 INITIALIZE_PATH(path);
825 struct reiserfs_dir_entry de; 890 struct reiserfs_dir_entry de;
826 891
827 /* we will be doing 2 balancings and update 2 stat data, we change quotas 892 /*
828 * of the owner of the directory and of the owner of the parent directory. 893 * we will be doing 2 balancings and update 2 stat data, we
829 * The quota structure is possibly deleted only on last iput => outside 894 * change quotas of the owner of the directory and of the owner
830 * of this transaction */ 895 * of the parent directory. The quota structure is possibly
896 * deleted only on last iput => outside of this transaction
897 */
831 jbegin_count = 898 jbegin_count =
832 JOURNAL_PER_BALANCE_CNT * 2 + 2 + 899 JOURNAL_PER_BALANCE_CNT * 2 + 2 +
833 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); 900 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
@@ -856,8 +923,9 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry)
856 reiserfs_update_inode_transaction(dir); 923 reiserfs_update_inode_transaction(dir);
857 924
858 if (de.de_objectid != inode->i_ino) { 925 if (de.de_objectid != inode->i_ino) {
859 // FIXME: compare key of an object and a key found in the 926 /*
860 // entry 927 * FIXME: compare key of an object and a key found in the entry
928 */
861 retval = -EIO; 929 retval = -EIO;
862 goto end_rmdir; 930 goto end_rmdir;
863 } 931 }
@@ -895,9 +963,11 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry)
895 return retval; 963 return retval;
896 964
897 end_rmdir: 965 end_rmdir:
898 /* we must release path, because we did not call 966 /*
899 reiserfs_cut_from_item, or reiserfs_cut_from_item does not 967 * we must release path, because we did not call
900 release path if operation was not complete */ 968 * reiserfs_cut_from_item, or reiserfs_cut_from_item does not
969 * release path if operation was not complete
970 */
901 pathrelse(&path); 971 pathrelse(&path);
902 err = journal_end(&th, dir->i_sb, jbegin_count); 972 err = journal_end(&th, dir->i_sb, jbegin_count);
903 reiserfs_write_unlock(dir->i_sb); 973 reiserfs_write_unlock(dir->i_sb);
@@ -918,10 +988,13 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
918 988
919 inode = dentry->d_inode; 989 inode = dentry->d_inode;
920 990
921 /* in this transaction we can be doing at max two balancings and update 991 /*
922 * two stat datas, we change quotas of the owner of the directory and of 992 * in this transaction we can be doing at max two balancings and
923 * the owner of the parent directory. The quota structure is possibly 993 * update two stat datas, we change quotas of the owner of the
924 * deleted only on iput => outside of this transaction */ 994 * directory and of the owner of the parent directory. The quota
995 * structure is possibly deleted only on iput => outside of
996 * this transaction
997 */
925 jbegin_count = 998 jbegin_count =
926 JOURNAL_PER_BALANCE_CNT * 2 + 2 + 999 JOURNAL_PER_BALANCE_CNT * 2 + 2 +
927 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); 1000 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
@@ -946,8 +1019,9 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
946 reiserfs_update_inode_transaction(dir); 1019 reiserfs_update_inode_transaction(dir);
947 1020
948 if (de.de_objectid != inode->i_ino) { 1021 if (de.de_objectid != inode->i_ino) {
949 // FIXME: compare key of an object and a key found in the 1022 /*
950 // entry 1023 * FIXME: compare key of an object and a key found in the entry
1024 */
951 retval = -EIO; 1025 retval = -EIO;
952 goto end_unlink; 1026 goto end_unlink;
953 } 1027 }
@@ -1011,7 +1085,10 @@ static int reiserfs_symlink(struct inode *parent_dir,
1011 struct reiserfs_transaction_handle th; 1085 struct reiserfs_transaction_handle th;
1012 struct reiserfs_security_handle security; 1086 struct reiserfs_security_handle security;
1013 int mode = S_IFLNK | S_IRWXUGO; 1087 int mode = S_IFLNK | S_IRWXUGO;
1014 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */ 1088 /*
1089 * We need blocks for transaction + (user+group)*(quotas for
1090 * new inode + update of quota for directory owner)
1091 */
1015 int jbegin_count = 1092 int jbegin_count =
1016 JOURNAL_PER_BALANCE_CNT * 3 + 1093 JOURNAL_PER_BALANCE_CNT * 3 +
1017 2 * (REISERFS_QUOTA_INIT_BLOCKS(parent_dir->i_sb) + 1094 2 * (REISERFS_QUOTA_INIT_BLOCKS(parent_dir->i_sb) +
@@ -1070,10 +1147,6 @@ static int reiserfs_symlink(struct inode *parent_dir,
1070 inode->i_op = &reiserfs_symlink_inode_operations; 1147 inode->i_op = &reiserfs_symlink_inode_operations;
1071 inode->i_mapping->a_ops = &reiserfs_address_space_operations; 1148 inode->i_mapping->a_ops = &reiserfs_address_space_operations;
1072 1149
1073 // must be sure this inode is written with this transaction
1074 //
1075 //reiserfs_update_sd (&th, inode, READ_BLOCKS);
1076
1077 retval = reiserfs_add_entry(&th, parent_dir, dentry->d_name.name, 1150 retval = reiserfs_add_entry(&th, parent_dir, dentry->d_name.name,
1078 dentry->d_name.len, inode, 1 /*visible */ ); 1151 dentry->d_name.len, inode, 1 /*visible */ );
1079 if (retval) { 1152 if (retval) {
@@ -1102,7 +1175,10 @@ static int reiserfs_link(struct dentry *old_dentry, struct inode *dir,
1102 int retval; 1175 int retval;
1103 struct inode *inode = old_dentry->d_inode; 1176 struct inode *inode = old_dentry->d_inode;
1104 struct reiserfs_transaction_handle th; 1177 struct reiserfs_transaction_handle th;
1105 /* We need blocks for transaction + update of quotas for the owners of the directory */ 1178 /*
1179 * We need blocks for transaction + update of quotas for
1180 * the owners of the directory
1181 */
1106 int jbegin_count = 1182 int jbegin_count =
1107 JOURNAL_PER_BALANCE_CNT * 3 + 1183 JOURNAL_PER_BALANCE_CNT * 3 +
1108 2 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); 1184 2 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
@@ -1111,7 +1187,7 @@ static int reiserfs_link(struct dentry *old_dentry, struct inode *dir,
1111 1187
1112 reiserfs_write_lock(dir->i_sb); 1188 reiserfs_write_lock(dir->i_sb);
1113 if (inode->i_nlink >= REISERFS_LINK_MAX) { 1189 if (inode->i_nlink >= REISERFS_LINK_MAX) {
1114 //FIXME: sd_nlink is 32 bit for new files 1190 /* FIXME: sd_nlink is 32 bit for new files */
1115 reiserfs_write_unlock(dir->i_sb); 1191 reiserfs_write_unlock(dir->i_sb);
1116 return -EMLINK; 1192 return -EMLINK;
1117 } 1193 }
@@ -1158,9 +1234,9 @@ static int de_still_valid(const char *name, int len,
1158{ 1234{
1159 struct reiserfs_dir_entry tmp = *de; 1235 struct reiserfs_dir_entry tmp = *de;
1160 1236
1161 // recalculate pointer to name and name length 1237 /* recalculate pointer to name and name length */
1162 set_de_name_and_namelen(&tmp); 1238 set_de_name_and_namelen(&tmp);
1163 // FIXME: could check more 1239 /* FIXME: could check more */
1164 if (tmp.de_namelen != len || memcmp(name, de->de_name, len)) 1240 if (tmp.de_namelen != len || memcmp(name, de->de_name, len))
1165 return 0; 1241 return 0;
1166 return 1; 1242 return 1;
@@ -1217,14 +1293,16 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1217 unsigned long savelink = 1; 1293 unsigned long savelink = 1;
1218 struct timespec ctime; 1294 struct timespec ctime;
1219 1295
1220 /* three balancings: (1) old name removal, (2) new name insertion 1296 /*
1221 and (3) maybe "save" link insertion 1297 * three balancings: (1) old name removal, (2) new name insertion
1222 stat data updates: (1) old directory, 1298 * and (3) maybe "save" link insertion
1223 (2) new directory and (3) maybe old object stat data (when it is 1299 * stat data updates: (1) old directory,
1224 directory) and (4) maybe stat data of object to which new entry 1300 * (2) new directory and (3) maybe old object stat data (when it is
1225 pointed initially and (5) maybe block containing ".." of 1301 * directory) and (4) maybe stat data of object to which new entry
1226 renamed directory 1302 * pointed initially and (5) maybe block containing ".." of
1227 quota updates: two parent directories */ 1303 * renamed directory
1304 * quota updates: two parent directories
1305 */
1228 jbegin_count = 1306 jbegin_count =
1229 JOURNAL_PER_BALANCE_CNT * 3 + 5 + 1307 JOURNAL_PER_BALANCE_CNT * 3 + 5 +
1230 4 * REISERFS_QUOTA_TRANS_BLOCKS(old_dir->i_sb); 1308 4 * REISERFS_QUOTA_TRANS_BLOCKS(old_dir->i_sb);
@@ -1235,8 +1313,10 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1235 old_inode = old_dentry->d_inode; 1313 old_inode = old_dentry->d_inode;
1236 new_dentry_inode = new_dentry->d_inode; 1314 new_dentry_inode = new_dentry->d_inode;
1237 1315
1238 // make sure, that oldname still exists and points to an object we 1316 /*
1239 // are going to rename 1317 * make sure that oldname still exists and points to an object we
1318 * are going to rename
1319 */
1240 old_de.de_gen_number_bit_string = NULL; 1320 old_de.de_gen_number_bit_string = NULL;
1241 reiserfs_write_lock(old_dir->i_sb); 1321 reiserfs_write_lock(old_dir->i_sb);
1242 retval = 1322 retval =
@@ -1256,10 +1336,11 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1256 1336
1257 old_inode_mode = old_inode->i_mode; 1337 old_inode_mode = old_inode->i_mode;
1258 if (S_ISDIR(old_inode_mode)) { 1338 if (S_ISDIR(old_inode_mode)) {
1259 // make sure, that directory being renamed has correct ".." 1339 /*
1260 // and that its new parent directory has not too many links 1340 * make sure that directory being renamed has correct ".."
1261 // already 1341 * and that its new parent directory has not too many links
1262 1342 * already
1343 */
1263 if (new_dentry_inode) { 1344 if (new_dentry_inode) {
1264 if (!reiserfs_empty_dir(new_dentry_inode)) { 1345 if (!reiserfs_empty_dir(new_dentry_inode)) {
1265 reiserfs_write_unlock(old_dir->i_sb); 1346 reiserfs_write_unlock(old_dir->i_sb);
@@ -1267,8 +1348,9 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1267 } 1348 }
1268 } 1349 }
1269 1350
1270 /* directory is renamed, its parent directory will be changed, 1351 /*
1271 ** so find ".." entry 1352 * directory is renamed, its parent directory will be changed,
1353 * so find ".." entry
1272 */ 1354 */
1273 dot_dot_de.de_gen_number_bit_string = NULL; 1355 dot_dot_de.de_gen_number_bit_string = NULL;
1274 retval = 1356 retval =
@@ -1311,8 +1393,9 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1311 reiserfs_update_inode_transaction(old_dir); 1393 reiserfs_update_inode_transaction(old_dir);
1312 reiserfs_update_inode_transaction(new_dir); 1394 reiserfs_update_inode_transaction(new_dir);
1313 1395
1314 /* this makes it so an fsync on an open fd for the old name will 1396 /*
1315 ** commit the rename operation 1397 * this makes it so an fsync on an open fd for the old name will
1398 * commit the rename operation
1316 */ 1399 */
1317 reiserfs_update_inode_transaction(old_inode); 1400 reiserfs_update_inode_transaction(old_inode);
1318 1401
@@ -1320,7 +1403,10 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1320 reiserfs_update_inode_transaction(new_dentry_inode); 1403 reiserfs_update_inode_transaction(new_dentry_inode);
1321 1404
1322 while (1) { 1405 while (1) {
1323 // look for old name using corresponding entry key (found by reiserfs_find_entry) 1406 /*
1407 * look for old name using corresponding entry key
1408 * (found by reiserfs_find_entry)
1409 */
1324 if ((retval = 1410 if ((retval =
1325 search_by_entry_key(new_dir->i_sb, &old_de.de_entry_key, 1411 search_by_entry_key(new_dir->i_sb, &old_de.de_entry_key,
1326 &old_entry_path, 1412 &old_entry_path,
@@ -1335,14 +1421,18 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1335 1421
1336 reiserfs_prepare_for_journal(old_inode->i_sb, old_de.de_bh, 1); 1422 reiserfs_prepare_for_journal(old_inode->i_sb, old_de.de_bh, 1);
1337 1423
1338 // look for new name by reiserfs_find_entry 1424 /* look for new name by reiserfs_find_entry */
1339 new_de.de_gen_number_bit_string = NULL; 1425 new_de.de_gen_number_bit_string = NULL;
1340 retval = 1426 retval =
1341 reiserfs_find_entry(new_dir, new_dentry->d_name.name, 1427 reiserfs_find_entry(new_dir, new_dentry->d_name.name,
1342 new_dentry->d_name.len, &new_entry_path, 1428 new_dentry->d_name.len, &new_entry_path,
1343 &new_de); 1429 &new_de);
1344 // reiserfs_add_entry should not return IO_ERROR, because it is called with essentially same parameters from 1430 /*
1345 // reiserfs_add_entry above, and we'll catch any i/o errors before we get here. 1431 * reiserfs_add_entry should not return IO_ERROR,
1432 * because it is called with essentially same parameters from
1433 * reiserfs_add_entry above, and we'll catch any i/o errors
1434 * before we get here.
1435 */
1346 if (retval != NAME_FOUND_INVISIBLE && retval != NAME_FOUND) { 1436 if (retval != NAME_FOUND_INVISIBLE && retval != NAME_FOUND) {
1347 pathrelse(&new_entry_path); 1437 pathrelse(&new_entry_path);
1348 pathrelse(&old_entry_path); 1438 pathrelse(&old_entry_path);
@@ -1370,22 +1460,26 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1370 } 1460 }
1371 copy_item_head(&dot_dot_ih, 1461 copy_item_head(&dot_dot_ih,
1372 tp_item_head(&dot_dot_entry_path)); 1462 tp_item_head(&dot_dot_entry_path));
1373 // node containing ".." gets into transaction 1463 /* node containing ".." gets into transaction */
1374 reiserfs_prepare_for_journal(old_inode->i_sb, 1464 reiserfs_prepare_for_journal(old_inode->i_sb,
1375 dot_dot_de.de_bh, 1); 1465 dot_dot_de.de_bh, 1);
1376 } 1466 }
1377 /* we should check seals here, not do 1467 /*
1378 this stuff, yes? Then, having 1468 * we should check seals here, not do
1379 gathered everything into RAM we 1469 * this stuff, yes? Then, having
1380 should lock the buffers, yes? -Hans */ 1470 * gathered everything into RAM we
1381 /* probably. our rename needs to hold more 1471 * should lock the buffers, yes? -Hans
1382 ** than one path at once. The seals would 1472 */
1383 ** have to be written to deal with multi-path 1473 /*
1384 ** issues -chris 1474 * probably. our rename needs to hold more
1475 * than one path at once. The seals would
1476 * have to be written to deal with multi-path
1477 * issues -chris
1385 */ 1478 */
1386 /* sanity checking before doing the rename - avoid races many 1479 /*
1387 ** of the above checks could have scheduled. We have to be 1480 * sanity checking before doing the rename - avoid races many
1388 ** sure our items haven't been shifted by another process. 1481 * of the above checks could have scheduled. We have to be
1482 * sure our items haven't been shifted by another process.
1389 */ 1483 */
1390 if (item_moved(&new_entry_ih, &new_entry_path) || 1484 if (item_moved(&new_entry_ih, &new_entry_path) ||
1391 !entry_points_to_object(new_dentry->d_name.name, 1485 !entry_points_to_object(new_dentry->d_name.name,
@@ -1430,8 +1524,10 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1430 break; 1524 break;
1431 } 1525 }
1432 1526
1433 /* ok, all the changes can be done in one fell swoop when we 1527 /*
1434 have claimed all the buffers needed. */ 1528 * ok, all the changes can be done in one fell swoop when we
1529 * have claimed all the buffers needed.
1530 */
1435 1531
1436 mark_de_visible(new_de.de_deh + new_de.de_entry_num); 1532 mark_de_visible(new_de.de_deh + new_de.de_entry_num);
1437 set_ino_in_dir_entry(&new_de, INODE_PKEY(old_inode)); 1533 set_ino_in_dir_entry(&new_de, INODE_PKEY(old_inode));
@@ -1442,12 +1538,14 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1442 ctime = CURRENT_TIME_SEC; 1538 ctime = CURRENT_TIME_SEC;
1443 old_dir->i_ctime = old_dir->i_mtime = ctime; 1539 old_dir->i_ctime = old_dir->i_mtime = ctime;
1444 new_dir->i_ctime = new_dir->i_mtime = ctime; 1540 new_dir->i_ctime = new_dir->i_mtime = ctime;
1445 /* thanks to Alex Adriaanse <alex_a@caltech.edu> for patch which adds ctime update of 1541 /*
1446 renamed object */ 1542 * thanks to Alex Adriaanse <alex_a@caltech.edu> for patch
1543 * which adds ctime update of renamed object
1544 */
1447 old_inode->i_ctime = ctime; 1545 old_inode->i_ctime = ctime;
1448 1546
1449 if (new_dentry_inode) { 1547 if (new_dentry_inode) {
1450 // adjust link number of the victim 1548 /* adjust link number of the victim */
1451 if (S_ISDIR(new_dentry_inode->i_mode)) { 1549 if (S_ISDIR(new_dentry_inode->i_mode)) {
1452 clear_nlink(new_dentry_inode); 1550 clear_nlink(new_dentry_inode);
1453 } else { 1551 } else {
@@ -1462,21 +1560,28 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1462 set_ino_in_dir_entry(&dot_dot_de, INODE_PKEY(new_dir)); 1560 set_ino_in_dir_entry(&dot_dot_de, INODE_PKEY(new_dir));
1463 journal_mark_dirty(&th, new_dir->i_sb, dot_dot_de.de_bh); 1561 journal_mark_dirty(&th, new_dir->i_sb, dot_dot_de.de_bh);
1464 1562
1563 /*
1564 * there (in new_dir) was no directory, so it got new link
1565 * (".." of renamed directory)
1566 */
1465 if (!new_dentry_inode) 1567 if (!new_dentry_inode)
1466 /* there (in new_dir) was no directory, so it got new link
1467 (".." of renamed directory) */
1468 INC_DIR_INODE_NLINK(new_dir); 1568 INC_DIR_INODE_NLINK(new_dir);
1469 1569
1470 /* old directory lost one link - ".. " of renamed directory */ 1570 /* old directory lost one link - ".. " of renamed directory */
1471 DEC_DIR_INODE_NLINK(old_dir); 1571 DEC_DIR_INODE_NLINK(old_dir);
1472 } 1572 }
1473 // looks like in 2.3.99pre3 brelse is atomic. so we can use pathrelse 1573 /*
1574 * looks like in 2.3.99pre3 brelse is atomic.
1575 * so we can use pathrelse
1576 */
1474 pathrelse(&new_entry_path); 1577 pathrelse(&new_entry_path);
1475 pathrelse(&dot_dot_entry_path); 1578 pathrelse(&dot_dot_entry_path);
1476 1579
1477 // FIXME: this reiserfs_cut_from_item's return value may screw up 1580 /*
1478 // anybody, but it will panic if will not be able to find the 1581 * FIXME: this reiserfs_cut_from_item's return value may screw up
1479 // entry. This needs one more clean up 1582 * anybody, but it will panic if will not be able to find the
1583 * entry. This needs one more clean up
1584 */
1480 if (reiserfs_cut_from_item 1585 if (reiserfs_cut_from_item
1481 (&th, &old_entry_path, &(old_de.de_entry_key), old_dir, NULL, 1586 (&th, &old_entry_path, &(old_de.de_entry_key), old_dir, NULL,
1482 0) < 0) 1587 0) < 0)
@@ -1501,11 +1606,8 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1501 return retval; 1606 return retval;
1502} 1607}
1503 1608
1504/* 1609/* directories can handle most operations... */
1505 * directories can handle most operations...
1506 */
1507const struct inode_operations reiserfs_dir_inode_operations = { 1610const struct inode_operations reiserfs_dir_inode_operations = {
1508 //&reiserfs_dir_operations, /* default_file_ops */
1509 .create = reiserfs_create, 1611 .create = reiserfs_create,
1510 .lookup = reiserfs_lookup, 1612 .lookup = reiserfs_lookup,
1511 .link = reiserfs_link, 1613 .link = reiserfs_link,