aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/ops_inode.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-10-31 21:45:08 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2006-11-30 10:34:11 -0500
commite7f14f4d094ea1a9ce1953375f5bc1500c760c79 (patch)
treeda539b26dedd351ecb591e7ccb571b94a679452e /fs/gfs2/ops_inode.c
parentaf339c0241d0dd3b35f9097b4f4999bb22ffe502 (diff)
[GFS2] Shrink gfs2_inode (2) - di_major/di_minor
This removes the device numbers from this structure by using inode->i_rdev instead. It also cleans up the code in gfs2_mknod. It results in shrinking the gfs2_inode by 8 bytes. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_inode.c')
-rw-r--r--fs/gfs2/ops_inode.c38
1 files changed, 5 insertions, 33 deletions
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index b2c2fe613d70..c10b914bf8cc 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -59,7 +59,7 @@ static int gfs2_create(struct inode *dir, struct dentry *dentry,
59 gfs2_holder_init(dip->i_gl, 0, 0, ghs); 59 gfs2_holder_init(dip->i_gl, 0, 0, ghs);
60 60
61 for (;;) { 61 for (;;) {
62 inode = gfs2_createi(ghs, &dentry->d_name, S_IFREG | mode); 62 inode = gfs2_createi(ghs, &dentry->d_name, S_IFREG | mode, 0);
63 if (!IS_ERR(inode)) { 63 if (!IS_ERR(inode)) {
64 gfs2_trans_end(sdp); 64 gfs2_trans_end(sdp);
65 if (dip->i_alloc.al_rgd) 65 if (dip->i_alloc.al_rgd)
@@ -326,7 +326,7 @@ static int gfs2_symlink(struct inode *dir, struct dentry *dentry,
326 326
327 gfs2_holder_init(dip->i_gl, 0, 0, ghs); 327 gfs2_holder_init(dip->i_gl, 0, 0, ghs);
328 328
329 inode = gfs2_createi(ghs, &dentry->d_name, S_IFLNK | S_IRWXUGO); 329 inode = gfs2_createi(ghs, &dentry->d_name, S_IFLNK | S_IRWXUGO, 0);
330 if (IS_ERR(inode)) { 330 if (IS_ERR(inode)) {
331 gfs2_holder_uninit(ghs); 331 gfs2_holder_uninit(ghs);
332 return PTR_ERR(inode); 332 return PTR_ERR(inode);
@@ -379,7 +379,7 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode)
379 379
380 gfs2_holder_init(dip->i_gl, 0, 0, ghs); 380 gfs2_holder_init(dip->i_gl, 0, 0, ghs);
381 381
382 inode = gfs2_createi(ghs, &dentry->d_name, S_IFDIR | mode); 382 inode = gfs2_createi(ghs, &dentry->d_name, S_IFDIR | mode, 0);
383 if (IS_ERR(inode)) { 383 if (IS_ERR(inode)) {
384 gfs2_holder_uninit(ghs); 384 gfs2_holder_uninit(ghs);
385 return PTR_ERR(inode); 385 return PTR_ERR(inode);
@@ -504,47 +504,19 @@ out:
504static int gfs2_mknod(struct inode *dir, struct dentry *dentry, int mode, 504static int gfs2_mknod(struct inode *dir, struct dentry *dentry, int mode,
505 dev_t dev) 505 dev_t dev)
506{ 506{
507 struct gfs2_inode *dip = GFS2_I(dir), *ip; 507 struct gfs2_inode *dip = GFS2_I(dir);
508 struct gfs2_sbd *sdp = GFS2_SB(dir); 508 struct gfs2_sbd *sdp = GFS2_SB(dir);
509 struct gfs2_holder ghs[2]; 509 struct gfs2_holder ghs[2];
510 struct inode *inode; 510 struct inode *inode;
511 struct buffer_head *dibh;
512 u32 major = 0, minor = 0;
513 int error;
514
515 switch (mode & S_IFMT) {
516 case S_IFBLK:
517 case S_IFCHR:
518 major = MAJOR(dev);
519 minor = MINOR(dev);
520 break;
521 case S_IFIFO:
522 case S_IFSOCK:
523 break;
524 default:
525 return -EOPNOTSUPP;
526 };
527 511
528 gfs2_holder_init(dip->i_gl, 0, 0, ghs); 512 gfs2_holder_init(dip->i_gl, 0, 0, ghs);
529 513
530 inode = gfs2_createi(ghs, &dentry->d_name, mode); 514 inode = gfs2_createi(ghs, &dentry->d_name, mode, dev);
531 if (IS_ERR(inode)) { 515 if (IS_ERR(inode)) {
532 gfs2_holder_uninit(ghs); 516 gfs2_holder_uninit(ghs);
533 return PTR_ERR(inode); 517 return PTR_ERR(inode);
534 } 518 }
535 519
536 ip = ghs[1].gh_gl->gl_object;
537
538 ip->i_di.di_major = major;
539 ip->i_di.di_minor = minor;
540
541 error = gfs2_meta_inode_buffer(ip, &dibh);
542
543 if (!gfs2_assert_withdraw(sdp, !error)) {
544 gfs2_dinode_out(ip, dibh->b_data);
545 brelse(dibh);
546 }
547
548 gfs2_trans_end(sdp); 520 gfs2_trans_end(sdp);
549 if (dip->i_alloc.al_rgd) 521 if (dip->i_alloc.al_rgd)
550 gfs2_inplace_release(dip); 522 gfs2_inplace_release(dip);