aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/ops_inode.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-06-14 15:32:57 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-06-14 15:32:57 -0400
commitfeaa7bba026c181ce071d5a4884f7f9dd26207a1 (patch)
treec858deb225917265cb07820730e9764674d133e8 /fs/gfs2/ops_inode.c
parent22da645fd6675b7abc55cf937ddf6132f343e5b9 (diff)
[GFS2] Fix unlinked file handling
This patch fixes the way we have been dealing with unlinked, but still open files. It removes all limits (other than memory for inodes, as per every other filesystem) on numbers of these which we can support on GFS2. It also means that (like other fs) its the responsibility of the last process to close the file to deallocate the storage, rather than the person who did the unlinking. Note that with GFS2, those two events might take place on different nodes. Also there are a number of other changes: o We use the Linux inode subsystem as it was intended to be used, wrt allocating GFS2 inodes o The Linux inode cache is now the point which we use for local enforcement of only holding one copy of the inode in core at once (previous to this we used the glock layer). o We no longer use the unlinked "special" file. We just ignore it completely. This makes unlinking more efficient. o We now use the 4th block allocation state. The previously unused state is used to track unlinked but still open inodes. o gfs2_inoded is no longer needed o Several fields are now no longer needed (and removed) from the in core struct gfs2_inode o Several fields are no longer needed (and removed) from the in core superblock There are a number of future possible optimisations and clean ups which have been made possible by this patch. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_inode.c')
-rw-r--r--fs/gfs2/ops_inode.c168
1 files changed, 70 insertions, 98 deletions
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index 0c06f92368f2..f678f6b62afd 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -38,7 +38,6 @@
38#include "quota.h" 38#include "quota.h"
39#include "rgrp.h" 39#include "rgrp.h"
40#include "trans.h" 40#include "trans.h"
41#include "unlinked.h"
42#include "util.h" 41#include "util.h"
43 42
44/** 43/**
@@ -53,8 +52,8 @@
53static int gfs2_create(struct inode *dir, struct dentry *dentry, 52static int gfs2_create(struct inode *dir, struct dentry *dentry,
54 int mode, struct nameidata *nd) 53 int mode, struct nameidata *nd)
55{ 54{
56 struct gfs2_inode *dip = dir->u.generic_ip; 55 struct gfs2_inode *dip = GFS2_I(dir);
57 struct gfs2_sbd *sdp = dip->i_sbd; 56 struct gfs2_sbd *sdp = GFS2_SB(dir);
58 struct gfs2_holder ghs[2]; 57 struct gfs2_holder ghs[2];
59 struct inode *inode; 58 struct inode *inode;
60 int new = 1; 59 int new = 1;
@@ -141,10 +140,10 @@ static struct dentry *gfs2_lookup(struct inode *dir, struct dentry *dentry,
141static int gfs2_link(struct dentry *old_dentry, struct inode *dir, 140static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
142 struct dentry *dentry) 141 struct dentry *dentry)
143{ 142{
144 struct gfs2_inode *dip = dir->u.generic_ip; 143 struct gfs2_inode *dip = GFS2_I(dir);
145 struct gfs2_sbd *sdp = dip->i_sbd; 144 struct gfs2_sbd *sdp = GFS2_SB(dir);
146 struct inode *inode = old_dentry->d_inode; 145 struct inode *inode = old_dentry->d_inode;
147 struct gfs2_inode *ip = inode->u.generic_ip; 146 struct gfs2_inode *ip = GFS2_I(inode);
148 struct gfs2_holder ghs[2]; 147 struct gfs2_holder ghs[2];
149 int alloc_required; 148 int alloc_required;
150 int error; 149 int error;
@@ -231,30 +230,29 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
231 230
232 error = gfs2_change_nlink(ip, +1); 231 error = gfs2_change_nlink(ip, +1);
233 232
234 out_end_trans: 233out_end_trans:
235 gfs2_trans_end(sdp); 234 gfs2_trans_end(sdp);
236 235
237 out_ipres: 236out_ipres:
238 if (alloc_required) 237 if (alloc_required)
239 gfs2_inplace_release(dip); 238 gfs2_inplace_release(dip);
240 239
241 out_gunlock_q: 240out_gunlock_q:
242 if (alloc_required) 241 if (alloc_required)
243 gfs2_quota_unlock(dip); 242 gfs2_quota_unlock(dip);
244 243
245 out_alloc: 244out_alloc:
246 if (alloc_required) 245 if (alloc_required)
247 gfs2_alloc_put(dip); 246 gfs2_alloc_put(dip);
248 247
249 out_gunlock: 248out_gunlock:
250 gfs2_glock_dq_m(2, ghs); 249 gfs2_glock_dq_m(2, ghs);
251 250
252 out: 251out:
253 gfs2_holder_uninit(ghs); 252 gfs2_holder_uninit(ghs);
254 gfs2_holder_uninit(ghs + 1); 253 gfs2_holder_uninit(ghs + 1);
255 254
256 if (!error) { 255 if (!error) {
257 atomic_inc(&inode->i_count);
258 d_instantiate(dentry, inode); 256 d_instantiate(dentry, inode);
259 mark_inode_dirty(inode); 257 mark_inode_dirty(inode);
260 } 258 }
@@ -274,17 +272,12 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
274 272
275static int gfs2_unlink(struct inode *dir, struct dentry *dentry) 273static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
276{ 274{
277 struct gfs2_inode *dip = dir->u.generic_ip; 275 struct gfs2_inode *dip = GFS2_I(dir);
278 struct gfs2_sbd *sdp = dip->i_sbd; 276 struct gfs2_sbd *sdp = GFS2_SB(dir);
279 struct gfs2_inode *ip = dentry->d_inode->u.generic_ip; 277 struct gfs2_inode *ip = GFS2_I(dentry->d_inode);
280 struct gfs2_unlinked *ul;
281 struct gfs2_holder ghs[2]; 278 struct gfs2_holder ghs[2];
282 int error; 279 int error;
283 280
284 error = gfs2_unlinked_get(sdp, &ul);
285 if (error)
286 return error;
287
288 gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); 281 gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs);
289 gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1); 282 gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1);
290 283
@@ -296,24 +289,23 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
296 if (error) 289 if (error)
297 goto out_gunlock; 290 goto out_gunlock;
298 291
299 error = gfs2_trans_begin(sdp, 2 * RES_DINODE + RES_LEAF + 292 error = gfs2_trans_begin(sdp, 2*RES_DINODE + RES_LEAF + RES_RG_BIT, 0);
300 RES_UNLINKED, 0);
301 if (error) 293 if (error)
302 goto out_gunlock; 294 goto out_gunlock;
303 295
304 error = gfs2_unlinki(dip, &dentry->d_name, ip, ul); 296 error = gfs2_dir_del(dip, &dentry->d_name);
297 if (error)
298 goto out_end_trans;
305 299
306 gfs2_trans_end(sdp); 300 error = gfs2_change_nlink(ip, -1);
307 301
308 out_gunlock: 302out_end_trans:
303 gfs2_trans_end(sdp);
304out_gunlock:
309 gfs2_glock_dq_m(2, ghs); 305 gfs2_glock_dq_m(2, ghs);
310 306out:
311 out:
312 gfs2_holder_uninit(ghs); 307 gfs2_holder_uninit(ghs);
313 gfs2_holder_uninit(ghs + 1); 308 gfs2_holder_uninit(ghs + 1);
314
315 gfs2_unlinked_put(sdp, ul);
316
317 return error; 309 return error;
318} 310}
319 311
@@ -329,8 +321,8 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
329static int gfs2_symlink(struct inode *dir, struct dentry *dentry, 321static int gfs2_symlink(struct inode *dir, struct dentry *dentry,
330 const char *symname) 322 const char *symname)
331{ 323{
332 struct gfs2_inode *dip = dir->u.generic_ip, *ip; 324 struct gfs2_inode *dip = GFS2_I(dir), *ip;
333 struct gfs2_sbd *sdp = dip->i_sbd; 325 struct gfs2_sbd *sdp = GFS2_SB(dir);
334 struct gfs2_holder ghs[2]; 326 struct gfs2_holder ghs[2];
335 struct inode *inode; 327 struct inode *inode;
336 struct buffer_head *dibh; 328 struct buffer_head *dibh;
@@ -388,8 +380,8 @@ static int gfs2_symlink(struct inode *dir, struct dentry *dentry,
388 380
389static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode) 381static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode)
390{ 382{
391 struct gfs2_inode *dip = dir->u.generic_ip, *ip; 383 struct gfs2_inode *dip = GFS2_I(dir), *ip;
392 struct gfs2_sbd *sdp = dip->i_sbd; 384 struct gfs2_sbd *sdp = GFS2_SB(dir);
393 struct gfs2_holder ghs[2]; 385 struct gfs2_holder ghs[2];
394 struct inode *inode; 386 struct inode *inode;
395 struct buffer_head *dibh; 387 struct buffer_head *dibh;
@@ -466,17 +458,12 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode)
466 458
467static int gfs2_rmdir(struct inode *dir, struct dentry *dentry) 459static int gfs2_rmdir(struct inode *dir, struct dentry *dentry)
468{ 460{
469 struct gfs2_inode *dip = dir->u.generic_ip; 461 struct gfs2_inode *dip = GFS2_I(dir);
470 struct gfs2_sbd *sdp = dip->i_sbd; 462 struct gfs2_sbd *sdp = GFS2_SB(dir);
471 struct gfs2_inode *ip = dentry->d_inode->u.generic_ip; 463 struct gfs2_inode *ip = GFS2_I(dentry->d_inode);
472 struct gfs2_unlinked *ul;
473 struct gfs2_holder ghs[2]; 464 struct gfs2_holder ghs[2];
474 int error; 465 int error;
475 466
476 error = gfs2_unlinked_get(sdp, &ul);
477 if (error)
478 return error;
479
480 gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); 467 gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs);
481 gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1); 468 gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1);
482 469
@@ -499,12 +486,11 @@ static int gfs2_rmdir(struct inode *dir, struct dentry *dentry)
499 goto out_gunlock; 486 goto out_gunlock;
500 } 487 }
501 488
502 error = gfs2_trans_begin(sdp, 2 * RES_DINODE + 3 * RES_LEAF + 489 error = gfs2_trans_begin(sdp, 2 * RES_DINODE + 3 * RES_LEAF + RES_RG_BIT, 0);
503 RES_UNLINKED, 0);
504 if (error) 490 if (error)
505 goto out_gunlock; 491 goto out_gunlock;
506 492
507 error = gfs2_rmdiri(dip, &dentry->d_name, ip, ul); 493 error = gfs2_rmdiri(dip, &dentry->d_name, ip);
508 494
509 gfs2_trans_end(sdp); 495 gfs2_trans_end(sdp);
510 496
@@ -515,8 +501,6 @@ static int gfs2_rmdir(struct inode *dir, struct dentry *dentry)
515 gfs2_holder_uninit(ghs); 501 gfs2_holder_uninit(ghs);
516 gfs2_holder_uninit(ghs + 1); 502 gfs2_holder_uninit(ghs + 1);
517 503
518 gfs2_unlinked_put(sdp, ul);
519
520 return error; 504 return error;
521} 505}
522 506
@@ -532,8 +516,8 @@ static int gfs2_rmdir(struct inode *dir, struct dentry *dentry)
532static int gfs2_mknod(struct inode *dir, struct dentry *dentry, int mode, 516static int gfs2_mknod(struct inode *dir, struct dentry *dentry, int mode,
533 dev_t dev) 517 dev_t dev)
534{ 518{
535 struct gfs2_inode *dip = dir->u.generic_ip, *ip; 519 struct gfs2_inode *dip = GFS2_I(dir), *ip;
536 struct gfs2_sbd *sdp = dip->i_sbd; 520 struct gfs2_sbd *sdp = GFS2_SB(dir);
537 struct gfs2_holder ghs[2]; 521 struct gfs2_holder ghs[2];
538 struct inode *inode; 522 struct inode *inode;
539 struct buffer_head *dibh; 523 struct buffer_head *dibh;
@@ -600,12 +584,11 @@ static int gfs2_mknod(struct inode *dir, struct dentry *dentry, int mode,
600static int gfs2_rename(struct inode *odir, struct dentry *odentry, 584static int gfs2_rename(struct inode *odir, struct dentry *odentry,
601 struct inode *ndir, struct dentry *ndentry) 585 struct inode *ndir, struct dentry *ndentry)
602{ 586{
603 struct gfs2_inode *odip = odir->u.generic_ip; 587 struct gfs2_inode *odip = GFS2_I(odir);
604 struct gfs2_inode *ndip = ndir->u.generic_ip; 588 struct gfs2_inode *ndip = GFS2_I(ndir);
605 struct gfs2_inode *ip = odentry->d_inode->u.generic_ip; 589 struct gfs2_inode *ip = GFS2_I(odentry->d_inode);
606 struct gfs2_inode *nip = NULL; 590 struct gfs2_inode *nip = NULL;
607 struct gfs2_sbd *sdp = odip->i_sbd; 591 struct gfs2_sbd *sdp = GFS2_SB(odir);
608 struct gfs2_unlinked *ul;
609 struct gfs2_holder ghs[4], r_gh; 592 struct gfs2_holder ghs[4], r_gh;
610 unsigned int num_gh; 593 unsigned int num_gh;
611 int dir_rename = 0; 594 int dir_rename = 0;
@@ -614,15 +597,11 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
614 int error; 597 int error;
615 598
616 if (ndentry->d_inode) { 599 if (ndentry->d_inode) {
617 nip = ndentry->d_inode->u.generic_ip; 600 nip = GFS2_I(ndentry->d_inode);
618 if (ip == nip) 601 if (ip == nip)
619 return 0; 602 return 0;
620 } 603 }
621 604
622 error = gfs2_unlinked_get(sdp, &ul);
623 if (error)
624 return error;
625
626 /* Make sure we aren't trying to move a dirctory into it's subdir */ 605 /* Make sure we aren't trying to move a dirctory into it's subdir */
627 606
628 if (S_ISDIR(ip->i_di.di_mode) && odip != ndip) { 607 if (S_ISDIR(ip->i_di.di_mode) && odip != ndip) {
@@ -743,14 +722,12 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
743 error = gfs2_trans_begin(sdp, sdp->sd_max_dirres + 722 error = gfs2_trans_begin(sdp, sdp->sd_max_dirres +
744 al->al_rgd->rd_ri.ri_length + 723 al->al_rgd->rd_ri.ri_length +
745 4 * RES_DINODE + 4 * RES_LEAF + 724 4 * RES_DINODE + 4 * RES_LEAF +
746 RES_UNLINKED + RES_STATFS + 725 RES_STATFS + RES_QUOTA, 0);
747 RES_QUOTA, 0);
748 if (error) 726 if (error)
749 goto out_ipreserv; 727 goto out_ipreserv;
750 } else { 728 } else {
751 error = gfs2_trans_begin(sdp, 4 * RES_DINODE + 729 error = gfs2_trans_begin(sdp, 4 * RES_DINODE +
752 5 * RES_LEAF + 730 5 * RES_LEAF, 0);
753 RES_UNLINKED, 0);
754 if (error) 731 if (error)
755 goto out_gunlock; 732 goto out_gunlock;
756 } 733 }
@@ -759,9 +736,13 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
759 736
760 if (nip) { 737 if (nip) {
761 if (S_ISDIR(nip->i_di.di_mode)) 738 if (S_ISDIR(nip->i_di.di_mode))
762 error = gfs2_rmdiri(ndip, &ndentry->d_name, nip, ul); 739 error = gfs2_rmdiri(ndip, &ndentry->d_name, nip);
763 else 740 else {
764 error = gfs2_unlinki(ndip, &ndentry->d_name, nip, ul); 741 error = gfs2_dir_del(ndip, &ndentry->d_name);
742 if (error)
743 goto out_end_trans;
744 error = gfs2_change_nlink(nip, -1);
745 }
765 if (error) 746 if (error)
766 goto out_end_trans; 747 goto out_end_trans;
767 } 748 }
@@ -800,35 +781,26 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
800 if (error) 781 if (error)
801 goto out_end_trans; 782 goto out_end_trans;
802 783
803 out_end_trans: 784out_end_trans:
804 gfs2_trans_end(sdp); 785 gfs2_trans_end(sdp);
805 786out_ipreserv:
806 out_ipreserv:
807 if (alloc_required) 787 if (alloc_required)
808 gfs2_inplace_release(ndip); 788 gfs2_inplace_release(ndip);
809 789out_gunlock_q:
810 out_gunlock_q:
811 if (alloc_required) 790 if (alloc_required)
812 gfs2_quota_unlock(ndip); 791 gfs2_quota_unlock(ndip);
813 792out_alloc:
814 out_alloc:
815 if (alloc_required) 793 if (alloc_required)
816 gfs2_alloc_put(ndip); 794 gfs2_alloc_put(ndip);
817 795out_gunlock:
818 out_gunlock:
819 gfs2_glock_dq_m(num_gh, ghs); 796 gfs2_glock_dq_m(num_gh, ghs);
820 797out_uninit:
821 out_uninit:
822 for (x = 0; x < num_gh; x++) 798 for (x = 0; x < num_gh; x++)
823 gfs2_holder_uninit(ghs + x); 799 gfs2_holder_uninit(ghs + x);
824 800out_gunlock_r:
825 out_gunlock_r:
826 if (dir_rename) 801 if (dir_rename)
827 gfs2_glock_dq_uninit(&r_gh); 802 gfs2_glock_dq_uninit(&r_gh);
828 803out:
829 out:
830 gfs2_unlinked_put(sdp, ul);
831
832 return error; 804 return error;
833} 805}
834 806
@@ -844,7 +816,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
844static int gfs2_readlink(struct dentry *dentry, char __user *user_buf, 816static int gfs2_readlink(struct dentry *dentry, char __user *user_buf,
845 int user_size) 817 int user_size)
846{ 818{
847 struct gfs2_inode *ip = dentry->d_inode->u.generic_ip; 819 struct gfs2_inode *ip = GFS2_I(dentry->d_inode);
848 char array[GFS2_FAST_NAME_SIZE], *buf = array; 820 char array[GFS2_FAST_NAME_SIZE], *buf = array;
849 unsigned int len = GFS2_FAST_NAME_SIZE; 821 unsigned int len = GFS2_FAST_NAME_SIZE;
850 int error; 822 int error;
@@ -880,7 +852,7 @@ static int gfs2_readlink(struct dentry *dentry, char __user *user_buf,
880 852
881static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd) 853static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd)
882{ 854{
883 struct gfs2_inode *ip = dentry->d_inode->u.generic_ip; 855 struct gfs2_inode *ip = GFS2_I(dentry->d_inode);
884 char array[GFS2_FAST_NAME_SIZE], *buf = array; 856 char array[GFS2_FAST_NAME_SIZE], *buf = array;
885 unsigned int len = GFS2_FAST_NAME_SIZE; 857 unsigned int len = GFS2_FAST_NAME_SIZE;
886 int error; 858 int error;
@@ -906,7 +878,7 @@ static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd)
906 878
907static int gfs2_permission(struct inode *inode, int mask, struct nameidata *nd) 879static int gfs2_permission(struct inode *inode, int mask, struct nameidata *nd)
908{ 880{
909 struct gfs2_inode *ip = inode->u.generic_ip; 881 struct gfs2_inode *ip = GFS2_I(inode);
910 struct gfs2_holder i_gh; 882 struct gfs2_holder i_gh;
911 int error; 883 int error;
912 884
@@ -926,7 +898,7 @@ static int gfs2_permission(struct inode *inode, int mask, struct nameidata *nd)
926 898
927static int setattr_size(struct inode *inode, struct iattr *attr) 899static int setattr_size(struct inode *inode, struct iattr *attr)
928{ 900{
929 struct gfs2_inode *ip = inode->u.generic_ip; 901 struct gfs2_inode *ip = GFS2_I(inode);
930 int error; 902 int error;
931 903
932 if (attr->ia_size != ip->i_di.di_size) { 904 if (attr->ia_size != ip->i_di.di_size) {
@@ -944,8 +916,8 @@ static int setattr_size(struct inode *inode, struct iattr *attr)
944 916
945static int setattr_chown(struct inode *inode, struct iattr *attr) 917static int setattr_chown(struct inode *inode, struct iattr *attr)
946{ 918{
947 struct gfs2_inode *ip = inode->u.generic_ip; 919 struct gfs2_inode *ip = GFS2_I(inode);
948 struct gfs2_sbd *sdp = ip->i_sbd; 920 struct gfs2_sbd *sdp = GFS2_SB(inode);
949 struct buffer_head *dibh; 921 struct buffer_head *dibh;
950 uint32_t ouid, ogid, nuid, ngid; 922 uint32_t ouid, ogid, nuid, ngid;
951 int error; 923 int error;
@@ -1021,7 +993,7 @@ static int setattr_chown(struct inode *inode, struct iattr *attr)
1021static int gfs2_setattr(struct dentry *dentry, struct iattr *attr) 993static int gfs2_setattr(struct dentry *dentry, struct iattr *attr)
1022{ 994{
1023 struct inode *inode = dentry->d_inode; 995 struct inode *inode = dentry->d_inode;
1024 struct gfs2_inode *ip = inode->u.generic_ip; 996 struct gfs2_inode *ip = GFS2_I(inode);
1025 struct gfs2_holder i_gh; 997 struct gfs2_holder i_gh;
1026 int error; 998 int error;
1027 999
@@ -1068,7 +1040,7 @@ static int gfs2_getattr(struct vfsmount *mnt, struct dentry *dentry,
1068 struct kstat *stat) 1040 struct kstat *stat)
1069{ 1041{
1070 struct inode *inode = dentry->d_inode; 1042 struct inode *inode = dentry->d_inode;
1071 struct gfs2_inode *ip = inode->u.generic_ip; 1043 struct gfs2_inode *ip = GFS2_I(inode);
1072 struct gfs2_holder gh; 1044 struct gfs2_holder gh;
1073 int error; 1045 int error;
1074 1046
@@ -1084,7 +1056,7 @@ static int gfs2_getattr(struct vfsmount *mnt, struct dentry *dentry,
1084static int gfs2_setxattr(struct dentry *dentry, const char *name, 1056static int gfs2_setxattr(struct dentry *dentry, const char *name,
1085 const void *data, size_t size, int flags) 1057 const void *data, size_t size, int flags)
1086{ 1058{
1087 struct gfs2_inode *ip = dentry->d_inode->u.generic_ip; 1059 struct inode *inode = dentry->d_inode;
1088 struct gfs2_ea_request er; 1060 struct gfs2_ea_request er;
1089 1061
1090 memset(&er, 0, sizeof(struct gfs2_ea_request)); 1062 memset(&er, 0, sizeof(struct gfs2_ea_request));
@@ -1096,9 +1068,9 @@ static int gfs2_setxattr(struct dentry *dentry, const char *name,
1096 er.er_data_len = size; 1068 er.er_data_len = size;
1097 er.er_flags = flags; 1069 er.er_flags = flags;
1098 1070
1099 gfs2_assert_warn(ip->i_sbd, !(er.er_flags & GFS2_ERF_MODE)); 1071 gfs2_assert_warn(GFS2_SB(inode), !(er.er_flags & GFS2_ERF_MODE));
1100 1072
1101 return gfs2_ea_set(ip, &er); 1073 return gfs2_ea_set(GFS2_I(inode), &er);
1102} 1074}
1103 1075
1104static ssize_t gfs2_getxattr(struct dentry *dentry, const char *name, 1076static ssize_t gfs2_getxattr(struct dentry *dentry, const char *name,
@@ -1114,7 +1086,7 @@ static ssize_t gfs2_getxattr(struct dentry *dentry, const char *name,
1114 er.er_name_len = strlen(er.er_name); 1086 er.er_name_len = strlen(er.er_name);
1115 er.er_data_len = size; 1087 er.er_data_len = size;
1116 1088
1117 return gfs2_ea_get(dentry->d_inode->u.generic_ip, &er); 1089 return gfs2_ea_get(GFS2_I(dentry->d_inode), &er);
1118} 1090}
1119 1091
1120static ssize_t gfs2_listxattr(struct dentry *dentry, char *buffer, size_t size) 1092static ssize_t gfs2_listxattr(struct dentry *dentry, char *buffer, size_t size)
@@ -1125,7 +1097,7 @@ static ssize_t gfs2_listxattr(struct dentry *dentry, char *buffer, size_t size)
1125 er.er_data = (size) ? buffer : NULL; 1097 er.er_data = (size) ? buffer : NULL;
1126 er.er_data_len = size; 1098 er.er_data_len = size;
1127 1099
1128 return gfs2_ea_list(dentry->d_inode->u.generic_ip, &er); 1100 return gfs2_ea_list(GFS2_I(dentry->d_inode), &er);
1129} 1101}
1130 1102
1131static int gfs2_removexattr(struct dentry *dentry, const char *name) 1103static int gfs2_removexattr(struct dentry *dentry, const char *name)
@@ -1138,7 +1110,7 @@ static int gfs2_removexattr(struct dentry *dentry, const char *name)
1138 return -EOPNOTSUPP; 1110 return -EOPNOTSUPP;
1139 er.er_name_len = strlen(er.er_name); 1111 er.er_name_len = strlen(er.er_name);
1140 1112
1141 return gfs2_ea_remove(dentry->d_inode->u.generic_ip, &er); 1113 return gfs2_ea_remove(GFS2_I(dentry->d_inode), &er);
1142} 1114}
1143 1115
1144struct inode_operations gfs2_file_iops = { 1116struct inode_operations gfs2_file_iops = {