aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/acl.c87
-rw-r--r--fs/ocfs2/alloc.c16
-rw-r--r--fs/ocfs2/alloc.h5
-rw-r--r--fs/ocfs2/aops.c34
-rw-r--r--fs/ocfs2/blockcheck.c2
-rw-r--r--fs/ocfs2/cluster/netdebug.c8
-rw-r--r--fs/ocfs2/dlm/dlmmaster.c2
-rw-r--r--fs/ocfs2/dlmglue.c2
-rw-r--r--fs/ocfs2/file.c2
-rw-r--r--fs/ocfs2/journal.c2
-rw-r--r--fs/ocfs2/namei.c5
-rw-r--r--fs/ocfs2/ocfs2.h7
-rw-r--r--fs/ocfs2/quota.h4
-rw-r--r--fs/ocfs2/quota_local.c2
-rw-r--r--fs/ocfs2/refcounttree.c152
-rw-r--r--fs/ocfs2/stackglue.c15
-rw-r--r--fs/ocfs2/super.c4
-rw-r--r--fs/ocfs2/uptodate.c5
-rw-r--r--fs/ocfs2/xattr.c72
19 files changed, 219 insertions, 207 deletions
diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
index 200b88109b29..0501974bedd0 100644
--- a/fs/ocfs2/acl.c
+++ b/fs/ocfs2/acl.c
@@ -327,13 +327,14 @@ cleanup:
327 return ret; 327 return ret;
328} 328}
329 329
330static size_t ocfs2_xattr_list_acl_access(struct inode *inode, 330static size_t ocfs2_xattr_list_acl_access(struct dentry *dentry,
331 char *list, 331 char *list,
332 size_t list_len, 332 size_t list_len,
333 const char *name, 333 const char *name,
334 size_t name_len) 334 size_t name_len,
335 int type)
335{ 336{
336 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 337 struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb);
337 const size_t size = sizeof(POSIX_ACL_XATTR_ACCESS); 338 const size_t size = sizeof(POSIX_ACL_XATTR_ACCESS);
338 339
339 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL)) 340 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
@@ -344,13 +345,14 @@ static size_t ocfs2_xattr_list_acl_access(struct inode *inode,
344 return size; 345 return size;
345} 346}
346 347
347static size_t ocfs2_xattr_list_acl_default(struct inode *inode, 348static size_t ocfs2_xattr_list_acl_default(struct dentry *dentry,
348 char *list, 349 char *list,
349 size_t list_len, 350 size_t list_len,
350 const char *name, 351 const char *name,
351 size_t name_len) 352 size_t name_len,
353 int type)
352{ 354{
353 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 355 struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb);
354 const size_t size = sizeof(POSIX_ACL_XATTR_DEFAULT); 356 const size_t size = sizeof(POSIX_ACL_XATTR_DEFAULT);
355 357
356 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL)) 358 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
@@ -361,19 +363,19 @@ static size_t ocfs2_xattr_list_acl_default(struct inode *inode,
361 return size; 363 return size;
362} 364}
363 365
364static int ocfs2_xattr_get_acl(struct inode *inode, 366static int ocfs2_xattr_get_acl(struct dentry *dentry, const char *name,
365 int type, 367 void *buffer, size_t size, int type)
366 void *buffer,
367 size_t size)
368{ 368{
369 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 369 struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb);
370 struct posix_acl *acl; 370 struct posix_acl *acl;
371 int ret; 371 int ret;
372 372
373 if (strcmp(name, "") != 0)
374 return -EINVAL;
373 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL)) 375 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
374 return -EOPNOTSUPP; 376 return -EOPNOTSUPP;
375 377
376 acl = ocfs2_get_acl(inode, type); 378 acl = ocfs2_get_acl(dentry->d_inode, type);
377 if (IS_ERR(acl)) 379 if (IS_ERR(acl))
378 return PTR_ERR(acl); 380 return PTR_ERR(acl);
379 if (acl == NULL) 381 if (acl == NULL)
@@ -384,35 +386,16 @@ static int ocfs2_xattr_get_acl(struct inode *inode,
384 return ret; 386 return ret;
385} 387}
386 388
387static int ocfs2_xattr_get_acl_access(struct inode *inode, 389static int ocfs2_xattr_set_acl(struct dentry *dentry, const char *name,
388 const char *name, 390 const void *value, size_t size, int flags, int type)
389 void *buffer,
390 size_t size)
391{
392 if (strcmp(name, "") != 0)
393 return -EINVAL;
394 return ocfs2_xattr_get_acl(inode, ACL_TYPE_ACCESS, buffer, size);
395}
396
397static int ocfs2_xattr_get_acl_default(struct inode *inode,
398 const char *name,
399 void *buffer,
400 size_t size)
401{
402 if (strcmp(name, "") != 0)
403 return -EINVAL;
404 return ocfs2_xattr_get_acl(inode, ACL_TYPE_DEFAULT, buffer, size);
405}
406
407static int ocfs2_xattr_set_acl(struct inode *inode,
408 int type,
409 const void *value,
410 size_t size)
411{ 391{
392 struct inode *inode = dentry->d_inode;
412 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 393 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
413 struct posix_acl *acl; 394 struct posix_acl *acl;
414 int ret = 0; 395 int ret = 0;
415 396
397 if (strcmp(name, "") != 0)
398 return -EINVAL;
416 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL)) 399 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
417 return -EOPNOTSUPP; 400 return -EOPNOTSUPP;
418 401
@@ -438,38 +421,18 @@ cleanup:
438 return ret; 421 return ret;
439} 422}
440 423
441static int ocfs2_xattr_set_acl_access(struct inode *inode,
442 const char *name,
443 const void *value,
444 size_t size,
445 int flags)
446{
447 if (strcmp(name, "") != 0)
448 return -EINVAL;
449 return ocfs2_xattr_set_acl(inode, ACL_TYPE_ACCESS, value, size);
450}
451
452static int ocfs2_xattr_set_acl_default(struct inode *inode,
453 const char *name,
454 const void *value,
455 size_t size,
456 int flags)
457{
458 if (strcmp(name, "") != 0)
459 return -EINVAL;
460 return ocfs2_xattr_set_acl(inode, ACL_TYPE_DEFAULT, value, size);
461}
462
463struct xattr_handler ocfs2_xattr_acl_access_handler = { 424struct xattr_handler ocfs2_xattr_acl_access_handler = {
464 .prefix = POSIX_ACL_XATTR_ACCESS, 425 .prefix = POSIX_ACL_XATTR_ACCESS,
426 .flags = ACL_TYPE_ACCESS,
465 .list = ocfs2_xattr_list_acl_access, 427 .list = ocfs2_xattr_list_acl_access,
466 .get = ocfs2_xattr_get_acl_access, 428 .get = ocfs2_xattr_get_acl,
467 .set = ocfs2_xattr_set_acl_access, 429 .set = ocfs2_xattr_set_acl,
468}; 430};
469 431
470struct xattr_handler ocfs2_xattr_acl_default_handler = { 432struct xattr_handler ocfs2_xattr_acl_default_handler = {
471 .prefix = POSIX_ACL_XATTR_DEFAULT, 433 .prefix = POSIX_ACL_XATTR_DEFAULT,
434 .flags = ACL_TYPE_DEFAULT,
472 .list = ocfs2_xattr_list_acl_default, 435 .list = ocfs2_xattr_list_acl_default,
473 .get = ocfs2_xattr_get_acl_default, 436 .get = ocfs2_xattr_get_acl,
474 .set = ocfs2_xattr_set_acl_default, 437 .set = ocfs2_xattr_set_acl,
475}; 438};
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 38a42f5d59ff..d17bdc718f74 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -1765,9 +1765,9 @@ set_and_inc:
1765 * 1765 *
1766 * The array index of the subtree root is passed back. 1766 * The array index of the subtree root is passed back.
1767 */ 1767 */
1768static int ocfs2_find_subtree_root(struct ocfs2_extent_tree *et, 1768int ocfs2_find_subtree_root(struct ocfs2_extent_tree *et,
1769 struct ocfs2_path *left, 1769 struct ocfs2_path *left,
1770 struct ocfs2_path *right) 1770 struct ocfs2_path *right)
1771{ 1771{
1772 int i = 0; 1772 int i = 0;
1773 1773
@@ -2398,7 +2398,7 @@ static int ocfs2_leftmost_rec_contains(struct ocfs2_extent_list *el, u32 cpos)
2398 * 2398 *
2399 * The array is assumed to be large enough to hold an entire path (tree depth). 2399 * The array is assumed to be large enough to hold an entire path (tree depth).
2400 * 2400 *
2401 * Upon succesful return from this function: 2401 * Upon successful return from this function:
2402 * 2402 *
2403 * - The 'right_path' array will contain a path to the leaf block 2403 * - The 'right_path' array will contain a path to the leaf block
2404 * whose range contains e_cpos. 2404 * whose range contains e_cpos.
@@ -2872,8 +2872,8 @@ out:
2872 * This looks similar, but is subtly different to 2872 * This looks similar, but is subtly different to
2873 * ocfs2_find_cpos_for_left_leaf(). 2873 * ocfs2_find_cpos_for_left_leaf().
2874 */ 2874 */
2875static int ocfs2_find_cpos_for_right_leaf(struct super_block *sb, 2875int ocfs2_find_cpos_for_right_leaf(struct super_block *sb,
2876 struct ocfs2_path *path, u32 *cpos) 2876 struct ocfs2_path *path, u32 *cpos)
2877{ 2877{
2878 int i, j, ret = 0; 2878 int i, j, ret = 0;
2879 u64 blkno; 2879 u64 blkno;
@@ -7190,8 +7190,8 @@ int ocfs2_zero_range_for_truncate(struct inode *inode, handle_t *handle,
7190 * wait on them - the truncate_inode_pages() call later will 7190 * wait on them - the truncate_inode_pages() call later will
7191 * do that for us. 7191 * do that for us.
7192 */ 7192 */
7193 ret = do_sync_mapping_range(inode->i_mapping, range_start, 7193 ret = filemap_fdatawrite_range(inode->i_mapping, range_start,
7194 range_end - 1, SYNC_FILE_RANGE_WRITE); 7194 range_end - 1);
7195 if (ret) 7195 if (ret)
7196 mlog_errno(ret); 7196 mlog_errno(ret);
7197 7197
diff --git a/fs/ocfs2/alloc.h b/fs/ocfs2/alloc.h
index 9c122d574464..1db4359ccb90 100644
--- a/fs/ocfs2/alloc.h
+++ b/fs/ocfs2/alloc.h
@@ -317,4 +317,9 @@ int ocfs2_path_bh_journal_access(handle_t *handle,
317int ocfs2_journal_access_path(struct ocfs2_caching_info *ci, 317int ocfs2_journal_access_path(struct ocfs2_caching_info *ci,
318 handle_t *handle, 318 handle_t *handle,
319 struct ocfs2_path *path); 319 struct ocfs2_path *path);
320int ocfs2_find_cpos_for_right_leaf(struct super_block *sb,
321 struct ocfs2_path *path, u32 *cpos);
322int ocfs2_find_subtree_root(struct ocfs2_extent_tree *et,
323 struct ocfs2_path *left,
324 struct ocfs2_path *right);
320#endif /* OCFS2_ALLOC_H */ 325#endif /* OCFS2_ALLOC_H */
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index deb2b132ae5e..3dae4a13f6e4 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -547,6 +547,9 @@ bail:
547 * 547 *
548 * called like this: dio->get_blocks(dio->inode, fs_startblk, 548 * called like this: dio->get_blocks(dio->inode, fs_startblk,
549 * fs_count, map_bh, dio->rw == WRITE); 549 * fs_count, map_bh, dio->rw == WRITE);
550 *
551 * Note that we never bother to allocate blocks here, and thus ignore the
552 * create argument.
550 */ 553 */
551static int ocfs2_direct_IO_get_blocks(struct inode *inode, sector_t iblock, 554static int ocfs2_direct_IO_get_blocks(struct inode *inode, sector_t iblock,
552 struct buffer_head *bh_result, int create) 555 struct buffer_head *bh_result, int create)
@@ -563,14 +566,6 @@ static int ocfs2_direct_IO_get_blocks(struct inode *inode, sector_t iblock,
563 566
564 inode_blocks = ocfs2_blocks_for_bytes(inode->i_sb, i_size_read(inode)); 567 inode_blocks = ocfs2_blocks_for_bytes(inode->i_sb, i_size_read(inode));
565 568
566 /*
567 * Any write past EOF is not allowed because we'd be extending.
568 */
569 if (create && (iblock + max_blocks) > inode_blocks) {
570 ret = -EIO;
571 goto bail;
572 }
573
574 /* This figures out the size of the next contiguous block, and 569 /* This figures out the size of the next contiguous block, and
575 * our logical offset */ 570 * our logical offset */
576 ret = ocfs2_extent_map_get_blocks(inode, iblock, &p_blkno, 571 ret = ocfs2_extent_map_get_blocks(inode, iblock, &p_blkno,
@@ -582,15 +577,6 @@ static int ocfs2_direct_IO_get_blocks(struct inode *inode, sector_t iblock,
582 goto bail; 577 goto bail;
583 } 578 }
584 579
585 if (!ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb)) && !p_blkno && create) {
586 ocfs2_error(inode->i_sb,
587 "Inode %llu has a hole at block %llu\n",
588 (unsigned long long)OCFS2_I(inode)->ip_blkno,
589 (unsigned long long)iblock);
590 ret = -EROFS;
591 goto bail;
592 }
593
594 /* We should already CoW the refcounted extent. */ 580 /* We should already CoW the refcounted extent. */
595 BUG_ON(ext_flags & OCFS2_EXT_REFCOUNTED); 581 BUG_ON(ext_flags & OCFS2_EXT_REFCOUNTED);
596 /* 582 /*
@@ -601,20 +587,8 @@ static int ocfs2_direct_IO_get_blocks(struct inode *inode, sector_t iblock,
601 */ 587 */
602 if (p_blkno && !(ext_flags & OCFS2_EXT_UNWRITTEN)) 588 if (p_blkno && !(ext_flags & OCFS2_EXT_UNWRITTEN))
603 map_bh(bh_result, inode->i_sb, p_blkno); 589 map_bh(bh_result, inode->i_sb, p_blkno);
604 else { 590 else
605 /*
606 * ocfs2_prepare_inode_for_write() should have caught
607 * the case where we'd be filling a hole and triggered
608 * a buffered write instead.
609 */
610 if (create) {
611 ret = -EIO;
612 mlog_errno(ret);
613 goto bail;
614 }
615
616 clear_buffer_mapped(bh_result); 591 clear_buffer_mapped(bh_result);
617 }
618 592
619 /* make sure we don't map more than max_blocks blocks here as 593 /* make sure we don't map more than max_blocks blocks here as
620 that's all the kernel will handle at this point. */ 594 that's all the kernel will handle at this point. */
diff --git a/fs/ocfs2/blockcheck.c b/fs/ocfs2/blockcheck.c
index a1163b8b417c..b7428c5d0d3b 100644
--- a/fs/ocfs2/blockcheck.c
+++ b/fs/ocfs2/blockcheck.c
@@ -47,7 +47,7 @@
47 * Calculate the bit offset in the hamming code buffer based on the bit's 47 * Calculate the bit offset in the hamming code buffer based on the bit's
48 * offset in the data buffer. Since the hamming code reserves all 48 * offset in the data buffer. Since the hamming code reserves all
49 * power-of-two bits for parity, the data bit number and the code bit 49 * power-of-two bits for parity, the data bit number and the code bit
50 * number are offest by all the parity bits beforehand. 50 * number are offset by all the parity bits beforehand.
51 * 51 *
52 * Recall that bit numbers in hamming code are 1-based. This function 52 * Recall that bit numbers in hamming code are 1-based. This function
53 * takes the 0-based data bit from the caller. 53 * takes the 0-based data bit from the caller.
diff --git a/fs/ocfs2/cluster/netdebug.c b/fs/ocfs2/cluster/netdebug.c
index da794bc07a6c..a3f150e52b02 100644
--- a/fs/ocfs2/cluster/netdebug.c
+++ b/fs/ocfs2/cluster/netdebug.c
@@ -294,10 +294,10 @@ static int sc_seq_show(struct seq_file *seq, void *v)
294 if (sc->sc_sock) { 294 if (sc->sc_sock) {
295 inet = inet_sk(sc->sc_sock->sk); 295 inet = inet_sk(sc->sc_sock->sk);
296 /* the stack's structs aren't sparse endian clean */ 296 /* the stack's structs aren't sparse endian clean */
297 saddr = (__force __be32)inet->saddr; 297 saddr = (__force __be32)inet->inet_saddr;
298 daddr = (__force __be32)inet->daddr; 298 daddr = (__force __be32)inet->inet_daddr;
299 sport = (__force __be16)inet->sport; 299 sport = (__force __be16)inet->inet_sport;
300 dport = (__force __be16)inet->dport; 300 dport = (__force __be16)inet->inet_dport;
301 } 301 }
302 302
303 /* XXX sigh, inet-> doesn't have sparse annotation so any 303 /* XXX sigh, inet-> doesn't have sparse annotation so any
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index 83bcaf266b35..03ccf9a7b1f4 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -2586,7 +2586,7 @@ fail:
2586 * is complete everywhere. if the target dies while this is 2586 * is complete everywhere. if the target dies while this is
2587 * going on, some nodes could potentially see the target as the 2587 * going on, some nodes could potentially see the target as the
2588 * master, so it is important that my recovery finds the migration 2588 * master, so it is important that my recovery finds the migration
2589 * mle and sets the master to UNKNONWN. */ 2589 * mle and sets the master to UNKNOWN. */
2590 2590
2591 2591
2592 /* wait for new node to assert master */ 2592 /* wait for new node to assert master */
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 0d38d67194cb..c5e4a49e3a12 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -1855,7 +1855,7 @@ int ocfs2_file_lock(struct file *file, int ex, int trylock)
1855 * outstanding lock request, so a cancel convert is 1855 * outstanding lock request, so a cancel convert is
1856 * required. We intentionally overwrite 'ret' - if the 1856 * required. We intentionally overwrite 'ret' - if the
1857 * cancel fails and the lock was granted, it's easier 1857 * cancel fails and the lock was granted, it's easier
1858 * to just bubble sucess back up to the user. 1858 * to just bubble success back up to the user.
1859 */ 1859 */
1860 ret = ocfs2_flock_handle_signal(lockres, level); 1860 ret = ocfs2_flock_handle_signal(lockres, level);
1861 } else if (!ret && (level > lockres->l_level)) { 1861 } else if (!ret && (level > lockres->l_level)) {
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index de059f490586..3d30a1c974a8 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2006,7 +2006,7 @@ out_dio:
2006 /* buffered aio wouldn't have proper lock coverage today */ 2006 /* buffered aio wouldn't have proper lock coverage today */
2007 BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT)); 2007 BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT));
2008 2008
2009 if ((file->f_flags & O_SYNC && !direct_io) || IS_SYNC(inode)) { 2009 if ((file->f_flags & O_DSYNC && !direct_io) || IS_SYNC(inode)) {
2010 ret = filemap_fdatawrite_range(file->f_mapping, pos, 2010 ret = filemap_fdatawrite_range(file->f_mapping, pos,
2011 pos + count - 1); 2011 pos + count - 1);
2012 if (ret < 0) 2012 if (ret < 0)
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 54c16b66327e..bf34c491ae96 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -659,7 +659,7 @@ static int __ocfs2_journal_access(handle_t *handle,
659 659
660 default: 660 default:
661 status = -EINVAL; 661 status = -EINVAL;
662 mlog(ML_ERROR, "Uknown access type!\n"); 662 mlog(ML_ERROR, "Unknown access type!\n");
663 } 663 }
664 if (!status && ocfs2_meta_ecc(osb) && triggers) 664 if (!status && ocfs2_meta_ecc(osb) && triggers)
665 jbd2_journal_set_triggers(bh, &triggers->ot_triggers); 665 jbd2_journal_set_triggers(bh, &triggers->ot_triggers);
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 0b9f35e09bf8..50fb26a6a5f5 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -2108,6 +2108,7 @@ int ocfs2_create_inode_in_orphan(struct inode *dir,
2108 } 2108 }
2109 did_quota_inode = 1; 2109 did_quota_inode = 1;
2110 2110
2111 inode->i_nlink = 0;
2111 /* do the real work now. */ 2112 /* do the real work now. */
2112 status = ocfs2_mknod_locked(osb, dir, inode, 2113 status = ocfs2_mknod_locked(osb, dir, inode,
2113 0, &new_di_bh, parent_di_bh, handle, 2114 0, &new_di_bh, parent_di_bh, handle,
@@ -2136,6 +2137,7 @@ int ocfs2_create_inode_in_orphan(struct inode *dir,
2136 if (status < 0) 2137 if (status < 0)
2137 mlog_errno(status); 2138 mlog_errno(status);
2138 2139
2140 insert_inode_hash(inode);
2139leave: 2141leave:
2140 if (status < 0 && did_quota_inode) 2142 if (status < 0 && did_quota_inode)
2141 vfs_dq_free_inode(inode); 2143 vfs_dq_free_inode(inode);
@@ -2267,6 +2269,8 @@ int ocfs2_mv_orphaned_inode_to_new(struct inode *dir,
2267 di = (struct ocfs2_dinode *)di_bh->b_data; 2269 di = (struct ocfs2_dinode *)di_bh->b_data;
2268 le32_add_cpu(&di->i_flags, -OCFS2_ORPHANED_FL); 2270 le32_add_cpu(&di->i_flags, -OCFS2_ORPHANED_FL);
2269 di->i_orphaned_slot = 0; 2271 di->i_orphaned_slot = 0;
2272 inode->i_nlink = 1;
2273 ocfs2_set_links_count(di, inode->i_nlink);
2270 ocfs2_journal_dirty(handle, di_bh); 2274 ocfs2_journal_dirty(handle, di_bh);
2271 2275
2272 status = ocfs2_add_entry(handle, dentry, inode, 2276 status = ocfs2_add_entry(handle, dentry, inode,
@@ -2284,7 +2288,6 @@ int ocfs2_mv_orphaned_inode_to_new(struct inode *dir,
2284 goto out_commit; 2288 goto out_commit;
2285 } 2289 }
2286 2290
2287 insert_inode_hash(inode);
2288 dentry->d_op = &ocfs2_dentry_ops; 2291 dentry->d_op = &ocfs2_dentry_ops;
2289 d_instantiate(dentry, inode); 2292 d_instantiate(dentry, inode);
2290 status = 0; 2293 status = 0;
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index 35ad46cf89b3..9362eea7424b 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -35,12 +35,7 @@
35#include <linux/kref.h> 35#include <linux/kref.h>
36#include <linux/mutex.h> 36#include <linux/mutex.h>
37#include <linux/lockdep.h> 37#include <linux/lockdep.h>
38#ifndef CONFIG_OCFS2_COMPAT_JBD 38#include <linux/jbd2.h>
39# include <linux/jbd2.h>
40#else
41# include <linux/jbd.h>
42# include "ocfs2_jbd_compat.h"
43#endif
44 39
45/* For union ocfs2_dlm_lksb */ 40/* For union ocfs2_dlm_lksb */
46#include "stackglue.h" 41#include "stackglue.h"
diff --git a/fs/ocfs2/quota.h b/fs/ocfs2/quota.h
index e5df9d170b0c..123bc520a2c0 100644
--- a/fs/ocfs2/quota.h
+++ b/fs/ocfs2/quota.h
@@ -17,10 +17,6 @@
17 17
18#include "ocfs2.h" 18#include "ocfs2.h"
19 19
20/* Common stuff */
21/* id number of quota format */
22#define QFMT_OCFS2 3
23
24/* 20/*
25 * In-memory structures 21 * In-memory structures
26 */ 22 */
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c
index 1a2c50a759fa..21f9e71223ca 100644
--- a/fs/ocfs2/quota_local.c
+++ b/fs/ocfs2/quota_local.c
@@ -1325,7 +1325,7 @@ out:
1325 return status; 1325 return status;
1326} 1326}
1327 1327
1328static struct quota_format_ops ocfs2_format_ops = { 1328static const struct quota_format_ops ocfs2_format_ops = {
1329 .check_quota_file = ocfs2_local_check_quota_file, 1329 .check_quota_file = ocfs2_local_check_quota_file,
1330 .read_file_info = ocfs2_local_read_info, 1330 .read_file_info = ocfs2_local_read_info,
1331 .write_file_info = ocfs2_global_write_info, 1331 .write_file_info = ocfs2_global_write_info,
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index 3a0df7a1b810..74db2be75dd6 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -276,7 +276,7 @@ static void ocfs2_erase_refcount_tree_from_list(struct ocfs2_super *osb,
276 spin_unlock(&osb->osb_lock); 276 spin_unlock(&osb->osb_lock);
277} 277}
278 278
279void ocfs2_kref_remove_refcount_tree(struct kref *kref) 279static void ocfs2_kref_remove_refcount_tree(struct kref *kref)
280{ 280{
281 struct ocfs2_refcount_tree *tree = 281 struct ocfs2_refcount_tree *tree =
282 container_of(kref, struct ocfs2_refcount_tree, rf_getcnt); 282 container_of(kref, struct ocfs2_refcount_tree, rf_getcnt);
@@ -524,23 +524,6 @@ out:
524 return ret; 524 return ret;
525} 525}
526 526
527int ocfs2_lock_refcount_tree_by_inode(struct inode *inode, int rw,
528 struct ocfs2_refcount_tree **ret_tree,
529 struct buffer_head **ref_bh)
530{
531 int ret;
532 u64 ref_blkno;
533
534 ret = ocfs2_get_refcount_block(inode, &ref_blkno);
535 if (ret) {
536 mlog_errno(ret);
537 return ret;
538 }
539
540 return ocfs2_lock_refcount_tree(OCFS2_SB(inode->i_sb), ref_blkno,
541 rw, ret_tree, ref_bh);
542}
543
544void ocfs2_unlock_refcount_tree(struct ocfs2_super *osb, 527void ocfs2_unlock_refcount_tree(struct ocfs2_super *osb,
545 struct ocfs2_refcount_tree *tree, int rw) 528 struct ocfs2_refcount_tree *tree, int rw)
546{ 529{
@@ -969,6 +952,103 @@ out:
969} 952}
970 953
971/* 954/*
955 * Find the end range for a leaf refcount block indicated by
956 * el->l_recs[index].e_blkno.
957 */
958static int ocfs2_get_refcount_cpos_end(struct ocfs2_caching_info *ci,
959 struct buffer_head *ref_root_bh,
960 struct ocfs2_extent_block *eb,
961 struct ocfs2_extent_list *el,
962 int index, u32 *cpos_end)
963{
964 int ret, i, subtree_root;
965 u32 cpos;
966 u64 blkno;
967 struct super_block *sb = ocfs2_metadata_cache_get_super(ci);
968 struct ocfs2_path *left_path = NULL, *right_path = NULL;
969 struct ocfs2_extent_tree et;
970 struct ocfs2_extent_list *tmp_el;
971
972 if (index < le16_to_cpu(el->l_next_free_rec) - 1) {
973 /*
974 * We have a extent rec after index, so just use the e_cpos
975 * of the next extent rec.
976 */
977 *cpos_end = le32_to_cpu(el->l_recs[index+1].e_cpos);
978 return 0;
979 }
980
981 if (!eb || (eb && !eb->h_next_leaf_blk)) {
982 /*
983 * We are the last extent rec, so any high cpos should
984 * be stored in this leaf refcount block.
985 */
986 *cpos_end = UINT_MAX;
987 return 0;
988 }
989
990 /*
991 * If the extent block isn't the last one, we have to find
992 * the subtree root between this extent block and the next
993 * leaf extent block and get the corresponding e_cpos from
994 * the subroot. Otherwise we may corrupt the b-tree.
995 */
996 ocfs2_init_refcount_extent_tree(&et, ci, ref_root_bh);
997
998 left_path = ocfs2_new_path_from_et(&et);
999 if (!left_path) {
1000 ret = -ENOMEM;
1001 mlog_errno(ret);
1002 goto out;
1003 }
1004
1005 cpos = le32_to_cpu(eb->h_list.l_recs[index].e_cpos);
1006 ret = ocfs2_find_path(ci, left_path, cpos);
1007 if (ret) {
1008 mlog_errno(ret);
1009 goto out;
1010 }
1011
1012 right_path = ocfs2_new_path_from_path(left_path);
1013 if (!right_path) {
1014 ret = -ENOMEM;
1015 mlog_errno(ret);
1016 goto out;
1017 }
1018
1019 ret = ocfs2_find_cpos_for_right_leaf(sb, left_path, &cpos);
1020 if (ret) {
1021 mlog_errno(ret);
1022 goto out;
1023 }
1024
1025 ret = ocfs2_find_path(ci, right_path, cpos);
1026 if (ret) {
1027 mlog_errno(ret);
1028 goto out;
1029 }
1030
1031 subtree_root = ocfs2_find_subtree_root(&et, left_path,
1032 right_path);
1033
1034 tmp_el = left_path->p_node[subtree_root].el;
1035 blkno = left_path->p_node[subtree_root+1].bh->b_blocknr;
1036 for (i = 0; i < le32_to_cpu(tmp_el->l_next_free_rec); i++) {
1037 if (le64_to_cpu(tmp_el->l_recs[i].e_blkno) == blkno) {
1038 *cpos_end = le32_to_cpu(tmp_el->l_recs[i+1].e_cpos);
1039 break;
1040 }
1041 }
1042
1043 BUG_ON(i == le32_to_cpu(tmp_el->l_next_free_rec));
1044
1045out:
1046 ocfs2_free_path(left_path);
1047 ocfs2_free_path(right_path);
1048 return ret;
1049}
1050
1051/*
972 * Given a cpos and len, try to find the refcount record which contains cpos. 1052 * Given a cpos and len, try to find the refcount record which contains cpos.
973 * 1. If cpos can be found in one refcount record, return the record. 1053 * 1. If cpos can be found in one refcount record, return the record.
974 * 2. If cpos can't be found, return a fake record which start from cpos 1054 * 2. If cpos can't be found, return a fake record which start from cpos
@@ -983,10 +1063,10 @@ static int ocfs2_get_refcount_rec(struct ocfs2_caching_info *ci,
983 struct buffer_head **ret_bh) 1063 struct buffer_head **ret_bh)
984{ 1064{
985 int ret = 0, i, found; 1065 int ret = 0, i, found;
986 u32 low_cpos; 1066 u32 low_cpos, uninitialized_var(cpos_end);
987 struct ocfs2_extent_list *el; 1067 struct ocfs2_extent_list *el;
988 struct ocfs2_extent_rec *tmp, *rec = NULL; 1068 struct ocfs2_extent_rec *rec = NULL;
989 struct ocfs2_extent_block *eb; 1069 struct ocfs2_extent_block *eb = NULL;
990 struct buffer_head *eb_bh = NULL, *ref_leaf_bh = NULL; 1070 struct buffer_head *eb_bh = NULL, *ref_leaf_bh = NULL;
991 struct super_block *sb = ocfs2_metadata_cache_get_super(ci); 1071 struct super_block *sb = ocfs2_metadata_cache_get_super(ci);
992 struct ocfs2_refcount_block *rb = 1072 struct ocfs2_refcount_block *rb =
@@ -1034,12 +1114,16 @@ static int ocfs2_get_refcount_rec(struct ocfs2_caching_info *ci,
1034 } 1114 }
1035 } 1115 }
1036 1116
1037 /* adjust len when we have ocfs2_extent_rec after it. */ 1117 if (found) {
1038 if (found && i < le16_to_cpu(el->l_next_free_rec) - 1) { 1118 ret = ocfs2_get_refcount_cpos_end(ci, ref_root_bh,
1039 tmp = &el->l_recs[i+1]; 1119 eb, el, i, &cpos_end);
1120 if (ret) {
1121 mlog_errno(ret);
1122 goto out;
1123 }
1040 1124
1041 if (le32_to_cpu(tmp->e_cpos) < cpos + len) 1125 if (cpos_end < low_cpos + len)
1042 len = le32_to_cpu(tmp->e_cpos) - cpos; 1126 len = cpos_end - low_cpos;
1043 } 1127 }
1044 1128
1045 ret = ocfs2_read_refcount_block(ci, le64_to_cpu(rec->e_blkno), 1129 ret = ocfs2_read_refcount_block(ci, le64_to_cpu(rec->e_blkno),
@@ -1418,7 +1502,7 @@ static int ocfs2_divide_leaf_refcount_block(struct buffer_head *ref_leaf_bh,
1418 1502
1419 /* change old and new rl_used accordingly. */ 1503 /* change old and new rl_used accordingly. */
1420 le16_add_cpu(&rl->rl_used, -num_moved); 1504 le16_add_cpu(&rl->rl_used, -num_moved);
1421 new_rl->rl_used = cpu_to_le32(num_moved); 1505 new_rl->rl_used = cpu_to_le16(num_moved);
1422 1506
1423 sort(&rl->rl_recs, le16_to_cpu(rl->rl_used), 1507 sort(&rl->rl_recs, le16_to_cpu(rl->rl_used),
1424 sizeof(struct ocfs2_refcount_rec), 1508 sizeof(struct ocfs2_refcount_rec),
@@ -1797,7 +1881,8 @@ static int ocfs2_split_refcount_rec(handle_t *handle,
1797 recs_need++; 1881 recs_need++;
1798 1882
1799 /* If the leaf block don't have enough record, expand it. */ 1883 /* If the leaf block don't have enough record, expand it. */
1800 if (le16_to_cpu(rf_list->rl_used) + recs_need > rf_list->rl_count) { 1884 if (le16_to_cpu(rf_list->rl_used) + recs_need >
1885 le16_to_cpu(rf_list->rl_count)) {
1801 struct ocfs2_refcount_rec tmp_rec; 1886 struct ocfs2_refcount_rec tmp_rec;
1802 u64 cpos = le64_to_cpu(orig_rec->r_cpos); 1887 u64 cpos = le64_to_cpu(orig_rec->r_cpos);
1803 len = le32_to_cpu(orig_rec->r_clusters); 1888 len = le32_to_cpu(orig_rec->r_clusters);
@@ -1859,7 +1944,7 @@ static int ocfs2_split_refcount_rec(handle_t *handle,
1859 memcpy(tail_rec, orig_rec, sizeof(struct ocfs2_refcount_rec)); 1944 memcpy(tail_rec, orig_rec, sizeof(struct ocfs2_refcount_rec));
1860 le64_add_cpu(&tail_rec->r_cpos, 1945 le64_add_cpu(&tail_rec->r_cpos,
1861 le32_to_cpu(tail_rec->r_clusters) - len); 1946 le32_to_cpu(tail_rec->r_clusters) - len);
1862 tail_rec->r_clusters = le32_to_cpu(len); 1947 tail_rec->r_clusters = cpu_to_le32(len);
1863 } 1948 }
1864 1949
1865 /* 1950 /*
@@ -2431,7 +2516,7 @@ out:
2431 * we gonna touch and whether we need to create new blocks. 2516 * we gonna touch and whether we need to create new blocks.
2432 * 2517 *
2433 * Normally the refcount blocks store these refcount should be 2518 * Normally the refcount blocks store these refcount should be
2434 * continguous also, so that we can get the number easily. 2519 * contiguous also, so that we can get the number easily.
2435 * As for meta_ac, we will at most add split 2 refcount record and 2520 * As for meta_ac, we will at most add split 2 refcount record and
2436 * 2 more refcount block, so just check it in a rough way. 2521 * 2 more refcount block, so just check it in a rough way.
2437 * 2522 *
@@ -3840,8 +3925,7 @@ static int ocfs2_add_refcounted_extent(struct inode *inode,
3840 } 3925 }
3841 3926
3842 ret = ocfs2_insert_extent(handle, et, cpos, 3927 ret = ocfs2_insert_extent(handle, et, cpos,
3843 cpu_to_le64(ocfs2_clusters_to_blocks(inode->i_sb, 3928 ocfs2_clusters_to_blocks(inode->i_sb, p_cluster),
3844 p_cluster)),
3845 num_clusters, ext_flags, meta_ac); 3929 num_clusters, ext_flags, meta_ac);
3846 if (ret) { 3930 if (ret) {
3847 mlog_errno(ret); 3931 mlog_errno(ret);
@@ -4253,8 +4337,8 @@ static int ocfs2_user_path_parent(const char __user *path,
4253 * @new_dentry: target dentry 4337 * @new_dentry: target dentry
4254 * @preserve: if true, preserve all file attributes 4338 * @preserve: if true, preserve all file attributes
4255 */ 4339 */
4256int ocfs2_vfs_reflink(struct dentry *old_dentry, struct inode *dir, 4340static int ocfs2_vfs_reflink(struct dentry *old_dentry, struct inode *dir,
4257 struct dentry *new_dentry, bool preserve) 4341 struct dentry *new_dentry, bool preserve)
4258{ 4342{
4259 struct inode *inode = old_dentry->d_inode; 4343 struct inode *inode = old_dentry->d_inode;
4260 int error; 4344 int error;
diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c
index 3f2f1c45b7b6..f3df0baa9a48 100644
--- a/fs/ocfs2/stackglue.c
+++ b/fs/ocfs2/stackglue.c
@@ -620,51 +620,46 @@ error:
620 620
621static ctl_table ocfs2_nm_table[] = { 621static ctl_table ocfs2_nm_table[] = {
622 { 622 {
623 .ctl_name = 1,
624 .procname = "hb_ctl_path", 623 .procname = "hb_ctl_path",
625 .data = ocfs2_hb_ctl_path, 624 .data = ocfs2_hb_ctl_path,
626 .maxlen = OCFS2_MAX_HB_CTL_PATH, 625 .maxlen = OCFS2_MAX_HB_CTL_PATH,
627 .mode = 0644, 626 .mode = 0644,
628 .proc_handler = &proc_dostring, 627 .proc_handler = proc_dostring,
629 .strategy = &sysctl_string,
630 }, 628 },
631 { .ctl_name = 0 } 629 { }
632}; 630};
633 631
634static ctl_table ocfs2_mod_table[] = { 632static ctl_table ocfs2_mod_table[] = {
635 { 633 {
636 .ctl_name = FS_OCFS2_NM,
637 .procname = "nm", 634 .procname = "nm",
638 .data = NULL, 635 .data = NULL,
639 .maxlen = 0, 636 .maxlen = 0,
640 .mode = 0555, 637 .mode = 0555,
641 .child = ocfs2_nm_table 638 .child = ocfs2_nm_table
642 }, 639 },
643 { .ctl_name = 0} 640 { }
644}; 641};
645 642
646static ctl_table ocfs2_kern_table[] = { 643static ctl_table ocfs2_kern_table[] = {
647 { 644 {
648 .ctl_name = FS_OCFS2,
649 .procname = "ocfs2", 645 .procname = "ocfs2",
650 .data = NULL, 646 .data = NULL,
651 .maxlen = 0, 647 .maxlen = 0,
652 .mode = 0555, 648 .mode = 0555,
653 .child = ocfs2_mod_table 649 .child = ocfs2_mod_table
654 }, 650 },
655 { .ctl_name = 0} 651 { }
656}; 652};
657 653
658static ctl_table ocfs2_root_table[] = { 654static ctl_table ocfs2_root_table[] = {
659 { 655 {
660 .ctl_name = CTL_FS,
661 .procname = "fs", 656 .procname = "fs",
662 .data = NULL, 657 .data = NULL,
663 .maxlen = 0, 658 .maxlen = 0,
664 .mode = 0555, 659 .mode = 0555,
665 .child = ocfs2_kern_table 660 .child = ocfs2_kern_table
666 }, 661 },
667 { .ctl_name = 0 } 662 { }
668}; 663};
669 664
670static struct ctl_table_header *ocfs2_table_header = NULL; 665static struct ctl_table_header *ocfs2_table_header = NULL;
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 45d654cb77ef..26069917a9f5 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1648,6 +1648,10 @@ static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf)
1648 buf->f_bavail = buf->f_bfree; 1648 buf->f_bavail = buf->f_bfree;
1649 buf->f_files = numbits; 1649 buf->f_files = numbits;
1650 buf->f_ffree = freebits; 1650 buf->f_ffree = freebits;
1651 buf->f_fsid.val[0] = crc32_le(0, osb->uuid_str, OCFS2_VOL_UUID_LEN)
1652 & 0xFFFFFFFFUL;
1653 buf->f_fsid.val[1] = crc32_le(0, osb->uuid_str + OCFS2_VOL_UUID_LEN,
1654 OCFS2_VOL_UUID_LEN) & 0xFFFFFFFFUL;
1651 1655
1652 brelse(bh); 1656 brelse(bh);
1653 1657
diff --git a/fs/ocfs2/uptodate.c b/fs/ocfs2/uptodate.c
index b6284f235d2f..c61369342a27 100644
--- a/fs/ocfs2/uptodate.c
+++ b/fs/ocfs2/uptodate.c
@@ -53,11 +53,6 @@
53#include <linux/highmem.h> 53#include <linux/highmem.h>
54#include <linux/buffer_head.h> 54#include <linux/buffer_head.h>
55#include <linux/rbtree.h> 55#include <linux/rbtree.h>
56#ifndef CONFIG_OCFS2_COMPAT_JBD
57# include <linux/jbd2.h>
58#else
59# include <linux/jbd.h>
60#endif
61 56
62#define MLOG_MASK_PREFIX ML_UPTODATE 57#define MLOG_MASK_PREFIX ML_UPTODATE
63 58
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 932c07731608..8fc6fb071c6d 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -201,8 +201,6 @@ static int ocfs2_get_xattr_tree_value_root(struct super_block *sb,
201 int offset, 201 int offset,
202 struct ocfs2_xattr_value_root **xv, 202 struct ocfs2_xattr_value_root **xv,
203 struct buffer_head **bh); 203 struct buffer_head **bh);
204static int ocfs2_xattr_security_set(struct inode *inode, const char *name,
205 const void *value, size_t size, int flags);
206 204
207static inline u16 ocfs2_xattr_buckets_per_cluster(struct ocfs2_super *osb) 205static inline u16 ocfs2_xattr_buckets_per_cluster(struct ocfs2_super *osb)
208{ 206{
@@ -6974,9 +6972,9 @@ int ocfs2_init_security_and_acl(struct inode *dir,
6974 6972
6975 ret = ocfs2_init_security_get(inode, dir, &si); 6973 ret = ocfs2_init_security_get(inode, dir, &si);
6976 if (!ret) { 6974 if (!ret) {
6977 ret = ocfs2_xattr_security_set(inode, si.name, 6975 ret = ocfs2_xattr_set(inode, OCFS2_XATTR_INDEX_SECURITY,
6978 si.value, si.value_len, 6976 si.name, si.value, si.value_len,
6979 XATTR_CREATE); 6977 XATTR_CREATE);
6980 if (ret) { 6978 if (ret) {
6981 mlog_errno(ret); 6979 mlog_errno(ret);
6982 goto leave; 6980 goto leave;
@@ -7004,9 +7002,9 @@ leave:
7004/* 7002/*
7005 * 'security' attributes support 7003 * 'security' attributes support
7006 */ 7004 */
7007static size_t ocfs2_xattr_security_list(struct inode *inode, char *list, 7005static size_t ocfs2_xattr_security_list(struct dentry *dentry, char *list,
7008 size_t list_size, const char *name, 7006 size_t list_size, const char *name,
7009 size_t name_len) 7007 size_t name_len, int type)
7010{ 7008{
7011 const size_t prefix_len = XATTR_SECURITY_PREFIX_LEN; 7009 const size_t prefix_len = XATTR_SECURITY_PREFIX_LEN;
7012 const size_t total_len = prefix_len + name_len + 1; 7010 const size_t total_len = prefix_len + name_len + 1;
@@ -7019,23 +7017,23 @@ static size_t ocfs2_xattr_security_list(struct inode *inode, char *list,
7019 return total_len; 7017 return total_len;
7020} 7018}
7021 7019
7022static int ocfs2_xattr_security_get(struct inode *inode, const char *name, 7020static int ocfs2_xattr_security_get(struct dentry *dentry, const char *name,
7023 void *buffer, size_t size) 7021 void *buffer, size_t size, int type)
7024{ 7022{
7025 if (strcmp(name, "") == 0) 7023 if (strcmp(name, "") == 0)
7026 return -EINVAL; 7024 return -EINVAL;
7027 return ocfs2_xattr_get(inode, OCFS2_XATTR_INDEX_SECURITY, name, 7025 return ocfs2_xattr_get(dentry->d_inode, OCFS2_XATTR_INDEX_SECURITY,
7028 buffer, size); 7026 name, buffer, size);
7029} 7027}
7030 7028
7031static int ocfs2_xattr_security_set(struct inode *inode, const char *name, 7029static int ocfs2_xattr_security_set(struct dentry *dentry, const char *name,
7032 const void *value, size_t size, int flags) 7030 const void *value, size_t size, int flags, int type)
7033{ 7031{
7034 if (strcmp(name, "") == 0) 7032 if (strcmp(name, "") == 0)
7035 return -EINVAL; 7033 return -EINVAL;
7036 7034
7037 return ocfs2_xattr_set(inode, OCFS2_XATTR_INDEX_SECURITY, name, value, 7035 return ocfs2_xattr_set(dentry->d_inode, OCFS2_XATTR_INDEX_SECURITY,
7038 size, flags); 7036 name, value, size, flags);
7039} 7037}
7040 7038
7041int ocfs2_init_security_get(struct inode *inode, 7039int ocfs2_init_security_get(struct inode *inode,
@@ -7072,9 +7070,9 @@ struct xattr_handler ocfs2_xattr_security_handler = {
7072/* 7070/*
7073 * 'trusted' attributes support 7071 * 'trusted' attributes support
7074 */ 7072 */
7075static size_t ocfs2_xattr_trusted_list(struct inode *inode, char *list, 7073static size_t ocfs2_xattr_trusted_list(struct dentry *dentry, char *list,
7076 size_t list_size, const char *name, 7074 size_t list_size, const char *name,
7077 size_t name_len) 7075 size_t name_len, int type)
7078{ 7076{
7079 const size_t prefix_len = XATTR_TRUSTED_PREFIX_LEN; 7077 const size_t prefix_len = XATTR_TRUSTED_PREFIX_LEN;
7080 const size_t total_len = prefix_len + name_len + 1; 7078 const size_t total_len = prefix_len + name_len + 1;
@@ -7087,23 +7085,23 @@ static size_t ocfs2_xattr_trusted_list(struct inode *inode, char *list,
7087 return total_len; 7085 return total_len;
7088} 7086}
7089 7087
7090static int ocfs2_xattr_trusted_get(struct inode *inode, const char *name, 7088static int ocfs2_xattr_trusted_get(struct dentry *dentry, const char *name,
7091 void *buffer, size_t size) 7089 void *buffer, size_t size, int type)
7092{ 7090{
7093 if (strcmp(name, "") == 0) 7091 if (strcmp(name, "") == 0)
7094 return -EINVAL; 7092 return -EINVAL;
7095 return ocfs2_xattr_get(inode, OCFS2_XATTR_INDEX_TRUSTED, name, 7093 return ocfs2_xattr_get(dentry->d_inode, OCFS2_XATTR_INDEX_TRUSTED,
7096 buffer, size); 7094 name, buffer, size);
7097} 7095}
7098 7096
7099static int ocfs2_xattr_trusted_set(struct inode *inode, const char *name, 7097static int ocfs2_xattr_trusted_set(struct dentry *dentry, const char *name,
7100 const void *value, size_t size, int flags) 7098 const void *value, size_t size, int flags, int type)
7101{ 7099{
7102 if (strcmp(name, "") == 0) 7100 if (strcmp(name, "") == 0)
7103 return -EINVAL; 7101 return -EINVAL;
7104 7102
7105 return ocfs2_xattr_set(inode, OCFS2_XATTR_INDEX_TRUSTED, name, value, 7103 return ocfs2_xattr_set(dentry->d_inode, OCFS2_XATTR_INDEX_TRUSTED,
7106 size, flags); 7104 name, value, size, flags);
7107} 7105}
7108 7106
7109struct xattr_handler ocfs2_xattr_trusted_handler = { 7107struct xattr_handler ocfs2_xattr_trusted_handler = {
@@ -7116,13 +7114,13 @@ struct xattr_handler ocfs2_xattr_trusted_handler = {
7116/* 7114/*
7117 * 'user' attributes support 7115 * 'user' attributes support
7118 */ 7116 */
7119static size_t ocfs2_xattr_user_list(struct inode *inode, char *list, 7117static size_t ocfs2_xattr_user_list(struct dentry *dentry, char *list,
7120 size_t list_size, const char *name, 7118 size_t list_size, const char *name,
7121 size_t name_len) 7119 size_t name_len, int type)
7122{ 7120{
7123 const size_t prefix_len = XATTR_USER_PREFIX_LEN; 7121 const size_t prefix_len = XATTR_USER_PREFIX_LEN;
7124 const size_t total_len = prefix_len + name_len + 1; 7122 const size_t total_len = prefix_len + name_len + 1;
7125 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 7123 struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb);
7126 7124
7127 if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR) 7125 if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR)
7128 return 0; 7126 return 0;
@@ -7135,31 +7133,31 @@ static size_t ocfs2_xattr_user_list(struct inode *inode, char *list,
7135 return total_len; 7133 return total_len;
7136} 7134}
7137 7135
7138static int ocfs2_xattr_user_get(struct inode *inode, const char *name, 7136static int ocfs2_xattr_user_get(struct dentry *dentry, const char *name,
7139 void *buffer, size_t size) 7137 void *buffer, size_t size, int type)
7140{ 7138{
7141 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 7139 struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb);
7142 7140
7143 if (strcmp(name, "") == 0) 7141 if (strcmp(name, "") == 0)
7144 return -EINVAL; 7142 return -EINVAL;
7145 if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR) 7143 if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR)
7146 return -EOPNOTSUPP; 7144 return -EOPNOTSUPP;
7147 return ocfs2_xattr_get(inode, OCFS2_XATTR_INDEX_USER, name, 7145 return ocfs2_xattr_get(dentry->d_inode, OCFS2_XATTR_INDEX_USER, name,
7148 buffer, size); 7146 buffer, size);
7149} 7147}
7150 7148
7151static int ocfs2_xattr_user_set(struct inode *inode, const char *name, 7149static int ocfs2_xattr_user_set(struct dentry *dentry, const char *name,
7152 const void *value, size_t size, int flags) 7150 const void *value, size_t size, int flags, int type)
7153{ 7151{
7154 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 7152 struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb);
7155 7153
7156 if (strcmp(name, "") == 0) 7154 if (strcmp(name, "") == 0)
7157 return -EINVAL; 7155 return -EINVAL;
7158 if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR) 7156 if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR)
7159 return -EOPNOTSUPP; 7157 return -EOPNOTSUPP;
7160 7158
7161 return ocfs2_xattr_set(inode, OCFS2_XATTR_INDEX_USER, name, value, 7159 return ocfs2_xattr_set(dentry->d_inode, OCFS2_XATTR_INDEX_USER,
7162 size, flags); 7160 name, value, size, flags);
7163} 7161}
7164 7162
7165struct xattr_handler ocfs2_xattr_user_handler = { 7163struct xattr_handler ocfs2_xattr_user_handler = {