diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_iops.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 317 |
1 files changed, 158 insertions, 159 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index d7f6f2d8ac8e..af487437bd7e 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -106,7 +106,7 @@ xfs_ichgtime( | |||
106 | xfs_inode_t *ip, | 106 | xfs_inode_t *ip, |
107 | int flags) | 107 | int flags) |
108 | { | 108 | { |
109 | struct inode *inode = LINVFS_GET_IP(XFS_ITOV(ip)); | 109 | struct inode *inode = vn_to_inode(XFS_ITOV(ip)); |
110 | timespec_t tv; | 110 | timespec_t tv; |
111 | 111 | ||
112 | nanotime(&tv); | 112 | nanotime(&tv); |
@@ -198,22 +198,22 @@ xfs_ichgtime_fast( | |||
198 | * Pull the link count and size up from the xfs inode to the linux inode | 198 | * Pull the link count and size up from the xfs inode to the linux inode |
199 | */ | 199 | */ |
200 | STATIC void | 200 | STATIC void |
201 | validate_fields( | 201 | xfs_validate_fields( |
202 | struct inode *ip) | 202 | struct inode *ip, |
203 | struct vattr *vattr) | ||
203 | { | 204 | { |
204 | vnode_t *vp = LINVFS_GET_VP(ip); | 205 | vnode_t *vp = vn_from_inode(ip); |
205 | vattr_t va; | ||
206 | int error; | 206 | int error; |
207 | 207 | ||
208 | va.va_mask = XFS_AT_NLINK|XFS_AT_SIZE|XFS_AT_NBLOCKS; | 208 | vattr->va_mask = XFS_AT_NLINK|XFS_AT_SIZE|XFS_AT_NBLOCKS; |
209 | VOP_GETATTR(vp, &va, ATTR_LAZY, NULL, error); | 209 | VOP_GETATTR(vp, vattr, ATTR_LAZY, NULL, error); |
210 | if (likely(!error)) { | 210 | if (likely(!error)) { |
211 | ip->i_nlink = va.va_nlink; | 211 | ip->i_nlink = vattr->va_nlink; |
212 | ip->i_blocks = va.va_nblocks; | 212 | ip->i_blocks = vattr->va_nblocks; |
213 | 213 | ||
214 | /* we're under i_mutex so i_size can't change under us */ | 214 | /* we're under i_sem so i_size can't change under us */ |
215 | if (i_size_read(ip) != va.va_size) | 215 | if (i_size_read(ip) != vattr->va_size) |
216 | i_size_write(ip, va.va_size); | 216 | i_size_write(ip, vattr->va_size); |
217 | } | 217 | } |
218 | } | 218 | } |
219 | 219 | ||
@@ -224,11 +224,11 @@ validate_fields( | |||
224 | * inode, of course, such that log replay can't cause these to be lost). | 224 | * inode, of course, such that log replay can't cause these to be lost). |
225 | */ | 225 | */ |
226 | STATIC int | 226 | STATIC int |
227 | linvfs_init_security( | 227 | xfs_init_security( |
228 | struct vnode *vp, | 228 | struct vnode *vp, |
229 | struct inode *dir) | 229 | struct inode *dir) |
230 | { | 230 | { |
231 | struct inode *ip = LINVFS_GET_IP(vp); | 231 | struct inode *ip = vn_to_inode(vp); |
232 | size_t length; | 232 | size_t length; |
233 | void *value; | 233 | void *value; |
234 | char *name; | 234 | char *name; |
@@ -257,46 +257,46 @@ linvfs_init_security( | |||
257 | * XXX(hch): nfsd is broken, better fix it instead. | 257 | * XXX(hch): nfsd is broken, better fix it instead. |
258 | */ | 258 | */ |
259 | STATIC inline int | 259 | STATIC inline int |
260 | has_fs_struct(struct task_struct *task) | 260 | xfs_has_fs_struct(struct task_struct *task) |
261 | { | 261 | { |
262 | return (task->fs != init_task.fs); | 262 | return (task->fs != init_task.fs); |
263 | } | 263 | } |
264 | 264 | ||
265 | STATIC inline void | 265 | STATIC inline void |
266 | cleanup_inode( | 266 | xfs_cleanup_inode( |
267 | vnode_t *dvp, | 267 | vnode_t *dvp, |
268 | vnode_t *vp, | 268 | vnode_t *vp, |
269 | struct dentry *dentry, | 269 | struct dentry *dentry, |
270 | int mode) | 270 | int mode) |
271 | { | 271 | { |
272 | struct dentry teardown = {}; | 272 | struct dentry teardown = {}; |
273 | int err2; | 273 | int error; |
274 | 274 | ||
275 | /* Oh, the horror. | 275 | /* Oh, the horror. |
276 | * If we can't add the ACL or we fail in | 276 | * If we can't add the ACL or we fail in |
277 | * linvfs_init_security we must back out. | 277 | * xfs_init_security we must back out. |
278 | * ENOSPC can hit here, among other things. | 278 | * ENOSPC can hit here, among other things. |
279 | */ | 279 | */ |
280 | teardown.d_inode = LINVFS_GET_IP(vp); | 280 | teardown.d_inode = vn_to_inode(vp); |
281 | teardown.d_name = dentry->d_name; | 281 | teardown.d_name = dentry->d_name; |
282 | 282 | ||
283 | if (S_ISDIR(mode)) | 283 | if (S_ISDIR(mode)) |
284 | VOP_RMDIR(dvp, &teardown, NULL, err2); | 284 | VOP_RMDIR(dvp, &teardown, NULL, error); |
285 | else | 285 | else |
286 | VOP_REMOVE(dvp, &teardown, NULL, err2); | 286 | VOP_REMOVE(dvp, &teardown, NULL, error); |
287 | VN_RELE(vp); | 287 | VN_RELE(vp); |
288 | } | 288 | } |
289 | 289 | ||
290 | STATIC int | 290 | STATIC int |
291 | linvfs_mknod( | 291 | xfs_vn_mknod( |
292 | struct inode *dir, | 292 | struct inode *dir, |
293 | struct dentry *dentry, | 293 | struct dentry *dentry, |
294 | int mode, | 294 | int mode, |
295 | dev_t rdev) | 295 | dev_t rdev) |
296 | { | 296 | { |
297 | struct inode *ip; | 297 | struct inode *ip; |
298 | vattr_t va; | 298 | vattr_t vattr = { 0 }; |
299 | vnode_t *vp = NULL, *dvp = LINVFS_GET_VP(dir); | 299 | vnode_t *vp = NULL, *dvp = vn_from_inode(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; |
302 | int error; | 302 | int error; |
@@ -305,99 +305,98 @@ linvfs_mknod( | |||
305 | * Irix uses Missed'em'V split, but doesn't want to see | 305 | * Irix uses Missed'em'V split, but doesn't want to see |
306 | * the upper 5 bits of (14bit) major. | 306 | * the upper 5 bits of (14bit) major. |
307 | */ | 307 | */ |
308 | if (!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 | if (test_default_acl && test_default_acl(dvp)) { | 311 | if (unlikely(test_default_acl && test_default_acl(dvp))) { |
312 | if (!_ACL_ALLOC(default_acl)) | 312 | if (!_ACL_ALLOC(default_acl)) { |
313 | return -ENOMEM; | 313 | return -ENOMEM; |
314 | } | ||
314 | if (!_ACL_GET_DEFAULT(dvp, default_acl)) { | 315 | if (!_ACL_GET_DEFAULT(dvp, default_acl)) { |
315 | _ACL_FREE(default_acl); | 316 | _ACL_FREE(default_acl); |
316 | default_acl = NULL; | 317 | default_acl = NULL; |
317 | } | 318 | } |
318 | } | 319 | } |
319 | 320 | ||
320 | if (IS_POSIXACL(dir) && !default_acl && has_fs_struct(current)) | 321 | if (IS_POSIXACL(dir) && !default_acl && xfs_has_fs_struct(current)) |
321 | mode &= ~current->fs->umask; | 322 | mode &= ~current->fs->umask; |
322 | 323 | ||
323 | memset(&va, 0, sizeof(va)); | 324 | vattr.va_mask = XFS_AT_TYPE|XFS_AT_MODE; |
324 | va.va_mask = XFS_AT_TYPE|XFS_AT_MODE; | 325 | vattr.va_mode = mode; |
325 | va.va_mode = mode; | ||
326 | 326 | ||
327 | switch (mode & S_IFMT) { | 327 | switch (mode & S_IFMT) { |
328 | 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: |
329 | va.va_rdev = sysv_encode_dev(rdev); | 329 | vattr.va_rdev = sysv_encode_dev(rdev); |
330 | va.va_mask |= XFS_AT_RDEV; | 330 | vattr.va_mask |= XFS_AT_RDEV; |
331 | /*FALLTHROUGH*/ | 331 | /*FALLTHROUGH*/ |
332 | case S_IFREG: | 332 | case S_IFREG: |
333 | VOP_CREATE(dvp, dentry, &va, &vp, NULL, error); | 333 | VOP_CREATE(dvp, dentry, &vattr, &vp, NULL, error); |
334 | break; | 334 | break; |
335 | case S_IFDIR: | 335 | case S_IFDIR: |
336 | VOP_MKDIR(dvp, dentry, &va, &vp, NULL, error); | 336 | VOP_MKDIR(dvp, dentry, &vattr, &vp, NULL, error); |
337 | break; | 337 | break; |
338 | default: | 338 | default: |
339 | error = EINVAL; | 339 | error = EINVAL; |
340 | break; | 340 | break; |
341 | } | 341 | } |
342 | 342 | ||
343 | if (!error) | 343 | if (unlikely(!error)) { |
344 | { | 344 | error = xfs_init_security(vp, dir); |
345 | error = linvfs_init_security(vp, dir); | ||
346 | if (error) | 345 | if (error) |
347 | cleanup_inode(dvp, vp, dentry, mode); | 346 | xfs_cleanup_inode(dvp, vp, dentry, mode); |
348 | } | 347 | } |
349 | 348 | ||
350 | if (default_acl) { | 349 | if (unlikely(default_acl)) { |
351 | if (!error) { | 350 | if (!error) { |
352 | error = _ACL_INHERIT(vp, &va, default_acl); | 351 | error = _ACL_INHERIT(vp, &vattr, default_acl); |
353 | if (!error) | 352 | if (!error) |
354 | VMODIFY(vp); | 353 | VMODIFY(vp); |
355 | else | 354 | else |
356 | cleanup_inode(dvp, vp, dentry, mode); | 355 | xfs_cleanup_inode(dvp, vp, dentry, mode); |
357 | } | 356 | } |
358 | _ACL_FREE(default_acl); | 357 | _ACL_FREE(default_acl); |
359 | } | 358 | } |
360 | 359 | ||
361 | if (!error) { | 360 | if (likely(!error)) { |
362 | ASSERT(vp); | 361 | ASSERT(vp); |
363 | ip = LINVFS_GET_IP(vp); | 362 | ip = vn_to_inode(vp); |
364 | 363 | ||
365 | if (S_ISCHR(mode) || S_ISBLK(mode)) | 364 | if (S_ISCHR(mode) || S_ISBLK(mode)) |
366 | ip->i_rdev = rdev; | 365 | ip->i_rdev = rdev; |
367 | else if (S_ISDIR(mode)) | 366 | else if (S_ISDIR(mode)) |
368 | validate_fields(ip); | 367 | xfs_validate_fields(ip, &vattr); |
369 | d_instantiate(dentry, ip); | 368 | d_instantiate(dentry, ip); |
370 | validate_fields(dir); | 369 | xfs_validate_fields(dir, &vattr); |
371 | } | 370 | } |
372 | return -error; | 371 | return -error; |
373 | } | 372 | } |
374 | 373 | ||
375 | STATIC int | 374 | STATIC int |
376 | linvfs_create( | 375 | xfs_vn_create( |
377 | struct inode *dir, | 376 | struct inode *dir, |
378 | struct dentry *dentry, | 377 | struct dentry *dentry, |
379 | int mode, | 378 | int mode, |
380 | struct nameidata *nd) | 379 | struct nameidata *nd) |
381 | { | 380 | { |
382 | return linvfs_mknod(dir, dentry, mode, 0); | 381 | return xfs_vn_mknod(dir, dentry, mode, 0); |
383 | } | 382 | } |
384 | 383 | ||
385 | STATIC int | 384 | STATIC int |
386 | linvfs_mkdir( | 385 | xfs_vn_mkdir( |
387 | struct inode *dir, | 386 | struct inode *dir, |
388 | struct dentry *dentry, | 387 | struct dentry *dentry, |
389 | int mode) | 388 | int mode) |
390 | { | 389 | { |
391 | return linvfs_mknod(dir, dentry, mode|S_IFDIR, 0); | 390 | return xfs_vn_mknod(dir, dentry, mode|S_IFDIR, 0); |
392 | } | 391 | } |
393 | 392 | ||
394 | STATIC struct dentry * | 393 | STATIC struct dentry * |
395 | linvfs_lookup( | 394 | xfs_vn_lookup( |
396 | struct inode *dir, | 395 | struct inode *dir, |
397 | struct dentry *dentry, | 396 | struct dentry *dentry, |
398 | struct nameidata *nd) | 397 | struct nameidata *nd) |
399 | { | 398 | { |
400 | struct vnode *vp = LINVFS_GET_VP(dir), *cvp; | 399 | struct vnode *vp = vn_from_inode(dir), *cvp; |
401 | int error; | 400 | int error; |
402 | 401 | ||
403 | if (dentry->d_name.len >= MAXNAMELEN) | 402 | if (dentry->d_name.len >= MAXNAMELEN) |
@@ -411,11 +410,11 @@ linvfs_lookup( | |||
411 | return NULL; | 410 | return NULL; |
412 | } | 411 | } |
413 | 412 | ||
414 | return d_splice_alias(LINVFS_GET_IP(cvp), dentry); | 413 | return d_splice_alias(vn_to_inode(cvp), dentry); |
415 | } | 414 | } |
416 | 415 | ||
417 | STATIC int | 416 | STATIC int |
418 | linvfs_link( | 417 | xfs_vn_link( |
419 | struct dentry *old_dentry, | 418 | struct dentry *old_dentry, |
420 | struct inode *dir, | 419 | struct inode *dir, |
421 | struct dentry *dentry) | 420 | struct dentry *dentry) |
@@ -423,99 +422,102 @@ linvfs_link( | |||
423 | struct inode *ip; /* inode of guy being linked to */ | 422 | struct inode *ip; /* inode of guy being linked to */ |
424 | vnode_t *tdvp; /* target directory for new name/link */ | 423 | vnode_t *tdvp; /* target directory for new name/link */ |
425 | vnode_t *vp; /* vp of name being linked */ | 424 | vnode_t *vp; /* vp of name being linked */ |
425 | vattr_t vattr; | ||
426 | int error; | 426 | int error; |
427 | 427 | ||
428 | ip = old_dentry->d_inode; /* inode being linked to */ | 428 | ip = old_dentry->d_inode; /* inode being linked to */ |
429 | if (S_ISDIR(ip->i_mode)) | 429 | if (S_ISDIR(ip->i_mode)) |
430 | return -EPERM; | 430 | return -EPERM; |
431 | 431 | ||
432 | tdvp = LINVFS_GET_VP(dir); | 432 | tdvp = vn_from_inode(dir); |
433 | vp = LINVFS_GET_VP(ip); | 433 | vp = vn_from_inode(ip); |
434 | 434 | ||
435 | VOP_LINK(tdvp, vp, dentry, NULL, error); | 435 | VOP_LINK(tdvp, vp, dentry, NULL, error); |
436 | if (!error) { | 436 | if (likely(!error)) { |
437 | VMODIFY(tdvp); | 437 | VMODIFY(tdvp); |
438 | VN_HOLD(vp); | 438 | VN_HOLD(vp); |
439 | validate_fields(ip); | 439 | xfs_validate_fields(ip, &vattr); |
440 | d_instantiate(dentry, ip); | 440 | d_instantiate(dentry, ip); |
441 | } | 441 | } |
442 | return -error; | 442 | return -error; |
443 | } | 443 | } |
444 | 444 | ||
445 | STATIC int | 445 | STATIC int |
446 | linvfs_unlink( | 446 | xfs_vn_unlink( |
447 | struct inode *dir, | 447 | struct inode *dir, |
448 | struct dentry *dentry) | 448 | struct dentry *dentry) |
449 | { | 449 | { |
450 | struct inode *inode; | 450 | struct inode *inode; |
451 | vnode_t *dvp; /* directory containing name to remove */ | 451 | vnode_t *dvp; /* directory containing name to remove */ |
452 | vattr_t vattr; | ||
452 | int error; | 453 | int error; |
453 | 454 | ||
454 | inode = dentry->d_inode; | 455 | inode = dentry->d_inode; |
455 | dvp = LINVFS_GET_VP(dir); | 456 | dvp = vn_from_inode(dir); |
456 | 457 | ||
457 | VOP_REMOVE(dvp, dentry, NULL, error); | 458 | VOP_REMOVE(dvp, dentry, NULL, error); |
458 | if (!error) { | 459 | if (likely(!error)) { |
459 | validate_fields(dir); /* For size only */ | 460 | xfs_validate_fields(dir, &vattr); /* size needs update */ |
460 | validate_fields(inode); | 461 | xfs_validate_fields(inode, &vattr); |
461 | } | 462 | } |
462 | |||
463 | return -error; | 463 | return -error; |
464 | } | 464 | } |
465 | 465 | ||
466 | STATIC int | 466 | STATIC int |
467 | linvfs_symlink( | 467 | xfs_vn_symlink( |
468 | struct inode *dir, | 468 | struct inode *dir, |
469 | struct dentry *dentry, | 469 | struct dentry *dentry, |
470 | const char *symname) | 470 | const char *symname) |
471 | { | 471 | { |
472 | struct inode *ip; | 472 | struct inode *ip; |
473 | vattr_t va; | 473 | vattr_t vattr = { 0 }; |
474 | vnode_t *dvp; /* directory containing name of symlink */ | 474 | vnode_t *dvp; /* directory containing name of symlink */ |
475 | vnode_t *cvp; /* used to lookup symlink to put in dentry */ | 475 | vnode_t *cvp; /* used to lookup symlink to put in dentry */ |
476 | int error; | 476 | int error; |
477 | 477 | ||
478 | dvp = LINVFS_GET_VP(dir); | 478 | dvp = vn_from_inode(dir); |
479 | cvp = NULL; | 479 | cvp = NULL; |
480 | 480 | ||
481 | memset(&va, 0, sizeof(va)); | 481 | vattr.va_mode = S_IFLNK | |
482 | va.va_mode = S_IFLNK | | ||
483 | (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO); | 482 | (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO); |
484 | va.va_mask = XFS_AT_TYPE|XFS_AT_MODE; | 483 | vattr.va_mask = XFS_AT_TYPE|XFS_AT_MODE; |
485 | 484 | ||
486 | error = 0; | 485 | error = 0; |
487 | VOP_SYMLINK(dvp, dentry, &va, (char *)symname, &cvp, NULL, error); | 486 | VOP_SYMLINK(dvp, dentry, &vattr, (char *)symname, &cvp, NULL, error); |
488 | if (likely(!error && cvp)) { | 487 | if (likely(!error && cvp)) { |
489 | error = linvfs_init_security(cvp, dir); | 488 | error = xfs_init_security(cvp, dir); |
490 | if (likely(!error)) { | 489 | if (likely(!error)) { |
491 | ip = LINVFS_GET_IP(cvp); | 490 | ip = vn_to_inode(cvp); |
492 | d_instantiate(dentry, ip); | 491 | d_instantiate(dentry, ip); |
493 | validate_fields(dir); | 492 | xfs_validate_fields(dir, &vattr); |
494 | validate_fields(ip); | 493 | xfs_validate_fields(ip, &vattr); |
494 | } else { | ||
495 | xfs_cleanup_inode(dvp, cvp, dentry, 0); | ||
495 | } | 496 | } |
496 | } | 497 | } |
497 | return -error; | 498 | return -error; |
498 | } | 499 | } |
499 | 500 | ||
500 | STATIC int | 501 | STATIC int |
501 | linvfs_rmdir( | 502 | xfs_vn_rmdir( |
502 | struct inode *dir, | 503 | struct inode *dir, |
503 | struct dentry *dentry) | 504 | struct dentry *dentry) |
504 | { | 505 | { |
505 | struct inode *inode = dentry->d_inode; | 506 | struct inode *inode = dentry->d_inode; |
506 | vnode_t *dvp = LINVFS_GET_VP(dir); | 507 | vnode_t *dvp = vn_from_inode(dir); |
508 | vattr_t vattr; | ||
507 | int error; | 509 | int error; |
508 | 510 | ||
509 | VOP_RMDIR(dvp, dentry, NULL, error); | 511 | VOP_RMDIR(dvp, dentry, NULL, error); |
510 | if (!error) { | 512 | if (likely(!error)) { |
511 | validate_fields(inode); | 513 | xfs_validate_fields(inode, &vattr); |
512 | validate_fields(dir); | 514 | xfs_validate_fields(dir, &vattr); |
513 | } | 515 | } |
514 | return -error; | 516 | return -error; |
515 | } | 517 | } |
516 | 518 | ||
517 | STATIC int | 519 | STATIC int |
518 | linvfs_rename( | 520 | xfs_vn_rename( |
519 | struct inode *odir, | 521 | struct inode *odir, |
520 | struct dentry *odentry, | 522 | struct dentry *odentry, |
521 | struct inode *ndir, | 523 | struct inode *ndir, |
@@ -524,22 +526,21 @@ linvfs_rename( | |||
524 | struct inode *new_inode = ndentry->d_inode; | 526 | struct inode *new_inode = ndentry->d_inode; |
525 | vnode_t *fvp; /* from directory */ | 527 | vnode_t *fvp; /* from directory */ |
526 | vnode_t *tvp; /* target directory */ | 528 | vnode_t *tvp; /* target directory */ |
529 | vattr_t vattr; | ||
527 | int error; | 530 | int error; |
528 | 531 | ||
529 | fvp = LINVFS_GET_VP(odir); | 532 | fvp = vn_from_inode(odir); |
530 | tvp = LINVFS_GET_VP(ndir); | 533 | tvp = vn_from_inode(ndir); |
531 | 534 | ||
532 | VOP_RENAME(fvp, odentry, tvp, ndentry, NULL, error); | 535 | VOP_RENAME(fvp, odentry, tvp, ndentry, NULL, error); |
533 | if (error) | 536 | if (likely(!error)) { |
534 | return -error; | 537 | if (new_inode) |
535 | 538 | xfs_validate_fields(new_inode, &vattr); | |
536 | if (new_inode) | 539 | xfs_validate_fields(odir, &vattr); |
537 | validate_fields(new_inode); | 540 | if (ndir != odir) |
538 | 541 | xfs_validate_fields(ndir, &vattr); | |
539 | validate_fields(odir); | 542 | } |
540 | if (ndir != odir) | 543 | return -error; |
541 | validate_fields(ndir); | ||
542 | return 0; | ||
543 | } | 544 | } |
544 | 545 | ||
545 | /* | 546 | /* |
@@ -548,7 +549,7 @@ linvfs_rename( | |||
548 | * uio is kmalloced for this reason... | 549 | * uio is kmalloced for this reason... |
549 | */ | 550 | */ |
550 | STATIC void * | 551 | STATIC void * |
551 | linvfs_follow_link( | 552 | xfs_vn_follow_link( |
552 | struct dentry *dentry, | 553 | struct dentry *dentry, |
553 | struct nameidata *nd) | 554 | struct nameidata *nd) |
554 | { | 555 | { |
@@ -574,7 +575,7 @@ linvfs_follow_link( | |||
574 | return NULL; | 575 | return NULL; |
575 | } | 576 | } |
576 | 577 | ||
577 | vp = LINVFS_GET_VP(dentry->d_inode); | 578 | vp = vn_from_inode(dentry->d_inode); |
578 | 579 | ||
579 | iov.iov_base = link; | 580 | iov.iov_base = link; |
580 | iov.iov_len = MAXPATHLEN; | 581 | iov.iov_len = MAXPATHLEN; |
@@ -599,7 +600,7 @@ linvfs_follow_link( | |||
599 | } | 600 | } |
600 | 601 | ||
601 | STATIC void | 602 | STATIC void |
602 | linvfs_put_link( | 603 | xfs_vn_put_link( |
603 | struct dentry *dentry, | 604 | struct dentry *dentry, |
604 | struct nameidata *nd, | 605 | struct nameidata *nd, |
605 | void *p) | 606 | void *p) |
@@ -612,12 +613,12 @@ linvfs_put_link( | |||
612 | 613 | ||
613 | #ifdef CONFIG_XFS_POSIX_ACL | 614 | #ifdef CONFIG_XFS_POSIX_ACL |
614 | STATIC int | 615 | STATIC int |
615 | linvfs_permission( | 616 | xfs_vn_permission( |
616 | struct inode *inode, | 617 | struct inode *inode, |
617 | int mode, | 618 | int mode, |
618 | struct nameidata *nd) | 619 | struct nameidata *nd) |
619 | { | 620 | { |
620 | vnode_t *vp = LINVFS_GET_VP(inode); | 621 | vnode_t *vp = vn_from_inode(inode); |
621 | int error; | 622 | int error; |
622 | 623 | ||
623 | mode <<= 6; /* convert from linux to vnode access bits */ | 624 | mode <<= 6; /* convert from linux to vnode access bits */ |
@@ -625,17 +626,17 @@ linvfs_permission( | |||
625 | return -error; | 626 | return -error; |
626 | } | 627 | } |
627 | #else | 628 | #else |
628 | #define linvfs_permission NULL | 629 | #define xfs_vn_permission NULL |
629 | #endif | 630 | #endif |
630 | 631 | ||
631 | STATIC int | 632 | STATIC int |
632 | linvfs_getattr( | 633 | xfs_vn_getattr( |
633 | struct vfsmount *mnt, | 634 | struct vfsmount *mnt, |
634 | struct dentry *dentry, | 635 | struct dentry *dentry, |
635 | struct kstat *stat) | 636 | struct kstat *stat) |
636 | { | 637 | { |
637 | struct inode *inode = dentry->d_inode; | 638 | struct inode *inode = dentry->d_inode; |
638 | vnode_t *vp = LINVFS_GET_VP(inode); | 639 | vnode_t *vp = vn_from_inode(inode); |
639 | int error = 0; | 640 | int error = 0; |
640 | 641 | ||
641 | if (unlikely(vp->v_flag & VMODIFIED)) | 642 | if (unlikely(vp->v_flag & VMODIFIED)) |
@@ -646,18 +647,17 @@ linvfs_getattr( | |||
646 | } | 647 | } |
647 | 648 | ||
648 | STATIC int | 649 | STATIC int |
649 | linvfs_setattr( | 650 | xfs_vn_setattr( |
650 | struct dentry *dentry, | 651 | struct dentry *dentry, |
651 | struct iattr *attr) | 652 | struct iattr *attr) |
652 | { | 653 | { |
653 | struct inode *inode = dentry->d_inode; | 654 | struct inode *inode = dentry->d_inode; |
654 | unsigned int ia_valid = attr->ia_valid; | 655 | unsigned int ia_valid = attr->ia_valid; |
655 | vnode_t *vp = LINVFS_GET_VP(inode); | 656 | vnode_t *vp = vn_from_inode(inode); |
656 | vattr_t vattr; | 657 | vattr_t vattr = { 0 }; |
657 | int flags = 0; | 658 | int flags = 0; |
658 | int error; | 659 | int error; |
659 | 660 | ||
660 | memset(&vattr, 0, sizeof(vattr_t)); | ||
661 | if (ia_valid & ATTR_UID) { | 661 | if (ia_valid & ATTR_UID) { |
662 | vattr.va_mask |= XFS_AT_UID; | 662 | vattr.va_mask |= XFS_AT_UID; |
663 | vattr.va_uid = attr->ia_uid; | 663 | vattr.va_uid = attr->ia_uid; |
@@ -699,28 +699,27 @@ linvfs_setattr( | |||
699 | #endif | 699 | #endif |
700 | 700 | ||
701 | VOP_SETATTR(vp, &vattr, flags, NULL, error); | 701 | VOP_SETATTR(vp, &vattr, flags, NULL, error); |
702 | if (error) | 702 | if (likely(!error)) |
703 | return -error; | 703 | __vn_revalidate(vp, &vattr); |
704 | vn_revalidate(vp); | 704 | return -error; |
705 | return error; | ||
706 | } | 705 | } |
707 | 706 | ||
708 | STATIC void | 707 | STATIC void |
709 | linvfs_truncate( | 708 | xfs_vn_truncate( |
710 | struct inode *inode) | 709 | struct inode *inode) |
711 | { | 710 | { |
712 | block_truncate_page(inode->i_mapping, inode->i_size, linvfs_get_block); | 711 | block_truncate_page(inode->i_mapping, inode->i_size, xfs_get_block); |
713 | } | 712 | } |
714 | 713 | ||
715 | STATIC int | 714 | STATIC int |
716 | linvfs_setxattr( | 715 | xfs_vn_setxattr( |
717 | struct dentry *dentry, | 716 | struct dentry *dentry, |
718 | const char *name, | 717 | const char *name, |
719 | const void *data, | 718 | const void *data, |
720 | size_t size, | 719 | size_t size, |
721 | int flags) | 720 | int flags) |
722 | { | 721 | { |
723 | vnode_t *vp = LINVFS_GET_VP(dentry->d_inode); | 722 | vnode_t *vp = vn_from_inode(dentry->d_inode); |
724 | char *attr = (char *)name; | 723 | char *attr = (char *)name; |
725 | attrnames_t *namesp; | 724 | attrnames_t *namesp; |
726 | int xflags = 0; | 725 | int xflags = 0; |
@@ -744,13 +743,13 @@ linvfs_setxattr( | |||
744 | } | 743 | } |
745 | 744 | ||
746 | STATIC ssize_t | 745 | STATIC ssize_t |
747 | linvfs_getxattr( | 746 | xfs_vn_getxattr( |
748 | struct dentry *dentry, | 747 | struct dentry *dentry, |
749 | const char *name, | 748 | const char *name, |
750 | void *data, | 749 | void *data, |
751 | size_t size) | 750 | size_t size) |
752 | { | 751 | { |
753 | vnode_t *vp = LINVFS_GET_VP(dentry->d_inode); | 752 | vnode_t *vp = vn_from_inode(dentry->d_inode); |
754 | char *attr = (char *)name; | 753 | char *attr = (char *)name; |
755 | attrnames_t *namesp; | 754 | attrnames_t *namesp; |
756 | int xflags = 0; | 755 | int xflags = 0; |
@@ -774,12 +773,12 @@ linvfs_getxattr( | |||
774 | } | 773 | } |
775 | 774 | ||
776 | STATIC ssize_t | 775 | STATIC ssize_t |
777 | linvfs_listxattr( | 776 | xfs_vn_listxattr( |
778 | struct dentry *dentry, | 777 | struct dentry *dentry, |
779 | char *data, | 778 | char *data, |
780 | size_t size) | 779 | size_t size) |
781 | { | 780 | { |
782 | vnode_t *vp = LINVFS_GET_VP(dentry->d_inode); | 781 | vnode_t *vp = vn_from_inode(dentry->d_inode); |
783 | int error, xflags = ATTR_KERNAMELS; | 782 | int error, xflags = ATTR_KERNAMELS; |
784 | ssize_t result; | 783 | ssize_t result; |
785 | 784 | ||
@@ -794,11 +793,11 @@ linvfs_listxattr( | |||
794 | } | 793 | } |
795 | 794 | ||
796 | STATIC int | 795 | STATIC int |
797 | linvfs_removexattr( | 796 | xfs_vn_removexattr( |
798 | struct dentry *dentry, | 797 | struct dentry *dentry, |
799 | const char *name) | 798 | const char *name) |
800 | { | 799 | { |
801 | vnode_t *vp = LINVFS_GET_VP(dentry->d_inode); | 800 | vnode_t *vp = vn_from_inode(dentry->d_inode); |
802 | char *attr = (char *)name; | 801 | char *attr = (char *)name; |
803 | attrnames_t *namesp; | 802 | attrnames_t *namesp; |
804 | int xflags = 0; | 803 | int xflags = 0; |
@@ -816,45 +815,45 @@ linvfs_removexattr( | |||
816 | } | 815 | } |
817 | 816 | ||
818 | 817 | ||
819 | struct inode_operations linvfs_file_inode_operations = { | 818 | struct inode_operations xfs_inode_operations = { |
820 | .permission = linvfs_permission, | 819 | .permission = xfs_vn_permission, |
821 | .truncate = linvfs_truncate, | 820 | .truncate = xfs_vn_truncate, |
822 | .getattr = linvfs_getattr, | 821 | .getattr = xfs_vn_getattr, |
823 | .setattr = linvfs_setattr, | 822 | .setattr = xfs_vn_setattr, |
824 | .setxattr = linvfs_setxattr, | 823 | .setxattr = xfs_vn_setxattr, |
825 | .getxattr = linvfs_getxattr, | 824 | .getxattr = xfs_vn_getxattr, |
826 | .listxattr = linvfs_listxattr, | 825 | .listxattr = xfs_vn_listxattr, |
827 | .removexattr = linvfs_removexattr, | 826 | .removexattr = xfs_vn_removexattr, |
828 | }; | 827 | }; |
829 | 828 | ||
830 | struct inode_operations linvfs_dir_inode_operations = { | 829 | struct inode_operations xfs_dir_inode_operations = { |
831 | .create = linvfs_create, | 830 | .create = xfs_vn_create, |
832 | .lookup = linvfs_lookup, | 831 | .lookup = xfs_vn_lookup, |
833 | .link = linvfs_link, | 832 | .link = xfs_vn_link, |
834 | .unlink = linvfs_unlink, | 833 | .unlink = xfs_vn_unlink, |
835 | .symlink = linvfs_symlink, | 834 | .symlink = xfs_vn_symlink, |
836 | .mkdir = linvfs_mkdir, | 835 | .mkdir = xfs_vn_mkdir, |
837 | .rmdir = linvfs_rmdir, | 836 | .rmdir = xfs_vn_rmdir, |
838 | .mknod = linvfs_mknod, | 837 | .mknod = xfs_vn_mknod, |
839 | .rename = linvfs_rename, | 838 | .rename = xfs_vn_rename, |
840 | .permission = linvfs_permission, | 839 | .permission = xfs_vn_permission, |
841 | .getattr = linvfs_getattr, | 840 | .getattr = xfs_vn_getattr, |
842 | .setattr = linvfs_setattr, | 841 | .setattr = xfs_vn_setattr, |
843 | .setxattr = linvfs_setxattr, | 842 | .setxattr = xfs_vn_setxattr, |
844 | .getxattr = linvfs_getxattr, | 843 | .getxattr = xfs_vn_getxattr, |
845 | .listxattr = linvfs_listxattr, | 844 | .listxattr = xfs_vn_listxattr, |
846 | .removexattr = linvfs_removexattr, | 845 | .removexattr = xfs_vn_removexattr, |
847 | }; | 846 | }; |
848 | 847 | ||
849 | struct inode_operations linvfs_symlink_inode_operations = { | 848 | struct inode_operations xfs_symlink_inode_operations = { |
850 | .readlink = generic_readlink, | 849 | .readlink = generic_readlink, |
851 | .follow_link = linvfs_follow_link, | 850 | .follow_link = xfs_vn_follow_link, |
852 | .put_link = linvfs_put_link, | 851 | .put_link = xfs_vn_put_link, |
853 | .permission = linvfs_permission, | 852 | .permission = xfs_vn_permission, |
854 | .getattr = linvfs_getattr, | 853 | .getattr = xfs_vn_getattr, |
855 | .setattr = linvfs_setattr, | 854 | .setattr = xfs_vn_setattr, |
856 | .setxattr = linvfs_setxattr, | 855 | .setxattr = xfs_vn_setxattr, |
857 | .getxattr = linvfs_getxattr, | 856 | .getxattr = xfs_vn_getxattr, |
858 | .listxattr = linvfs_listxattr, | 857 | .listxattr = xfs_vn_listxattr, |
859 | .removexattr = linvfs_removexattr, | 858 | .removexattr = xfs_vn_removexattr, |
860 | }; | 859 | }; |