diff options
-rw-r--r-- | fs/xfs/linux-2.6/xfs_file.c | 42 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 89 |
2 files changed, 42 insertions, 89 deletions
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c index b050e4079427..c271c9936498 100644 --- a/fs/xfs/linux-2.6/xfs_file.c +++ b/fs/xfs/linux-2.6/xfs_file.c | |||
@@ -145,22 +145,17 @@ __xfs_file_readv( | |||
145 | { | 145 | { |
146 | struct inode *inode = file->f_mapping->host; | 146 | struct inode *inode = file->f_mapping->host; |
147 | vnode_t *vp = LINVFS_GET_VP(inode); | 147 | vnode_t *vp = LINVFS_GET_VP(inode); |
148 | struct kiocb *kiocb; | 148 | struct kiocb kiocb; |
149 | ssize_t rval; | 149 | ssize_t rval; |
150 | 150 | ||
151 | kiocb = kmalloc(sizeof(*kiocb), GFP_KERNEL); | 151 | init_sync_kiocb(&kiocb, file); |
152 | if (unlikely(!kiocb)) | 152 | kiocb.ki_pos = *ppos; |
153 | return -ENOMEM; | ||
154 | |||
155 | init_sync_kiocb(kiocb, file); | ||
156 | kiocb->ki_pos = *ppos; | ||
157 | 153 | ||
158 | if (unlikely(file->f_flags & O_DIRECT)) | 154 | if (unlikely(file->f_flags & O_DIRECT)) |
159 | ioflags |= IO_ISDIRECT; | 155 | ioflags |= IO_ISDIRECT; |
160 | VOP_READ(vp, kiocb, iov, nr_segs, &kiocb->ki_pos, ioflags, NULL, rval); | 156 | VOP_READ(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval); |
161 | 157 | ||
162 | *ppos = kiocb->ki_pos; | 158 | *ppos = kiocb.ki_pos; |
163 | kfree(kiocb); | ||
164 | return rval; | 159 | return rval; |
165 | } | 160 | } |
166 | 161 | ||
@@ -195,22 +190,17 @@ __xfs_file_writev( | |||
195 | { | 190 | { |
196 | struct inode *inode = file->f_mapping->host; | 191 | struct inode *inode = file->f_mapping->host; |
197 | vnode_t *vp = LINVFS_GET_VP(inode); | 192 | vnode_t *vp = LINVFS_GET_VP(inode); |
198 | struct kiocb *kiocb; | 193 | struct kiocb kiocb; |
199 | ssize_t rval; | 194 | ssize_t rval; |
200 | 195 | ||
201 | kiocb = kmalloc(sizeof(*kiocb), GFP_KERNEL); | 196 | init_sync_kiocb(&kiocb, file); |
202 | if (unlikely(!kiocb)) | 197 | kiocb.ki_pos = *ppos; |
203 | return -ENOMEM; | ||
204 | |||
205 | init_sync_kiocb(kiocb, file); | ||
206 | kiocb->ki_pos = *ppos; | ||
207 | if (unlikely(file->f_flags & O_DIRECT)) | 198 | if (unlikely(file->f_flags & O_DIRECT)) |
208 | ioflags |= IO_ISDIRECT; | 199 | ioflags |= IO_ISDIRECT; |
209 | 200 | ||
210 | VOP_WRITE(vp, kiocb, iov, nr_segs, &kiocb->ki_pos, ioflags, NULL, rval); | 201 | VOP_WRITE(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval); |
211 | 202 | ||
212 | *ppos = kiocb->ki_pos; | 203 | *ppos = kiocb.ki_pos; |
213 | kfree(kiocb); | ||
214 | return rval; | 204 | return rval; |
215 | } | 205 | } |
216 | 206 | ||
@@ -420,7 +410,7 @@ xfs_file_mmap( | |||
420 | { | 410 | { |
421 | struct inode *ip = filp->f_dentry->d_inode; | 411 | struct inode *ip = filp->f_dentry->d_inode; |
422 | vnode_t *vp = LINVFS_GET_VP(ip); | 412 | vnode_t *vp = LINVFS_GET_VP(ip); |
423 | vattr_t *vattr; | 413 | vattr_t vattr; |
424 | int error; | 414 | int error; |
425 | 415 | ||
426 | vma->vm_ops = &xfs_file_vm_ops; | 416 | vma->vm_ops = &xfs_file_vm_ops; |
@@ -431,14 +421,10 @@ xfs_file_mmap( | |||
431 | } | 421 | } |
432 | #endif /* CONFIG_XFS_DMAPI */ | 422 | #endif /* CONFIG_XFS_DMAPI */ |
433 | 423 | ||
434 | vattr = kmalloc(sizeof(*vattr), GFP_KERNEL); | 424 | vattr.va_mask = XFS_AT_UPDATIME; |
435 | if (unlikely(!vattr)) | 425 | VOP_SETATTR(vp, &vattr, XFS_AT_UPDATIME, NULL, error); |
436 | return -ENOMEM; | ||
437 | vattr->va_mask = XFS_AT_UPDATIME; | ||
438 | VOP_SETATTR(vp, vattr, XFS_AT_UPDATIME, NULL, error); | ||
439 | if (likely(!error)) | 426 | if (likely(!error)) |
440 | __vn_revalidate(vp, vattr); /* update flags */ | 427 | __vn_revalidate(vp, &vattr); /* update flags */ |
441 | kfree(vattr); | ||
442 | return 0; | 428 | return 0; |
443 | } | 429 | } |
444 | 430 | ||
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index 93b9e6e43f20..0a508580e572 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -295,7 +295,7 @@ xfs_vn_mknod( | |||
295 | dev_t rdev) | 295 | dev_t rdev) |
296 | { | 296 | { |
297 | struct inode *ip; | 297 | struct inode *ip; |
298 | vattr_t *vattr; | 298 | vattr_t vattr = { 0 }; |
299 | vnode_t *vp = NULL, *dvp = LINVFS_GET_VP(dir); | 299 | vnode_t *vp = NULL, *dvp = LINVFS_GET_VP(dir); |
300 | xfs_acl_t *default_acl = NULL; | 300 | xfs_acl_t *default_acl = NULL; |
301 | attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS; | 301 | attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS; |
@@ -308,13 +308,8 @@ xfs_vn_mknod( | |||
308 | if (unlikely(!sysv_valid_dev(rdev) || MAJOR(rdev) & ~0x1ff)) | 308 | if (unlikely(!sysv_valid_dev(rdev) || MAJOR(rdev) & ~0x1ff)) |
309 | return -EINVAL; | 309 | return -EINVAL; |
310 | 310 | ||
311 | vattr = kmalloc(sizeof(*vattr), GFP_KERNEL); | ||
312 | if (unlikely(!vattr)) | ||
313 | return -ENOMEM; | ||
314 | |||
315 | if (unlikely(test_default_acl && test_default_acl(dvp))) { | 311 | if (unlikely(test_default_acl && test_default_acl(dvp))) { |
316 | if (!_ACL_ALLOC(default_acl)) { | 312 | if (!_ACL_ALLOC(default_acl)) { |
317 | kfree(vattr); | ||
318 | return -ENOMEM; | 313 | return -ENOMEM; |
319 | } | 314 | } |
320 | if (!_ACL_GET_DEFAULT(dvp, default_acl)) { | 315 | if (!_ACL_GET_DEFAULT(dvp, default_acl)) { |
@@ -326,20 +321,19 @@ xfs_vn_mknod( | |||
326 | if (IS_POSIXACL(dir) && !default_acl && xfs_has_fs_struct(current)) | 321 | if (IS_POSIXACL(dir) && !default_acl && xfs_has_fs_struct(current)) |
327 | mode &= ~current->fs->umask; | 322 | mode &= ~current->fs->umask; |
328 | 323 | ||
329 | memset(vattr, 0, sizeof(*vattr)); | 324 | vattr.va_mask = XFS_AT_TYPE|XFS_AT_MODE; |
330 | vattr->va_mask = XFS_AT_TYPE|XFS_AT_MODE; | 325 | vattr.va_mode = mode; |
331 | vattr->va_mode = mode; | ||
332 | 326 | ||
333 | switch (mode & S_IFMT) { | 327 | switch (mode & S_IFMT) { |
334 | case S_IFCHR: case S_IFBLK: case S_IFIFO: case S_IFSOCK: | 328 | case S_IFCHR: case S_IFBLK: case S_IFIFO: case S_IFSOCK: |
335 | vattr->va_rdev = sysv_encode_dev(rdev); | 329 | vattr.va_rdev = sysv_encode_dev(rdev); |
336 | vattr->va_mask |= XFS_AT_RDEV; | 330 | vattr.va_mask |= XFS_AT_RDEV; |
337 | /*FALLTHROUGH*/ | 331 | /*FALLTHROUGH*/ |
338 | case S_IFREG: | 332 | case S_IFREG: |
339 | VOP_CREATE(dvp, dentry, vattr, &vp, NULL, error); | 333 | VOP_CREATE(dvp, dentry, &vattr, &vp, NULL, error); |
340 | break; | 334 | break; |
341 | case S_IFDIR: | 335 | case S_IFDIR: |
342 | VOP_MKDIR(dvp, dentry, vattr, &vp, NULL, error); | 336 | VOP_MKDIR(dvp, dentry, &vattr, &vp, NULL, error); |
343 | break; | 337 | break; |
344 | default: | 338 | default: |
345 | error = EINVAL; | 339 | error = EINVAL; |
@@ -354,7 +348,7 @@ xfs_vn_mknod( | |||
354 | 348 | ||
355 | if (unlikely(default_acl)) { | 349 | if (unlikely(default_acl)) { |
356 | if (!error) { | 350 | if (!error) { |
357 | error = _ACL_INHERIT(vp, vattr, default_acl); | 351 | error = _ACL_INHERIT(vp, &vattr, default_acl); |
358 | if (!error) | 352 | if (!error) |
359 | VMODIFY(vp); | 353 | VMODIFY(vp); |
360 | else | 354 | else |
@@ -370,11 +364,10 @@ xfs_vn_mknod( | |||
370 | if (S_ISCHR(mode) || S_ISBLK(mode)) | 364 | if (S_ISCHR(mode) || S_ISBLK(mode)) |
371 | ip->i_rdev = rdev; | 365 | ip->i_rdev = rdev; |
372 | else if (S_ISDIR(mode)) | 366 | else if (S_ISDIR(mode)) |
373 | xfs_validate_fields(ip, vattr); | 367 | xfs_validate_fields(ip, &vattr); |
374 | d_instantiate(dentry, ip); | 368 | d_instantiate(dentry, ip); |
375 | xfs_validate_fields(dir, vattr); | 369 | xfs_validate_fields(dir, &vattr); |
376 | } | 370 | } |
377 | kfree(vattr); | ||
378 | return -error; | 371 | return -error; |
379 | } | 372 | } |
380 | 373 | ||
@@ -429,17 +422,13 @@ xfs_vn_link( | |||
429 | struct inode *ip; /* inode of guy being linked to */ | 422 | struct inode *ip; /* inode of guy being linked to */ |
430 | vnode_t *tdvp; /* target directory for new name/link */ | 423 | vnode_t *tdvp; /* target directory for new name/link */ |
431 | vnode_t *vp; /* vp of name being linked */ | 424 | vnode_t *vp; /* vp of name being linked */ |
432 | vattr_t *vattr; | 425 | vattr_t vattr; |
433 | int error; | 426 | int error; |
434 | 427 | ||
435 | ip = old_dentry->d_inode; /* inode being linked to */ | 428 | ip = old_dentry->d_inode; /* inode being linked to */ |
436 | if (S_ISDIR(ip->i_mode)) | 429 | if (S_ISDIR(ip->i_mode)) |
437 | return -EPERM; | 430 | return -EPERM; |
438 | 431 | ||
439 | vattr = kmalloc(sizeof(*vattr), GFP_KERNEL); | ||
440 | if (unlikely(!vattr)) | ||
441 | return -ENOMEM; | ||
442 | |||
443 | tdvp = LINVFS_GET_VP(dir); | 432 | tdvp = LINVFS_GET_VP(dir); |
444 | vp = LINVFS_GET_VP(ip); | 433 | vp = LINVFS_GET_VP(ip); |
445 | 434 | ||
@@ -447,10 +436,9 @@ xfs_vn_link( | |||
447 | if (likely(!error)) { | 436 | if (likely(!error)) { |
448 | VMODIFY(tdvp); | 437 | VMODIFY(tdvp); |
449 | VN_HOLD(vp); | 438 | VN_HOLD(vp); |
450 | xfs_validate_fields(ip, vattr); | 439 | xfs_validate_fields(ip, &vattr); |
451 | d_instantiate(dentry, ip); | 440 | d_instantiate(dentry, ip); |
452 | } | 441 | } |
453 | kfree(vattr); | ||
454 | return -error; | 442 | return -error; |
455 | } | 443 | } |
456 | 444 | ||
@@ -461,22 +449,17 @@ xfs_vn_unlink( | |||
461 | { | 449 | { |
462 | struct inode *inode; | 450 | struct inode *inode; |
463 | vnode_t *dvp; /* directory containing name to remove */ | 451 | vnode_t *dvp; /* directory containing name to remove */ |
464 | vattr_t *vattr; | 452 | vattr_t vattr; |
465 | int error; | 453 | int error; |
466 | 454 | ||
467 | vattr = kmalloc(sizeof(*vattr), GFP_KERNEL); | ||
468 | if (unlikely(!vattr)) | ||
469 | return -ENOMEM; | ||
470 | |||
471 | inode = dentry->d_inode; | 455 | inode = dentry->d_inode; |
472 | dvp = LINVFS_GET_VP(dir); | 456 | dvp = LINVFS_GET_VP(dir); |
473 | 457 | ||
474 | VOP_REMOVE(dvp, dentry, NULL, error); | 458 | VOP_REMOVE(dvp, dentry, NULL, error); |
475 | if (likely(!error)) { | 459 | if (likely(!error)) { |
476 | xfs_validate_fields(dir, vattr); /* size needs update */ | 460 | xfs_validate_fields(dir, &vattr); /* size needs update */ |
477 | xfs_validate_fields(inode, vattr); | 461 | xfs_validate_fields(inode, &vattr); |
478 | } | 462 | } |
479 | kfree(vattr); | ||
480 | return -error; | 463 | return -error; |
481 | } | 464 | } |
482 | 465 | ||
@@ -487,7 +470,7 @@ xfs_vn_symlink( | |||
487 | const char *symname) | 470 | const char *symname) |
488 | { | 471 | { |
489 | struct inode *ip; | 472 | struct inode *ip; |
490 | vattr_t *vattr; | 473 | vattr_t vattr = { 0 }; |
491 | vnode_t *dvp; /* directory containing name of symlink */ | 474 | vnode_t *dvp; /* directory containing name of symlink */ |
492 | vnode_t *cvp; /* used to lookup symlink to put in dentry */ | 475 | vnode_t *cvp; /* used to lookup symlink to put in dentry */ |
493 | int error; | 476 | int error; |
@@ -495,27 +478,21 @@ xfs_vn_symlink( | |||
495 | dvp = LINVFS_GET_VP(dir); | 478 | dvp = LINVFS_GET_VP(dir); |
496 | cvp = NULL; | 479 | cvp = NULL; |
497 | 480 | ||
498 | vattr = kmalloc(sizeof(*vattr), GFP_KERNEL); | 481 | vattr.va_mode = S_IFLNK | |
499 | if (unlikely(!vattr)) | ||
500 | return -ENOMEM; | ||
501 | |||
502 | memset(vattr, 0, sizeof(*vattr)); | ||
503 | vattr->va_mode = S_IFLNK | | ||
504 | (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO); | 482 | (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO); |
505 | vattr->va_mask = XFS_AT_TYPE|XFS_AT_MODE; | 483 | vattr.va_mask = XFS_AT_TYPE|XFS_AT_MODE; |
506 | 484 | ||
507 | error = 0; | 485 | error = 0; |
508 | VOP_SYMLINK(dvp, dentry, vattr, (char *)symname, &cvp, NULL, error); | 486 | VOP_SYMLINK(dvp, dentry, &vattr, (char *)symname, &cvp, NULL, error); |
509 | if (likely(!error && cvp)) { | 487 | if (likely(!error && cvp)) { |
510 | error = xfs_init_security(cvp, dir); | 488 | error = xfs_init_security(cvp, dir); |
511 | if (likely(!error)) { | 489 | if (likely(!error)) { |
512 | ip = LINVFS_GET_IP(cvp); | 490 | ip = LINVFS_GET_IP(cvp); |
513 | d_instantiate(dentry, ip); | 491 | d_instantiate(dentry, ip); |
514 | xfs_validate_fields(dir, vattr); | 492 | xfs_validate_fields(dir, &vattr); |
515 | xfs_validate_fields(ip, vattr); | 493 | xfs_validate_fields(ip, &vattr); |
516 | } | 494 | } |
517 | } | 495 | } |
518 | kfree(vattr); | ||
519 | return -error; | 496 | return -error; |
520 | } | 497 | } |
521 | 498 | ||
@@ -526,19 +503,14 @@ xfs_vn_rmdir( | |||
526 | { | 503 | { |
527 | struct inode *inode = dentry->d_inode; | 504 | struct inode *inode = dentry->d_inode; |
528 | vnode_t *dvp = LINVFS_GET_VP(dir); | 505 | vnode_t *dvp = LINVFS_GET_VP(dir); |
529 | vattr_t *vattr; | 506 | vattr_t vattr; |
530 | int error; | 507 | int error; |
531 | 508 | ||
532 | vattr = kmalloc(sizeof(*vattr), GFP_KERNEL); | ||
533 | if (unlikely(!vattr)) | ||
534 | return -ENOMEM; | ||
535 | |||
536 | VOP_RMDIR(dvp, dentry, NULL, error); | 509 | VOP_RMDIR(dvp, dentry, NULL, error); |
537 | if (likely(!error)) { | 510 | if (likely(!error)) { |
538 | xfs_validate_fields(inode, vattr); | 511 | xfs_validate_fields(inode, &vattr); |
539 | xfs_validate_fields(dir, vattr); | 512 | xfs_validate_fields(dir, &vattr); |
540 | } | 513 | } |
541 | kfree(vattr); | ||
542 | return -error; | 514 | return -error; |
543 | } | 515 | } |
544 | 516 | ||
@@ -552,25 +524,20 @@ xfs_vn_rename( | |||
552 | struct inode *new_inode = ndentry->d_inode; | 524 | struct inode *new_inode = ndentry->d_inode; |
553 | vnode_t *fvp; /* from directory */ | 525 | vnode_t *fvp; /* from directory */ |
554 | vnode_t *tvp; /* target directory */ | 526 | vnode_t *tvp; /* target directory */ |
555 | vattr_t *vattr; | 527 | vattr_t vattr; |
556 | int error; | 528 | int error; |
557 | 529 | ||
558 | vattr = kmalloc(sizeof(*vattr), GFP_KERNEL); | ||
559 | if (unlikely(!vattr)) | ||
560 | return -ENOMEM; | ||
561 | |||
562 | fvp = LINVFS_GET_VP(odir); | 530 | fvp = LINVFS_GET_VP(odir); |
563 | tvp = LINVFS_GET_VP(ndir); | 531 | tvp = LINVFS_GET_VP(ndir); |
564 | 532 | ||
565 | VOP_RENAME(fvp, odentry, tvp, ndentry, NULL, error); | 533 | VOP_RENAME(fvp, odentry, tvp, ndentry, NULL, error); |
566 | if (likely(!error)) { | 534 | if (likely(!error)) { |
567 | if (new_inode) | 535 | if (new_inode) |
568 | xfs_validate_fields(new_inode, vattr); | 536 | xfs_validate_fields(new_inode, &vattr); |
569 | xfs_validate_fields(odir, vattr); | 537 | xfs_validate_fields(odir, &vattr); |
570 | if (ndir != odir) | 538 | if (ndir != odir) |
571 | xfs_validate_fields(ndir, vattr); | 539 | xfs_validate_fields(ndir, &vattr); |
572 | } | 540 | } |
573 | kfree(vattr); | ||
574 | return -error; | 541 | return -error; |
575 | } | 542 | } |
576 | 543 | ||