aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/eattr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/eattr.c')
-rw-r--r--fs/gfs2/eattr.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/fs/gfs2/eattr.c b/fs/gfs2/eattr.c
index 146995d9cd65..8219d471f06c 100644
--- a/fs/gfs2/eattr.c
+++ b/fs/gfs2/eattr.c
@@ -13,10 +13,13 @@
13#include <linux/completion.h> 13#include <linux/completion.h>
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/xattr.h> 15#include <linux/xattr.h>
16#include <linux/gfs2_ondisk.h>
16#include <asm/semaphore.h> 17#include <asm/semaphore.h>
17#include <asm/uaccess.h> 18#include <asm/uaccess.h>
18 19
19#include "gfs2.h" 20#include "gfs2.h"
21#include "lm_interface.h"
22#include "incore.h"
20#include "acl.h" 23#include "acl.h"
21#include "eaops.h" 24#include "eaops.h"
22#include "eattr.h" 25#include "eattr.h"
@@ -26,6 +29,7 @@
26#include "quota.h" 29#include "quota.h"
27#include "rgrp.h" 30#include "rgrp.h"
28#include "trans.h" 31#include "trans.h"
32#include "util.h"
29 33
30/** 34/**
31 * ea_calc_size - returns the acutal number of bytes the request will take up 35 * ea_calc_size - returns the acutal number of bytes the request will take up
@@ -478,7 +482,7 @@ static int ea_get_unstuffed(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
478 struct gfs2_sbd *sdp = ip->i_sbd; 482 struct gfs2_sbd *sdp = ip->i_sbd;
479 struct buffer_head **bh; 483 struct buffer_head **bh;
480 unsigned int amount = GFS2_EA_DATA_LEN(ea); 484 unsigned int amount = GFS2_EA_DATA_LEN(ea);
481 unsigned int nptrs = DIV_RU(amount, sdp->sd_jbsize); 485 unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize);
482 uint64_t *dataptrs = GFS2_EA2DATAPTRS(ea); 486 uint64_t *dataptrs = GFS2_EA2DATAPTRS(ea);
483 unsigned int x; 487 unsigned int x;
484 int error = 0; 488 int error = 0;
@@ -676,7 +680,7 @@ static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
676 unsigned int copy; 680 unsigned int copy;
677 unsigned int x; 681 unsigned int x;
678 682
679 ea->ea_num_ptrs = DIV_RU(er->er_data_len, sdp->sd_jbsize); 683 ea->ea_num_ptrs = DIV_ROUND_UP(er->er_data_len, sdp->sd_jbsize);
680 for (x = 0; x < ea->ea_num_ptrs; x++) { 684 for (x = 0; x < ea->ea_num_ptrs; x++) {
681 struct buffer_head *bh; 685 struct buffer_head *bh;
682 uint64_t block; 686 uint64_t block;
@@ -810,7 +814,7 @@ static int ea_init(struct gfs2_inode *ip, struct gfs2_ea_request *er)
810 unsigned int blks = 1; 814 unsigned int blks = 1;
811 815
812 if (GFS2_EAREQ_SIZE_STUFFED(er) > jbsize) 816 if (GFS2_EAREQ_SIZE_STUFFED(er) > jbsize)
813 blks += DIV_RU(er->er_data_len, jbsize); 817 blks += DIV_ROUND_UP(er->er_data_len, jbsize);
814 818
815 return ea_alloc_skeleton(ip, er, blks, ea_init_i, NULL); 819 return ea_alloc_skeleton(ip, er, blks, ea_init_i, NULL);
816} 820}
@@ -962,7 +966,8 @@ static int ea_set_simple(struct gfs2_inode *ip, struct buffer_head *bh,
962 966
963 es->es_bh = bh; 967 es->es_bh = bh;
964 es->es_ea = ea; 968 es->es_ea = ea;
965 blks = 2 + DIV_RU(es->es_er->er_data_len, ip->i_sbd->sd_jbsize); 969 blks = 2 + DIV_ROUND_UP(es->es_er->er_data_len,
970 ip->i_sbd->sd_jbsize);
966 971
967 error = ea_alloc_skeleton(ip, es->es_er, blks, 972 error = ea_alloc_skeleton(ip, es->es_er, blks,
968 ea_set_simple_alloc, es); 973 ea_set_simple_alloc, es);
@@ -1066,7 +1071,7 @@ static int ea_set_i(struct gfs2_inode *ip, struct gfs2_ea_request *er,
1066 if (!(ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT)) 1071 if (!(ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT))
1067 blks++; 1072 blks++;
1068 if (GFS2_EAREQ_SIZE_STUFFED(er) > ip->i_sbd->sd_jbsize) 1073 if (GFS2_EAREQ_SIZE_STUFFED(er) > ip->i_sbd->sd_jbsize)
1069 blks += DIV_RU(er->er_data_len, ip->i_sbd->sd_jbsize); 1074 blks += DIV_ROUND_UP(er->er_data_len, ip->i_sbd->sd_jbsize);
1070 1075
1071 return ea_alloc_skeleton(ip, er, blks, ea_set_block, el); 1076 return ea_alloc_skeleton(ip, er, blks, ea_set_block, el);
1072} 1077}
@@ -1250,7 +1255,7 @@ static int ea_acl_chmod_unstuffed(struct gfs2_inode *ip,
1250 struct gfs2_sbd *sdp = ip->i_sbd; 1255 struct gfs2_sbd *sdp = ip->i_sbd;
1251 struct buffer_head **bh; 1256 struct buffer_head **bh;
1252 unsigned int amount = GFS2_EA_DATA_LEN(ea); 1257 unsigned int amount = GFS2_EA_DATA_LEN(ea);
1253 unsigned int nptrs = DIV_RU(amount, sdp->sd_jbsize); 1258 unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize);
1254 uint64_t *dataptrs = GFS2_EA2DATAPTRS(ea); 1259 uint64_t *dataptrs = GFS2_EA2DATAPTRS(ea);
1255 unsigned int x; 1260 unsigned int x;
1256 int error; 1261 int error;
@@ -1402,7 +1407,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
1402 1407
1403 for (x = 0; x < rlist.rl_rgrps; x++) { 1408 for (x = 0; x < rlist.rl_rgrps; x++) {
1404 struct gfs2_rgrpd *rgd; 1409 struct gfs2_rgrpd *rgd;
1405 rgd = get_gl2rgd(rlist.rl_ghs[x].gh_gl); 1410 rgd = rlist.rl_ghs[x].gh_gl->gl_object;
1406 rg_blocks += rgd->rd_ri.ri_length; 1411 rg_blocks += rgd->rd_ri.ri_length;
1407 } 1412 }
1408 1413