aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6
diff options
context:
space:
mode:
authorBarry Naujok <bnaujok@sgi.com>2008-04-09 22:22:07 -0400
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-04-17 22:00:12 -0400
commit556b8b166c9514b5f940047a41dad8fe8cd9a778 (patch)
tree22fdec0d211d9c93a6d8d60b591591f7c9a8de1b /fs/xfs/linux-2.6
parent7c9ef85c5672ae316aafd7bbe0bbadebe90301e6 (diff)
[XFS] remove bhv_vname_t and xfs_rename code
SGI-PV: 976035 SGI-Modid: xfs-linux-melb:xfs-kern:30804a Signed-off-by: Barry Naujok <bnaujok@sgi.com> Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6')
-rw-r--r--fs/xfs/linux-2.6/xfs_export.c5
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c55
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.h9
3 files changed, 43 insertions, 26 deletions
diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/linux-2.6/xfs_export.c
index 66a9a9e76cbe..265f0168ab76 100644
--- a/fs/xfs/linux-2.6/xfs_export.c
+++ b/fs/xfs/linux-2.6/xfs_export.c
@@ -22,6 +22,7 @@
22#include "xfs_trans.h" 22#include "xfs_trans.h"
23#include "xfs_sb.h" 23#include "xfs_sb.h"
24#include "xfs_ag.h" 24#include "xfs_ag.h"
25#include "xfs_dir2.h"
25#include "xfs_dmapi.h" 26#include "xfs_dmapi.h"
26#include "xfs_mount.h" 27#include "xfs_mount.h"
27#include "xfs_export.h" 28#include "xfs_export.h"
@@ -30,8 +31,6 @@
30#include "xfs_inode.h" 31#include "xfs_inode.h"
31#include "xfs_vfsops.h" 32#include "xfs_vfsops.h"
32 33
33static struct dentry dotdot = { .d_name.name = "..", .d_name.len = 2, };
34
35/* 34/*
36 * Note that we only accept fileids which are long enough rather than allow 35 * Note that we only accept fileids which are long enough rather than allow
37 * the parent generation number to default to zero. XFS considers zero a 36 * the parent generation number to default to zero. XFS considers zero a
@@ -216,7 +215,7 @@ xfs_fs_get_parent(
216 struct xfs_inode *cip; 215 struct xfs_inode *cip;
217 struct dentry *parent; 216 struct dentry *parent;
218 217
219 error = xfs_lookup(XFS_I(child->d_inode), &dotdot, &cip); 218 error = xfs_lookup(XFS_I(child->d_inode), &xfs_name_dotdot, &cip);
220 if (unlikely(error)) 219 if (unlikely(error))
221 return ERR_PTR(-error); 220 return ERR_PTR(-error);
222 221
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 41e7baabfd9f..0c958cf77758 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -239,6 +239,15 @@ xfs_init_security(
239 return error; 239 return error;
240} 240}
241 241
242static void
243xfs_dentry_to_name(
244 struct xfs_name *namep,
245 struct dentry *dentry)
246{
247 namep->name = dentry->d_name.name;
248 namep->len = dentry->d_name.len;
249}
250
242STATIC void 251STATIC void
243xfs_cleanup_inode( 252xfs_cleanup_inode(
244 struct inode *dir, 253 struct inode *dir,
@@ -246,20 +255,19 @@ xfs_cleanup_inode(
246 struct dentry *dentry, 255 struct dentry *dentry,
247 int mode) 256 int mode)
248{ 257{
249 struct dentry teardown = {}; 258 struct xfs_name teardown;
250 259
251 /* Oh, the horror. 260 /* Oh, the horror.
252 * If we can't add the ACL or we fail in 261 * If we can't add the ACL or we fail in
253 * xfs_init_security we must back out. 262 * xfs_init_security we must back out.
254 * ENOSPC can hit here, among other things. 263 * ENOSPC can hit here, among other things.
255 */ 264 */
256 teardown.d_inode = inode; 265 xfs_dentry_to_name(&teardown, dentry);
257 teardown.d_name = dentry->d_name;
258 266
259 if (S_ISDIR(mode)) 267 if (S_ISDIR(mode))
260 xfs_rmdir(XFS_I(dir), &teardown); 268 xfs_rmdir(XFS_I(dir), &teardown, XFS_I(inode));
261 else 269 else
262 xfs_remove(XFS_I(dir), &teardown); 270 xfs_remove(XFS_I(dir), &teardown, XFS_I(inode));
263 iput(inode); 271 iput(inode);
264} 272}
265 273
@@ -273,6 +281,7 @@ xfs_vn_mknod(
273 struct inode *inode; 281 struct inode *inode;
274 struct xfs_inode *ip = NULL; 282 struct xfs_inode *ip = NULL;
275 xfs_acl_t *default_acl = NULL; 283 xfs_acl_t *default_acl = NULL;
284 struct xfs_name name;
276 attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS; 285 attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS;
277 int error; 286 int error;
278 287
@@ -293,6 +302,8 @@ xfs_vn_mknod(
293 } 302 }
294 } 303 }
295 304
305 xfs_dentry_to_name(&name, dentry);
306
296 if (IS_POSIXACL(dir) && !default_acl) 307 if (IS_POSIXACL(dir) && !default_acl)
297 mode &= ~current->fs->umask; 308 mode &= ~current->fs->umask;
298 309
@@ -303,10 +314,10 @@ xfs_vn_mknod(
303 case S_IFSOCK: 314 case S_IFSOCK:
304 rdev = sysv_encode_dev(rdev); 315 rdev = sysv_encode_dev(rdev);
305 case S_IFREG: 316 case S_IFREG:
306 error = xfs_create(XFS_I(dir), dentry, mode, rdev, &ip, NULL); 317 error = xfs_create(XFS_I(dir), &name, mode, rdev, &ip, NULL);
307 break; 318 break;
308 case S_IFDIR: 319 case S_IFDIR:
309 error = xfs_mkdir(XFS_I(dir), dentry, mode, &ip, NULL); 320 error = xfs_mkdir(XFS_I(dir), &name, mode, &ip, NULL);
310 break; 321 break;
311 default: 322 default:
312 error = EINVAL; 323 error = EINVAL;
@@ -371,12 +382,14 @@ xfs_vn_lookup(
371 struct nameidata *nd) 382 struct nameidata *nd)
372{ 383{
373 struct xfs_inode *cip; 384 struct xfs_inode *cip;
385 struct xfs_name name;
374 int error; 386 int error;
375 387
376 if (dentry->d_name.len >= MAXNAMELEN) 388 if (dentry->d_name.len >= MAXNAMELEN)
377 return ERR_PTR(-ENAMETOOLONG); 389 return ERR_PTR(-ENAMETOOLONG);
378 390
379 error = xfs_lookup(XFS_I(dir), dentry, &cip); 391 xfs_dentry_to_name(&name, dentry);
392 error = xfs_lookup(XFS_I(dir), &name, &cip);
380 if (unlikely(error)) { 393 if (unlikely(error)) {
381 if (unlikely(error != ENOENT)) 394 if (unlikely(error != ENOENT))
382 return ERR_PTR(-error); 395 return ERR_PTR(-error);
@@ -394,12 +407,14 @@ xfs_vn_link(
394 struct dentry *dentry) 407 struct dentry *dentry)
395{ 408{
396 struct inode *inode; /* inode of guy being linked to */ 409 struct inode *inode; /* inode of guy being linked to */
410 struct xfs_name name;
397 int error; 411 int error;
398 412
399 inode = old_dentry->d_inode; 413 inode = old_dentry->d_inode;
414 xfs_dentry_to_name(&name, dentry);
400 415
401 igrab(inode); 416 igrab(inode);
402 error = xfs_link(XFS_I(dir), XFS_I(inode), dentry); 417 error = xfs_link(XFS_I(dir), XFS_I(inode), &name);
403 if (unlikely(error)) { 418 if (unlikely(error)) {
404 iput(inode); 419 iput(inode);
405 return -error; 420 return -error;
@@ -417,11 +432,13 @@ xfs_vn_unlink(
417 struct dentry *dentry) 432 struct dentry *dentry)
418{ 433{
419 struct inode *inode; 434 struct inode *inode;
435 struct xfs_name name;
420 int error; 436 int error;
421 437
422 inode = dentry->d_inode; 438 inode = dentry->d_inode;
439 xfs_dentry_to_name(&name, dentry);
423 440
424 error = xfs_remove(XFS_I(dir), dentry); 441 error = xfs_remove(XFS_I(dir), &name, XFS_I(inode));
425 if (likely(!error)) { 442 if (likely(!error)) {
426 xfs_validate_fields(dir); /* size needs update */ 443 xfs_validate_fields(dir); /* size needs update */
427 xfs_validate_fields(inode); 444 xfs_validate_fields(inode);
@@ -437,14 +454,15 @@ xfs_vn_symlink(
437{ 454{
438 struct inode *inode; 455 struct inode *inode;
439 struct xfs_inode *cip = NULL; 456 struct xfs_inode *cip = NULL;
457 struct xfs_name name;
440 int error; 458 int error;
441 mode_t mode; 459 mode_t mode;
442 460
443 mode = S_IFLNK | 461 mode = S_IFLNK |
444 (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO); 462 (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO);
463 xfs_dentry_to_name(&name, dentry);
445 464
446 error = xfs_symlink(XFS_I(dir), dentry, (char *)symname, mode, 465 error = xfs_symlink(XFS_I(dir), &name, symname, mode, &cip, NULL);
447 &cip, NULL);
448 if (unlikely(error)) 466 if (unlikely(error))
449 goto out; 467 goto out;
450 468
@@ -471,9 +489,12 @@ xfs_vn_rmdir(
471 struct dentry *dentry) 489 struct dentry *dentry)
472{ 490{
473 struct inode *inode = dentry->d_inode; 491 struct inode *inode = dentry->d_inode;
492 struct xfs_name name;
474 int error; 493 int error;
475 494
476 error = xfs_rmdir(XFS_I(dir), dentry); 495 xfs_dentry_to_name(&name, dentry);
496
497 error = xfs_rmdir(XFS_I(dir), &name, XFS_I(inode));
477 if (likely(!error)) { 498 if (likely(!error)) {
478 xfs_validate_fields(inode); 499 xfs_validate_fields(inode);
479 xfs_validate_fields(dir); 500 xfs_validate_fields(dir);
@@ -489,9 +510,15 @@ xfs_vn_rename(
489 struct dentry *ndentry) 510 struct dentry *ndentry)
490{ 511{
491 struct inode *new_inode = ndentry->d_inode; 512 struct inode *new_inode = ndentry->d_inode;
513 struct xfs_name oname;
514 struct xfs_name nname;
492 int error; 515 int error;
493 516
494 error = xfs_rename(XFS_I(odir), odentry, XFS_I(ndir), ndentry); 517 xfs_dentry_to_name(&oname, odentry);
518 xfs_dentry_to_name(&nname, ndentry);
519
520 error = xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode),
521 XFS_I(ndir), &nname);
495 if (likely(!error)) { 522 if (likely(!error)) {
496 if (new_inode) 523 if (new_inode)
497 xfs_validate_fields(new_inode); 524 xfs_validate_fields(new_inode);
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
index dbb8a5d27f78..8b4d63ce8694 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/linux-2.6/xfs_vnode.h
@@ -23,8 +23,6 @@ struct bhv_vattr;
23struct xfs_iomap; 23struct xfs_iomap;
24struct attrlist_cursor_kern; 24struct attrlist_cursor_kern;
25 25
26typedef struct dentry bhv_vname_t;
27typedef __u64 bhv_vnumber_t;
28typedef struct inode bhv_vnode_t; 26typedef struct inode bhv_vnode_t;
29 27
30#define VN_ISLNK(vp) S_ISLNK((vp)->i_mode) 28#define VN_ISLNK(vp) S_ISLNK((vp)->i_mode)
@@ -211,13 +209,6 @@ static inline bhv_vnode_t *vn_grab(bhv_vnode_t *vp)
211} 209}
212 210
213/* 211/*
214 * Vname handling macros.
215 */
216#define VNAME(dentry) ((char *) (dentry)->d_name.name)
217#define VNAMELEN(dentry) ((dentry)->d_name.len)
218#define VNAME_TO_INODE(dentry) (XFS_I((dentry)->d_inode))
219
220/*
221 * Dealing with bad inodes 212 * Dealing with bad inodes
222 */ 213 */
223static inline int VN_BAD(bhv_vnode_t *vp) 214static inline int VN_BAD(bhv_vnode_t *vp)