[GFS2] Finish off ioctl support

This puts the finishing touches to the ioctl support and also
removes a couple of unused fields from GFS2's private per file
structure.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
This commit is contained in:
Steven Whitehouse 2006-04-04 14:29:30 -04:00
parent 76467874b8
commit 55eccc6d00
2 changed files with 13 additions and 13 deletions

View file

@ -277,12 +277,8 @@ enum {
struct gfs2_file {
unsigned long f_flags; /* GFF_... */
struct mutex f_fl_mutex;
struct gfs2_holder f_fl_gh;
struct gfs2_inode *f_inode;
struct file *f_vfile;
};
struct gfs2_revoke {

View file

@ -572,7 +572,7 @@ static int gfs2_get_flags(struct inode *inode, u32 __user *ptr)
error = gfs2_glock_nq_m_atime(1, &gh);
if (error)
return error;
iflags = iflags_cvt(gfs2_to_iflags, ip->i_di.di_flags);
if (put_user(iflags, ptr))
error = -EFAULT;
@ -600,20 +600,22 @@ static int gfs2_get_flags(struct inode *inode, u32 __user *ptr)
* @mask: Indicates which flags are valid
*
*/
static int do_gfs2_set_flags(struct inode *inode, u32 flags, u32 mask)
static int do_gfs2_set_flags(struct inode *inode, u32 reqflags, u32 mask)
{
struct gfs2_inode *ip = inode->u.generic_ip;
struct gfs2_sbd *sdp = ip->i_sbd;
struct buffer_head *bh;
struct gfs2_holder gh;
int error;
u32 new_flags;
u32 new_flags, flags;
gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
if (error)
return error;
new_flags = (ip->i_di.di_flags & ~mask) | (flags & mask);
flags = ip->i_di.di_flags;
new_flags = (flags & ~mask) | (reqflags & mask);
if ((new_flags ^ flags) == 0)
goto out;
@ -640,13 +642,18 @@ static int do_gfs2_set_flags(struct inode *inode, u32 flags, u32 mask)
if (error)
goto out;
error = gfs2_meta_inode_buffer(ip, &bh);
error = gfs2_trans_begin(sdp, RES_DINODE, 0);
if (error)
goto out;
error = gfs2_meta_inode_buffer(ip, &bh);
if (error)
goto out_trans_end;
gfs2_trans_add_bh(ip->i_gl, bh, 1);
ip->i_di.di_flags = new_flags;
gfs2_dinode_out(&ip->i_di, bh->b_data);
brelse(bh);
out_trans_end:
gfs2_trans_end(sdp);
out:
gfs2_glock_dq_uninit(&gh);
return error;
@ -730,9 +737,6 @@ static int gfs2_open(struct inode *inode, struct file *file)
mutex_init(&fp->f_fl_mutex);
fp->f_inode = ip;
fp->f_vfile = file;
gfs2_assert_warn(ip->i_sbd, !file->private_data);
file->private_data = fp;
@ -875,7 +879,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
{
struct gfs2_file *fp = file->private_data;
struct gfs2_holder *fl_gh = &fp->f_fl_gh;
struct gfs2_inode *ip = fp->f_inode;
struct gfs2_inode *ip = file->f_dentry->d_inode->u.generic_ip;
struct gfs2_glock *gl;
unsigned int state;
int flags;