X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=fs%2Fgfs2%2Feattr.c;h=5b83ca6acab1e5f93829722844a7333f43c305fd;hb=ecd27b92fbb41f779d857632a69bd45dbaf0f915;hp=f6b5e306a6c8ca34c7a95fc88f534135de5e4725;hpb=cd915493fce912f1bd838ee1250737ecf33b8fae;p=linux-2.6 diff --git a/fs/gfs2/eattr.c b/fs/gfs2/eattr.c index f6b5e306a6..5b83ca6aca 100644 --- a/fs/gfs2/eattr.c +++ b/fs/gfs2/eattr.c @@ -7,17 +7,16 @@ * of the GNU General Public License version 2. */ -#include #include #include #include #include #include #include +#include #include #include "gfs2.h" -#include "lm_interface.h" #include "incore.h" #include "acl.h" #include "eaops.h" @@ -68,11 +67,9 @@ static int ea_check_size(struct gfs2_sbd *sdp, struct gfs2_ea_request *er) return 0; } -typedef int (*ea_call_t) (struct gfs2_inode *ip, - struct buffer_head *bh, +typedef int (*ea_call_t) (struct gfs2_inode *ip, struct buffer_head *bh, struct gfs2_ea_header *ea, - struct gfs2_ea_header *prev, - void *private); + struct gfs2_ea_header *prev, void *private); static int ea_foreach_i(struct gfs2_inode *ip, struct buffer_head *bh, ea_call_t ea_call, void *data) @@ -86,9 +83,8 @@ static int ea_foreach_i(struct gfs2_inode *ip, struct buffer_head *bh, for (ea = GFS2_EA_BH2FIRST(bh);; prev = ea, ea = GFS2_EA2NEXT(ea)) { if (!GFS2_EA_REC_LEN(ea)) goto fail; - if (!(bh->b_data <= (char *)ea && - (char *)GFS2_EA2NEXT(ea) <= - bh->b_data + bh->b_size)) + if (!(bh->b_data <= (char *)ea && (char *)GFS2_EA2NEXT(ea) <= + bh->b_data + bh->b_size)) goto fail; if (!GFS2_EATYPE_VALID(ea->ea_type)) goto fail; @@ -115,11 +111,10 @@ fail: static int ea_foreach(struct gfs2_inode *ip, ea_call_t ea_call, void *data) { struct buffer_head *bh, *eabh; - u64 *eablk, *end; + __be64 *eablk, *end; int error; - error = gfs2_meta_read(ip->i_gl, ip->i_di.di_eattr, - DIO_START | DIO_WAIT, &bh); + error = gfs2_meta_read(ip->i_gl, ip->i_di.di_eattr, DIO_WAIT, &bh); if (error) return error; @@ -133,7 +128,7 @@ static int ea_foreach(struct gfs2_inode *ip, ea_call_t ea_call, void *data) goto out; } - eablk = (u64 *)(bh->b_data + sizeof(struct gfs2_meta_header)); + eablk = (__be64 *)(bh->b_data + sizeof(struct gfs2_meta_header)); end = eablk + GFS2_SB(&ip->i_inode)->sd_inptrs; for (; eablk < end; eablk++) { @@ -143,8 +138,7 @@ static int ea_foreach(struct gfs2_inode *ip, ea_call_t ea_call, void *data) break; bn = be64_to_cpu(*eablk); - error = gfs2_meta_read(ip->i_gl, bn, DIO_START | DIO_WAIT, - &eabh); + error = gfs2_meta_read(ip->i_gl, bn, DIO_WAIT, &eabh); if (error) break; error = ea_foreach_i(ip, eabh, ea_call, data); @@ -184,12 +178,6 @@ static int ea_find_i(struct gfs2_inode *ip, struct buffer_head *bh, } } -#if 0 - else if ((ip->i_di.di_flags & GFS2_DIF_EA_PACKED) && - er->er_type == GFS2_EATYPE_SYS) - return 1; -#endif - return 0; } @@ -235,7 +223,8 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh, struct gfs2_rgrpd *rgd; struct gfs2_holder rg_gh; struct buffer_head *dibh; - u64 *dataptrs, bn = 0; + __be64 *dataptrs; + u64 bn = 0; u64 bstart = 0; unsigned int blen = 0; unsigned int blks = 0; @@ -246,11 +235,12 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh, return 0; dataptrs = GFS2_EA2DATAPTRS(ea); - for (x = 0; x < ea->ea_num_ptrs; x++, dataptrs++) + for (x = 0; x < ea->ea_num_ptrs; x++, dataptrs++) { if (*dataptrs) { blks++; bn = be64_to_cpu(*dataptrs); } + } if (!blks) return 0; @@ -264,9 +254,8 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh, if (error) return error; - error = gfs2_trans_begin(sdp, rgd->rd_ri.ri_length + - RES_DINODE + RES_EATTR + RES_STATFS + - RES_QUOTA, blks); + error = gfs2_trans_begin(sdp, rgd->rd_ri.ri_length + RES_DINODE + + RES_EATTR + RES_STATFS + RES_QUOTA, blks); if (error) goto out_gunlock; @@ -291,6 +280,7 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh, if (!ip->i_di.di_blocks) gfs2_consist_inode(ip); ip->i_di.di_blocks--; + gfs2_set_inode_blocks(&ip->i_inode); } if (bstart) gfs2_free_meta(ip, bstart, blen); @@ -310,9 +300,9 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh, error = gfs2_meta_inode_buffer(ip, &dibh); if (!error) { - ip->i_di.di_ctime = get_seconds(); + ip->i_inode.i_ctime = CURRENT_TIME_SEC; gfs2_trans_add_bh(ip->i_gl, dibh, 1); - gfs2_dinode_out(&ip->i_di, dibh->b_data); + gfs2_dinode_out(ip, dibh->b_data); brelse(dibh); } @@ -340,9 +330,7 @@ static int ea_remove_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh, if (error) goto out_quota; - error = ea_dealloc_unstuffed(ip, - bh, ea, prev, - (leave) ? &error : NULL); + error = ea_dealloc_unstuffed(ip, bh, ea, prev, (leave) ? &error : NULL); gfs2_glock_dq_uninit(&al->al_ri_gh); @@ -423,9 +411,7 @@ int gfs2_ea_list(struct gfs2_inode *ip, struct gfs2_ea_request *er) er->er_data_len = 0; } - error = gfs2_glock_nq_init(ip->i_gl, - LM_ST_SHARED, LM_FLAG_ANY, - &i_gh); + error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh); if (error) return error; @@ -445,9 +431,9 @@ int gfs2_ea_list(struct gfs2_inode *ip, struct gfs2_ea_request *er) /** * ea_get_unstuffed - actually copies the unstuffed data into the * request buffer - * @ip: - * @ea: - * @data: + * @ip: The GFS2 inode + * @ea: The extended attribute header structure + * @data: The data to be copied * * Returns: errno */ @@ -459,7 +445,7 @@ static int ea_get_unstuffed(struct gfs2_inode *ip, struct gfs2_ea_header *ea, struct buffer_head **bh; unsigned int amount = GFS2_EA_DATA_LEN(ea); unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize); - u64 *dataptrs = GFS2_EA2DATAPTRS(ea); + __be64 *dataptrs = GFS2_EA2DATAPTRS(ea); unsigned int x; int error = 0; @@ -468,8 +454,8 @@ static int ea_get_unstuffed(struct gfs2_inode *ip, struct gfs2_ea_header *ea, return -ENOMEM; for (x = 0; x < nptrs; x++) { - error = gfs2_meta_read(ip->i_gl, be64_to_cpu(*dataptrs), - DIO_START, bh + x); + error = gfs2_meta_read(ip->i_gl, be64_to_cpu(*dataptrs), 0, + bh + x); if (error) { while (x--) brelse(bh[x]); @@ -479,7 +465,7 @@ static int ea_get_unstuffed(struct gfs2_inode *ip, struct gfs2_ea_header *ea, } for (x = 0; x < nptrs; x++) { - error = gfs2_meta_reread(sdp, bh[x], DIO_WAIT); + error = gfs2_meta_wait(sdp, bh[x]); if (error) { for (; x < nptrs; x++) brelse(bh[x]); @@ -492,8 +478,7 @@ static int ea_get_unstuffed(struct gfs2_inode *ip, struct gfs2_ea_header *ea, goto out; } - memcpy(data, - bh[x]->b_data + sizeof(struct gfs2_meta_header), + memcpy(data, bh[x]->b_data + sizeof(struct gfs2_meta_header), (sdp->sd_jbsize > amount) ? amount : sdp->sd_jbsize); amount -= sdp->sd_jbsize; @@ -511,9 +496,7 @@ int gfs2_ea_get_copy(struct gfs2_inode *ip, struct gfs2_ea_location *el, char *data) { if (GFS2_EA_IS_STUFFED(el->el_ea)) { - memcpy(data, - GFS2_EA2DATA(el->el_ea), - GFS2_EA_DATA_LEN(el->el_ea)); + memcpy(data, GFS2_EA2DATA(el->el_ea), GFS2_EA_DATA_LEN(el->el_ea)); return 0; } else return ea_get_unstuffed(ip, el->el_ea, data); @@ -521,8 +504,8 @@ int gfs2_ea_get_copy(struct gfs2_inode *ip, struct gfs2_ea_location *el, /** * gfs2_ea_get_i - - * @ip: - * @er: + * @ip: The GFS2 inode + * @er: The request structure * * Returns: actual size of data on success, -errno on error */ @@ -557,8 +540,8 @@ int gfs2_ea_get_i(struct gfs2_inode *ip, struct gfs2_ea_request *er) /** * gfs2_ea_get - - * @ip: - * @er: + * @ip: The GFS2 inode + * @er: The request structure * * Returns: actual size of data on success, -errno on error */ @@ -576,9 +559,7 @@ int gfs2_ea_get(struct gfs2_inode *ip, struct gfs2_ea_request *er) er->er_data_len = 0; } - error = gfs2_glock_nq_init(ip->i_gl, - LM_ST_SHARED, LM_FLAG_ANY, - &i_gh); + error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh); if (error) return error; @@ -592,7 +573,7 @@ int gfs2_ea_get(struct gfs2_inode *ip, struct gfs2_ea_request *er) /** * ea_alloc_blk - allocates a new block for extended attributes. * @ip: A pointer to the inode that's getting extended attributes - * @bhp: + * @bhp: Pointer to pointer to a struct buffer_head * * Returns: errno */ @@ -617,6 +598,7 @@ static int ea_alloc_blk(struct gfs2_inode *ip, struct buffer_head **bhp) ea->ea_num_ptrs = 0; ip->i_di.di_blocks++; + gfs2_set_inode_blocks(&ip->i_inode); return 0; } @@ -624,8 +606,8 @@ static int ea_alloc_blk(struct gfs2_inode *ip, struct buffer_head **bhp) /** * ea_write - writes the request info to an ea, creating new blocks if * necessary - * @ip: inode that is being modified - * @ea: the location of the new ea in a block + * @ip: inode that is being modified + * @ea: the location of the new ea in a block * @er: the write request * * Note: does not update ea_rec_len or the GFS2_EAFLAG_LAST bin of ea_flags @@ -649,7 +631,7 @@ static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea, ea->ea_num_ptrs = 0; memcpy(GFS2_EA2DATA(ea), er->er_data, er->er_data_len); } else { - u64 *dataptr = GFS2_EA2DATAPTRS(ea); + __be64 *dataptr = GFS2_EA2DATAPTRS(ea); const char *data = er->er_data; unsigned int data_len = er->er_data_len; unsigned int copy; @@ -668,15 +650,16 @@ static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea, gfs2_metatype_set(bh, GFS2_METATYPE_ED, GFS2_FORMAT_ED); ip->i_di.di_blocks++; + gfs2_set_inode_blocks(&ip->i_inode); - copy = (data_len > sdp->sd_jbsize) ? sdp->sd_jbsize : - data_len; + copy = data_len > sdp->sd_jbsize ? sdp->sd_jbsize : + data_len; memcpy(bh->b_data + mh_size, data, copy); if (copy < sdp->sd_jbsize) memset(bh->b_data + mh_size + copy, 0, sdp->sd_jbsize - copy); - *dataptr++ = cpu_to_be64((u64)bh->b_blocknr); + *dataptr++ = cpu_to_be64(bh->b_blocknr); data += copy; data_len -= copy; @@ -690,13 +673,11 @@ static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea, } typedef int (*ea_skeleton_call_t) (struct gfs2_inode *ip, - struct gfs2_ea_request *er, - void *private); + struct gfs2_ea_request *er, void *private); static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er, unsigned int blks, - ea_skeleton_call_t skeleton_call, - void *private) + ea_skeleton_call_t skeleton_call, void *private) { struct gfs2_alloc *al; struct buffer_head *dibh; @@ -708,7 +689,7 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er, if (error) goto out; - error = gfs2_quota_check(ip, ip->i_di.di_uid, ip->i_di.di_gid); + error = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid); if (error) goto out_gunlock_q; @@ -732,13 +713,13 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er, if (!error) { if (er->er_flags & GFS2_ERF_MODE) { gfs2_assert_withdraw(GFS2_SB(&ip->i_inode), - (ip->i_di.di_mode & S_IFMT) == + (ip->i_inode.i_mode & S_IFMT) == (er->er_mode & S_IFMT)); - ip->i_di.di_mode = er->er_mode; + ip->i_inode.i_mode = er->er_mode; } - ip->i_di.di_ctime = get_seconds(); + ip->i_inode.i_ctime = CURRENT_TIME_SEC; gfs2_trans_add_bh(ip->i_gl, dibh, 1); - gfs2_dinode_out(&ip->i_di, dibh->b_data); + gfs2_dinode_out(ip, dibh->b_data); brelse(dibh); } @@ -868,12 +849,12 @@ static int ea_set_simple_noalloc(struct gfs2_inode *ip, struct buffer_head *bh, if (er->er_flags & GFS2_ERF_MODE) { gfs2_assert_withdraw(GFS2_SB(&ip->i_inode), - (ip->i_di.di_mode & S_IFMT) == (er->er_mode & S_IFMT)); - ip->i_di.di_mode = er->er_mode; + (ip->i_inode.i_mode & S_IFMT) == (er->er_mode & S_IFMT)); + ip->i_inode.i_mode = er->er_mode; } - ip->i_di.di_ctime = get_seconds(); + ip->i_inode.i_ctime = CURRENT_TIME_SEC; gfs2_trans_add_bh(ip->i_gl, dibh, 1); - gfs2_dinode_out(&ip->i_di, dibh->b_data); + gfs2_dinode_out(ip, dibh->b_data); brelse(dibh); out: gfs2_trans_end(GFS2_SB(&ip->i_inode)); @@ -953,15 +934,15 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er, { struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); struct buffer_head *indbh, *newbh; - u64 *eablk; + __be64 *eablk; int error; int mh_size = sizeof(struct gfs2_meta_header); if (ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT) { - u64 *end; + __be64 *end; - error = gfs2_meta_read(ip->i_gl, ip->i_di.di_eattr, - DIO_START | DIO_WAIT, &indbh); + error = gfs2_meta_read(ip->i_gl, ip->i_di.di_eattr, DIO_WAIT, + &indbh); if (error) return error; @@ -970,7 +951,7 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er, goto out; } - eablk = (u64 *)(indbh->b_data + mh_size); + eablk = (__be64 *)(indbh->b_data + mh_size); end = eablk + sdp->sd_inptrs; for (; eablk < end; eablk++) @@ -993,11 +974,12 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er, gfs2_metatype_set(indbh, GFS2_METATYPE_IN, GFS2_FORMAT_IN); gfs2_buffer_clear_tail(indbh, mh_size); - eablk = (u64 *)(indbh->b_data + mh_size); + eablk = (__be64 *)(indbh->b_data + mh_size); *eablk = cpu_to_be64(ip->i_di.di_eattr); ip->i_di.di_eattr = blk; ip->i_di.di_flags |= GFS2_DIF_EA_INDIRECT; ip->i_di.di_blocks++; + gfs2_set_inode_blocks(&ip->i_inode); eablk++; } @@ -1013,7 +995,7 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er, goto out; if (private) - ea_set_remove_stuffed(ip, (struct gfs2_ea_location *)private); + ea_set_remove_stuffed(ip, private); out: brelse(indbh); @@ -1101,8 +1083,7 @@ int gfs2_ea_set(struct gfs2_inode *ip, struct gfs2_ea_request *er) struct gfs2_holder i_gh; int error; - if (!er->er_name_len || - er->er_name_len > GFS2_EA_MAX_NAME_LEN) + if (!er->er_name_len || er->er_name_len > GFS2_EA_MAX_NAME_LEN) return -EINVAL; if (!er->er_data || !er->er_data_len) { er->er_data = NULL; @@ -1152,11 +1133,11 @@ static int ea_remove_stuffed(struct gfs2_inode *ip, struct gfs2_ea_location *el) error = gfs2_meta_inode_buffer(ip, &dibh); if (!error) { - ip->i_di.di_ctime = get_seconds(); + ip->i_inode.i_ctime = CURRENT_TIME_SEC; gfs2_trans_add_bh(ip->i_gl, dibh, 1); - gfs2_dinode_out(&ip->i_di, dibh->b_data); + gfs2_dinode_out(ip, dibh->b_data); brelse(dibh); - } + } gfs2_trans_end(GFS2_SB(&ip->i_inode)); @@ -1225,7 +1206,7 @@ static int ea_acl_chmod_unstuffed(struct gfs2_inode *ip, struct buffer_head **bh; unsigned int amount = GFS2_EA_DATA_LEN(ea); unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize); - u64 *dataptrs = GFS2_EA2DATAPTRS(ea); + __be64 *dataptrs = GFS2_EA2DATAPTRS(ea); unsigned int x; int error; @@ -1238,8 +1219,8 @@ static int ea_acl_chmod_unstuffed(struct gfs2_inode *ip, goto out; for (x = 0; x < nptrs; x++) { - error = gfs2_meta_read(ip->i_gl, be64_to_cpu(*dataptrs), - DIO_START, bh + x); + error = gfs2_meta_read(ip->i_gl, be64_to_cpu(*dataptrs), 0, + bh + x); if (error) { while (x--) brelse(bh[x]); @@ -1249,7 +1230,7 @@ static int ea_acl_chmod_unstuffed(struct gfs2_inode *ip, } for (x = 0; x < nptrs; x++) { - error = gfs2_meta_reread(sdp, bh[x], DIO_WAIT); + error = gfs2_meta_wait(sdp, bh[x]); if (error) { for (; x < nptrs; x++) brelse(bh[x]); @@ -1264,8 +1245,7 @@ static int ea_acl_chmod_unstuffed(struct gfs2_inode *ip, gfs2_trans_add_bh(ip->i_gl, bh[x], 1); - memcpy(bh[x]->b_data + sizeof(struct gfs2_meta_header), - data, + memcpy(bh[x]->b_data + sizeof(struct gfs2_meta_header), data, (sdp->sd_jbsize > amount) ? amount : sdp->sd_jbsize); amount -= sdp->sd_jbsize; @@ -1296,8 +1276,7 @@ int gfs2_ea_acl_chmod(struct gfs2_inode *ip, struct gfs2_ea_location *el, return error; gfs2_trans_add_bh(ip->i_gl, el->el_bh, 1); - memcpy(GFS2_EA2DATA(el->el_ea), - data, + memcpy(GFS2_EA2DATA(el->el_ea), data, GFS2_EA_DATA_LEN(el->el_ea)); } else error = ea_acl_chmod_unstuffed(ip, el->el_ea, data); @@ -1309,9 +1288,8 @@ int gfs2_ea_acl_chmod(struct gfs2_inode *ip, struct gfs2_ea_location *el, if (!error) { error = inode_setattr(&ip->i_inode, attr); gfs2_assert_warn(GFS2_SB(&ip->i_inode), !error); - gfs2_inode_attr_out(ip); gfs2_trans_add_bh(ip->i_gl, dibh, 1); - gfs2_dinode_out(&ip->i_di, dibh->b_data); + gfs2_dinode_out(ip, dibh->b_data); brelse(dibh); } @@ -1325,7 +1303,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip) struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); struct gfs2_rgrp_list rlist; struct buffer_head *indbh, *dibh; - u64 *eablk, *end; + __be64 *eablk, *end; unsigned int rg_blocks = 0; u64 bstart = 0; unsigned int blen = 0; @@ -1335,8 +1313,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip) memset(&rlist, 0, sizeof(struct gfs2_rgrp_list)); - error = gfs2_meta_read(ip->i_gl, ip->i_di.di_eattr, - DIO_START | DIO_WAIT, &indbh); + error = gfs2_meta_read(ip->i_gl, ip->i_di.di_eattr, DIO_WAIT, &indbh); if (error) return error; @@ -1345,7 +1322,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip) goto out; } - eablk = (u64 *)(indbh->b_data + sizeof(struct gfs2_meta_header)); + eablk = (__be64 *)(indbh->b_data + sizeof(struct gfs2_meta_header)); end = eablk + sdp->sd_inptrs; for (; eablk < end; eablk++) { @@ -1382,15 +1359,14 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip) if (error) goto out_rlist_free; - error = gfs2_trans_begin(sdp, rg_blocks + RES_DINODE + - RES_INDIRECT + RES_STATFS + - RES_QUOTA, blks); + error = gfs2_trans_begin(sdp, rg_blocks + RES_DINODE + RES_INDIRECT + + RES_STATFS + RES_QUOTA, blks); if (error) goto out_gunlock; gfs2_trans_add_bh(ip->i_gl, indbh, 1); - eablk = (u64 *)(indbh->b_data + sizeof(struct gfs2_meta_header)); + eablk = (__be64 *)(indbh->b_data + sizeof(struct gfs2_meta_header)); bstart = 0; blen = 0; @@ -1414,6 +1390,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip) if (!ip->i_di.di_blocks) gfs2_consist_inode(ip); ip->i_di.di_blocks--; + gfs2_set_inode_blocks(&ip->i_inode); } if (bstart) gfs2_free_meta(ip, bstart, blen); @@ -1423,7 +1400,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip) error = gfs2_meta_inode_buffer(ip, &dibh); if (!error) { gfs2_trans_add_bh(ip->i_gl, dibh, 1); - gfs2_dinode_out(&ip->i_di, dibh->b_data); + gfs2_dinode_out(ip, dibh->b_data); brelse(dibh); } @@ -1457,8 +1434,8 @@ static int ea_dealloc_block(struct gfs2_inode *ip) if (error) return error; - error = gfs2_trans_begin(sdp, RES_RG_BIT + RES_DINODE + - RES_STATFS + RES_QUOTA, 1); + error = gfs2_trans_begin(sdp, RES_RG_BIT + RES_DINODE + RES_STATFS + + RES_QUOTA, 1); if (error) goto out_gunlock; @@ -1468,11 +1445,12 @@ static int ea_dealloc_block(struct gfs2_inode *ip) if (!ip->i_di.di_blocks) gfs2_consist_inode(ip); ip->i_di.di_blocks--; + gfs2_set_inode_blocks(&ip->i_inode); error = gfs2_meta_inode_buffer(ip, &dibh); if (!error) { gfs2_trans_add_bh(ip->i_gl, dibh, 1); - gfs2_dinode_out(&ip->i_di, dibh->b_data); + gfs2_dinode_out(ip, dibh->b_data); brelse(dibh); }