forked from Minki/linux
[GFS2] 80 Column audit of GFS2
Requested by: Prarit Bhargava <prarit@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
This commit is contained in:
parent
3a8fe9be6c
commit
568f4c9659
@ -129,7 +129,8 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, gfs2_unstuffer_t unstuffer,
|
||||
gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));
|
||||
|
||||
if (ip->i_di.di_size) {
|
||||
*(uint64_t *)(dibh->b_data + sizeof(struct gfs2_dinode)) = cpu_to_be64(block);
|
||||
*(uint64_t *)(dibh->b_data + sizeof(struct gfs2_dinode)) =
|
||||
cpu_to_be64(block);
|
||||
ip->i_di.di_blocks++;
|
||||
}
|
||||
|
||||
@ -241,7 +242,9 @@ static int build_height(struct gfs2_inode *ip, int height)
|
||||
gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));
|
||||
|
||||
if (new_block) {
|
||||
*(uint64_t *)(dibh->b_data + sizeof(struct gfs2_dinode)) = cpu_to_be64(block);
|
||||
*(uint64_t *)(dibh->b_data +
|
||||
sizeof(struct gfs2_dinode)) =
|
||||
cpu_to_be64(block);
|
||||
ip->i_di.di_blocks++;
|
||||
}
|
||||
|
||||
@ -313,7 +316,8 @@ static int build_height(struct gfs2_inode *ip, int height)
|
||||
*
|
||||
*/
|
||||
|
||||
static void find_metapath(struct gfs2_inode *ip, uint64_t block, struct metapath *mp)
|
||||
static void find_metapath(struct gfs2_inode *ip, uint64_t block,
|
||||
struct metapath *mp)
|
||||
{
|
||||
struct gfs2_sbd *sdp = ip->i_sbd;
|
||||
uint64_t b = block;
|
||||
|
@ -98,7 +98,8 @@ int gfs2_dir_get_buffer(struct gfs2_inode *ip, uint64_t block, int new,
|
||||
gfs2_metatype_set(bh, GFS2_METATYPE_JD, GFS2_FORMAT_JD);
|
||||
gfs2_buffer_clear_tail(bh, sizeof(struct gfs2_meta_header));
|
||||
} else {
|
||||
error = gfs2_meta_read(ip->i_gl, block, DIO_START | DIO_WAIT, &bh);
|
||||
error = gfs2_meta_read(ip->i_gl, block, DIO_START | DIO_WAIT,
|
||||
&bh);
|
||||
if (error)
|
||||
return error;
|
||||
if (gfs2_metatype_check(ip->i_sbd, bh, GFS2_METATYPE_JD)) {
|
||||
@ -163,7 +164,8 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,
|
||||
|
||||
if (gfs2_is_stuffed(ip) &&
|
||||
offset + size <= sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode))
|
||||
return gfs2_dir_write_stuffed(ip, buf, (unsigned int)offset, size);
|
||||
return gfs2_dir_write_stuffed(ip, buf, (unsigned int)offset,
|
||||
size);
|
||||
|
||||
if (gfs2_assert_warn(sdp, gfs2_is_jdata(ip)))
|
||||
return -EINVAL;
|
||||
@ -188,7 +190,8 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,
|
||||
|
||||
if (!extlen) {
|
||||
new = 1;
|
||||
error = gfs2_block_map(ip, lblock, &new, &dblock, &extlen);
|
||||
error = gfs2_block_map(ip, lblock, &new, &dblock,
|
||||
&extlen);
|
||||
if (error)
|
||||
goto fail;
|
||||
error = -EIO;
|
||||
@ -196,7 +199,9 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
error = gfs2_dir_get_buffer(ip, dblock, (amount == sdp->sd_jbsize) ? 1 : new, &bh);
|
||||
error = gfs2_dir_get_buffer(ip, dblock,
|
||||
(amount == sdp->sd_jbsize) ?
|
||||
1 : new, &bh);
|
||||
if (error)
|
||||
goto fail;
|
||||
|
||||
@ -280,7 +285,8 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, char *buf,
|
||||
return 0;
|
||||
|
||||
if (gfs2_is_stuffed(ip))
|
||||
return gfs2_dir_read_stuffed(ip, buf, (unsigned int)offset, size);
|
||||
return gfs2_dir_read_stuffed(ip, buf, (unsigned int)offset,
|
||||
size);
|
||||
|
||||
if (gfs2_assert_warn(sdp, gfs2_is_jdata(ip)))
|
||||
return -EINVAL;
|
||||
@ -299,7 +305,8 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, char *buf,
|
||||
|
||||
if (!extlen) {
|
||||
new = 0;
|
||||
error = gfs2_block_map(ip, lblock, &new, &dblock, &extlen);
|
||||
error = gfs2_block_map(ip, lblock, &new, &dblock,
|
||||
&extlen);
|
||||
if (error)
|
||||
goto fail;
|
||||
}
|
||||
@ -541,10 +548,12 @@ int gfs2_dirent_alloc(struct gfs2_inode *dip, struct buffer_head *bh,
|
||||
GFS2_DIRENT_SIZE(cur_name_len));
|
||||
memset(new, 0, sizeof(struct gfs2_dirent));
|
||||
|
||||
new->de_rec_len = cpu_to_be16(cur_rec_len - GFS2_DIRENT_SIZE(cur_name_len));
|
||||
new->de_rec_len = cpu_to_be16(cur_rec_len -
|
||||
GFS2_DIRENT_SIZE(cur_name_len));
|
||||
new->de_name_len = cpu_to_be16(name_len);
|
||||
|
||||
dent->de_rec_len = cpu_to_be16(cur_rec_len - be16_to_cpu(new->de_rec_len));
|
||||
dent->de_rec_len = cpu_to_be16(cur_rec_len -
|
||||
be16_to_cpu(new->de_rec_len));
|
||||
|
||||
*dent_out = new;
|
||||
return 0;
|
||||
@ -2281,7 +2290,8 @@ int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip)
|
||||
error = gfs2_meta_inode_buffer(dip, &bh);
|
||||
if (!error) {
|
||||
gfs2_trans_add_bh(dip->i_gl, bh, 1);
|
||||
((struct gfs2_dinode *)bh->b_data)->di_mode = cpu_to_be32(S_IFREG);
|
||||
((struct gfs2_dinode *)bh->b_data)->di_mode =
|
||||
cpu_to_be32(S_IFREG);
|
||||
brelse(bh);
|
||||
}
|
||||
|
||||
|
@ -354,7 +354,6 @@ static int ea_remove_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
|
||||
return error;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static int gfs2_ea_repack_i(struct gfs2_inode *ip)
|
||||
{
|
||||
@ -819,7 +818,8 @@ static int ea_init(struct gfs2_inode *ip, struct gfs2_ea_request *er)
|
||||
static struct gfs2_ea_header *ea_split_ea(struct gfs2_ea_header *ea)
|
||||
{
|
||||
uint32_t ea_size = GFS2_EA_SIZE(ea);
|
||||
struct gfs2_ea_header *new = (struct gfs2_ea_header *)((char *)ea + ea_size);
|
||||
struct gfs2_ea_header *new = (struct gfs2_ea_header *)((char *)ea +
|
||||
ea_size);
|
||||
uint32_t new_size = GFS2_EA_REC_LEN(ea) - ea_size;
|
||||
int last = ea->ea_flags & GFS2_EAFLAG_LAST;
|
||||
|
||||
|
@ -1034,8 +1034,10 @@ static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl,
|
||||
gfs2_tune_get(sdp, gt_new_files_directio))
|
||||
di->di_flags |= cpu_to_be32(GFS2_DIF_DIRECTIO);
|
||||
} else if (S_ISDIR(mode)) {
|
||||
di->di_flags |= cpu_to_be32(dip->i_di.di_flags & GFS2_DIF_INHERIT_DIRECTIO);
|
||||
di->di_flags |= cpu_to_be32(dip->i_di.di_flags & GFS2_DIF_INHERIT_JDATA);
|
||||
di->di_flags |= cpu_to_be32(dip->i_di.di_flags &
|
||||
GFS2_DIF_INHERIT_DIRECTIO);
|
||||
di->di_flags |= cpu_to_be32(dip->i_di.di_flags &
|
||||
GFS2_DIF_INHERIT_JDATA);
|
||||
}
|
||||
|
||||
di->__pad1 = 0;
|
||||
@ -1188,7 +1190,8 @@ static int link_dinode(struct gfs2_inode *dip, struct qstr *name,
|
||||
* Returns: An inode
|
||||
*/
|
||||
|
||||
struct inode *gfs2_createi(struct gfs2_holder *ghs, struct qstr *name, unsigned int mode)
|
||||
struct inode *gfs2_createi(struct gfs2_holder *ghs, struct qstr *name,
|
||||
unsigned int mode)
|
||||
{
|
||||
struct inode *inode;
|
||||
struct gfs2_inode *dip = get_gl2ip(ghs->gh_gl);
|
||||
|
@ -46,7 +46,8 @@ int gfs2_inode_dealloc(struct gfs2_sbd *sdp, struct gfs2_unlinked *ul);
|
||||
int gfs2_change_nlink(struct gfs2_inode *ip, int diff);
|
||||
int gfs2_lookupi(struct inode *dir, struct qstr *name, int is_root,
|
||||
struct inode **ipp);
|
||||
struct inode *gfs2_createi(struct gfs2_holder *ghs, struct qstr *name, unsigned int mode);
|
||||
struct inode *gfs2_createi(struct gfs2_holder *ghs, struct qstr *name,
|
||||
unsigned int mode);
|
||||
int gfs2_unlinki(struct gfs2_inode *dip, struct qstr *name,
|
||||
struct gfs2_inode *ip, struct gfs2_unlinked *ul);
|
||||
int gfs2_rmdiri(struct gfs2_inode *dip, struct qstr *name,
|
||||
|
@ -80,7 +80,8 @@ int gfs2_lm_mount(struct gfs2_sbd *sdp, int silent)
|
||||
void gfs2_lm_others_may_mount(struct gfs2_sbd *sdp)
|
||||
{
|
||||
if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
|
||||
sdp->sd_lockstruct.ls_ops->lm_others_may_mount(sdp->sd_lockstruct.ls_lockspace);
|
||||
sdp->sd_lockstruct.ls_ops->lm_others_may_mount(
|
||||
sdp->sd_lockstruct.ls_lockspace);
|
||||
}
|
||||
|
||||
void gfs2_lm_unmount(struct gfs2_sbd *sdp)
|
||||
@ -124,7 +125,8 @@ int gfs2_lm_get_lock(struct gfs2_sbd *sdp, struct lm_lockname *name,
|
||||
if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
|
||||
error = -EIO;
|
||||
else
|
||||
error = sdp->sd_lockstruct.ls_ops->lm_get_lock(sdp->sd_lockstruct.ls_lockspace, name, lockp);
|
||||
error = sdp->sd_lockstruct.ls_ops->lm_get_lock(
|
||||
sdp->sd_lockstruct.ls_lockspace, name, lockp);
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -230,6 +232,7 @@ void gfs2_lm_recovery_done(struct gfs2_sbd *sdp, unsigned int jid,
|
||||
unsigned int message)
|
||||
{
|
||||
if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
|
||||
sdp->sd_lockstruct.ls_ops->lm_recovery_done(sdp->sd_lockstruct.ls_lockspace, jid, message);
|
||||
sdp->sd_lockstruct.ls_ops->lm_recovery_done(
|
||||
sdp->sd_lockstruct.ls_lockspace, jid, message);
|
||||
}
|
||||
|
||||
|
@ -74,10 +74,12 @@ unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct,
|
||||
unsigned int first, second;
|
||||
|
||||
blks = 1;
|
||||
first = (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_log_descriptor)) / ssize;
|
||||
first = (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_log_descriptor)) /
|
||||
ssize;
|
||||
|
||||
if (nstruct > first) {
|
||||
second = (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_meta_header)) / ssize;
|
||||
second = (sdp->sd_sb.sb_bsize -
|
||||
sizeof(struct gfs2_meta_header)) / ssize;
|
||||
blks += DIV_RU(nstruct - first, second);
|
||||
}
|
||||
|
||||
@ -255,7 +257,8 @@ static uint64_t log_bmap(struct gfs2_sbd *sdp, unsigned int lbn)
|
||||
uint64_t dbn;
|
||||
int error;
|
||||
|
||||
error = gfs2_block_map(get_v2ip(sdp->sd_jdesc->jd_inode), lbn, &new, &dbn, NULL);
|
||||
error = gfs2_block_map(get_v2ip(sdp->sd_jdesc->jd_inode),
|
||||
lbn, &new, &dbn, NULL);
|
||||
gfs2_assert_withdraw(sdp, !error && dbn);
|
||||
|
||||
return dbn;
|
||||
@ -554,7 +557,8 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
|
||||
gfs2_assert_withdraw(sdp, ((int)sdp->sd_log_commited_revoke) >= 0);
|
||||
|
||||
if (sdp->sd_log_commited_buf)
|
||||
reserved += 1 + sdp->sd_log_commited_buf + sdp->sd_log_commited_buf/503;
|
||||
reserved += 1 + sdp->sd_log_commited_buf +
|
||||
sdp->sd_log_commited_buf/503;
|
||||
if (sdp->sd_log_commited_revoke)
|
||||
reserved += gfs2_struct2blk(sdp, sdp->sd_log_commited_revoke,
|
||||
sizeof(uint64_t));
|
||||
|
@ -137,7 +137,8 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp)
|
||||
memset(ld->ld_reserved, 0, sizeof(ld->ld_reserved));
|
||||
|
||||
n = 0;
|
||||
list_for_each_entry_continue(bd1, &sdp->sd_log_le_buf, bd_le.le_list) {
|
||||
list_for_each_entry_continue(bd1, &sdp->sd_log_le_buf,
|
||||
bd_le.le_list) {
|
||||
*ptr++ = cpu_to_be64(bd1->bd_bh->b_blocknr);
|
||||
if (++n >= num)
|
||||
break;
|
||||
@ -147,7 +148,8 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp)
|
||||
ll_rw_block(WRITE, 1, &bh);
|
||||
|
||||
n = 0;
|
||||
list_for_each_entry_continue(bd2, &sdp->sd_log_le_buf, bd_le.le_list) {
|
||||
list_for_each_entry_continue(bd2, &sdp->sd_log_le_buf,
|
||||
bd_le.le_list) {
|
||||
bh = gfs2_log_fake_buf(sdp, bd2->bd_bh);
|
||||
set_buffer_dirty(bh);
|
||||
ll_rw_block(WRITE, 1, &bh);
|
||||
@ -239,7 +241,8 @@ static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
|
||||
struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd;
|
||||
|
||||
if (error) {
|
||||
gfs2_meta_sync(get_v2ip(jd->jd_inode)->i_gl, DIO_START | DIO_WAIT);
|
||||
gfs2_meta_sync(get_v2ip(jd->jd_inode)->i_gl,
|
||||
DIO_START | DIO_WAIT);
|
||||
return;
|
||||
}
|
||||
if (pass != 1)
|
||||
@ -283,7 +286,8 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp)
|
||||
ld->ld_header.mh_type = cpu_to_be16(GFS2_METATYPE_LD);
|
||||
ld->ld_header.mh_format = cpu_to_be16(GFS2_FORMAT_LD);
|
||||
ld->ld_type = cpu_to_be32(GFS2_LOG_DESC_REVOKE);
|
||||
ld->ld_length = cpu_to_be32(gfs2_struct2blk(sdp, sdp->sd_log_num_revoke, sizeof(uint64_t)));
|
||||
ld->ld_length = cpu_to_be32(gfs2_struct2blk(sdp, sdp->sd_log_num_revoke,
|
||||
sizeof(uint64_t)));
|
||||
ld->ld_data1 = cpu_to_be32(sdp->sd_log_num_revoke);
|
||||
ld->ld_data2 = cpu_to_be32(0);
|
||||
memset(ld->ld_reserved, 0, sizeof(ld->ld_reserved));
|
||||
@ -515,19 +519,24 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
|
||||
* into the log along with a header
|
||||
*/
|
||||
gfs2_log_lock(sdp);
|
||||
bd2 = bd1 = list_prepare_entry(bd1, &sdp->sd_log_le_databuf, bd_le.le_list);
|
||||
bd2 = bd1 = list_prepare_entry(bd1, &sdp->sd_log_le_databuf,
|
||||
bd_le.le_list);
|
||||
while(total_dbuf) {
|
||||
num = total_jdata;
|
||||
if (num > limit)
|
||||
num = limit;
|
||||
n = 0;
|
||||
list_for_each_entry_safe_continue(bd1, bdt, &sdp->sd_log_le_databuf, bd_le.le_list) {
|
||||
list_for_each_entry_safe_continue(bd1, bdt,
|
||||
&sdp->sd_log_le_databuf,
|
||||
bd_le.le_list) {
|
||||
/* An ordered write buffer */
|
||||
if (bd1->bd_bh && !buffer_pinned(bd1->bd_bh)) {
|
||||
list_move(&bd1->bd_le.le_list, &started);
|
||||
if (bd1 == bd2) {
|
||||
bd2 = NULL;
|
||||
bd2 = list_prepare_entry(bd2, &sdp->sd_log_le_databuf, bd_le.le_list);
|
||||
bd2 = list_prepare_entry(bd2,
|
||||
&sdp->sd_log_le_databuf,
|
||||
bd_le.le_list);
|
||||
}
|
||||
total_dbuf--;
|
||||
if (bd1->bd_bh) {
|
||||
@ -535,7 +544,8 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
|
||||
if (buffer_dirty(bd1->bd_bh)) {
|
||||
gfs2_log_unlock(sdp);
|
||||
wait_on_buffer(bd1->bd_bh);
|
||||
ll_rw_block(WRITE, 1, &bd1->bd_bh);
|
||||
ll_rw_block(WRITE, 1,
|
||||
&bd1->bd_bh);
|
||||
gfs2_log_lock(sdp);
|
||||
}
|
||||
brelse(bd1->bd_bh);
|
||||
@ -547,12 +557,17 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
|
||||
gfs2_log_unlock(sdp);
|
||||
if (!bh) {
|
||||
bh = gfs2_log_get_buf(sdp);
|
||||
ld = (struct gfs2_log_descriptor *)bh->b_data;
|
||||
ld = (struct gfs2_log_descriptor *)
|
||||
bh->b_data;
|
||||
ptr = (__be64 *)(bh->b_data + offset);
|
||||
ld->ld_header.mh_magic = cpu_to_be32(GFS2_MAGIC);
|
||||
ld->ld_header.mh_type = cpu_to_be16(GFS2_METATYPE_LD);
|
||||
ld->ld_header.mh_format = cpu_to_be16(GFS2_FORMAT_LD);
|
||||
ld->ld_type = cpu_to_be32(GFS2_LOG_DESC_JDATA);
|
||||
ld->ld_header.mh_magic =
|
||||
cpu_to_be32(GFS2_MAGIC);
|
||||
ld->ld_header.mh_type =
|
||||
cpu_to_be16(GFS2_METATYPE_LD);
|
||||
ld->ld_header.mh_format =
|
||||
cpu_to_be16(GFS2_FORMAT_LD);
|
||||
ld->ld_type =
|
||||
cpu_to_be32(GFS2_LOG_DESC_JDATA);
|
||||
ld->ld_length = cpu_to_be32(num + 1);
|
||||
ld->ld_data1 = cpu_to_be32(num);
|
||||
ld->ld_data2 = cpu_to_be32(0);
|
||||
@ -577,7 +592,8 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
|
||||
}
|
||||
n = 0;
|
||||
gfs2_log_lock(sdp);
|
||||
list_for_each_entry_continue(bd2, &sdp->sd_log_le_databuf, bd_le.le_list) {
|
||||
list_for_each_entry_continue(bd2, &sdp->sd_log_le_databuf,
|
||||
bd_le.le_list) {
|
||||
if (!bd2->bd_bh)
|
||||
continue;
|
||||
/* copy buffer if it needs escaping */
|
||||
@ -587,7 +603,9 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
|
||||
struct page *page = bd2->bd_bh->b_page;
|
||||
bh = gfs2_log_get_buf(sdp);
|
||||
kaddr = kmap_atomic(page, KM_USER0);
|
||||
memcpy(bh->b_data, kaddr + bh_offset(bd2->bd_bh), sdp->sd_sb.sb_bsize);
|
||||
memcpy(bh->b_data,
|
||||
kaddr + bh_offset(bd2->bd_bh),
|
||||
sdp->sd_sb.sb_bsize);
|
||||
kunmap_atomic(page, KM_USER0);
|
||||
*(__be32 *)bh->b_data = 0;
|
||||
} else {
|
||||
@ -608,7 +626,8 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
|
||||
/* Wait on all ordered buffers */
|
||||
while (!list_empty(&started)) {
|
||||
gfs2_log_lock(sdp);
|
||||
bd1 = list_entry(started.next, struct gfs2_bufdata, bd_le.le_list);
|
||||
bd1 = list_entry(started.next, struct gfs2_bufdata,
|
||||
bd_le.le_list);
|
||||
list_del(&bd1->bd_le.le_list);
|
||||
sdp->sd_log_num_databuf--;
|
||||
|
||||
@ -685,7 +704,8 @@ static void databuf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
|
||||
struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd;
|
||||
|
||||
if (error) {
|
||||
gfs2_meta_sync(get_v2ip(jd->jd_inode)->i_gl, DIO_START | DIO_WAIT);
|
||||
gfs2_meta_sync(get_v2ip(jd->jd_inode)->i_gl,
|
||||
DIO_START | DIO_WAIT);
|
||||
return;
|
||||
}
|
||||
if (pass != 1)
|
||||
|
@ -16,7 +16,8 @@
|
||||
|
||||
#include "gfs2.h"
|
||||
|
||||
#define pv(struct, member, fmt) printk(" "#member" = "fmt"\n", struct->member);
|
||||
#define pv(struct, member, fmt) printk(KERN_INFO " "#member" = "fmt"\n", \
|
||||
struct->member);
|
||||
|
||||
void gfs2_quota_lvb_in(struct gfs2_quota_lvb *qb, char *lvb)
|
||||
{
|
||||
|
@ -542,7 +542,8 @@ int gfs2_meta_reread(struct gfs2_sbd *sdp, struct buffer_head *bh, int flags)
|
||||
* @meta: Flag to indicate whether its metadata or not
|
||||
*/
|
||||
|
||||
void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh, int meta)
|
||||
void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh,
|
||||
int meta)
|
||||
{
|
||||
struct gfs2_bufdata *bd;
|
||||
|
||||
@ -818,7 +819,8 @@ void gfs2_meta_ra(struct gfs2_glock *gl, uint64_t dblock, uint32_t extlen)
|
||||
struct gfs2_sbd *sdp = gl->gl_sbd;
|
||||
struct inode *aspace = gl->gl_aspace;
|
||||
struct buffer_head *first_bh, *bh;
|
||||
uint32_t max_ra = gfs2_tune_get(sdp, gt_max_readahead) >> sdp->sd_sb.sb_bsize_shift;
|
||||
uint32_t max_ra = gfs2_tune_get(sdp, gt_max_readahead) >>
|
||||
sdp->sd_sb.sb_bsize_shift;
|
||||
int error;
|
||||
|
||||
if (!extlen || !max_ra)
|
||||
|
@ -64,7 +64,8 @@ int gfs2_meta_read(struct gfs2_glock *gl, uint64_t blkno,
|
||||
int flags, struct buffer_head **bhp);
|
||||
int gfs2_meta_reread(struct gfs2_sbd *sdp, struct buffer_head *bh, int flags);
|
||||
|
||||
void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh, int meta);
|
||||
void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh,
|
||||
int meta);
|
||||
void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh);
|
||||
void gfs2_unpin(struct gfs2_sbd *sdp, struct buffer_head *bh,
|
||||
struct gfs2_ail *ai);
|
||||
|
@ -17,7 +17,8 @@
|
||||
#include "gfs2.h"
|
||||
#include <linux/gfs2_ondisk.h>
|
||||
|
||||
#define pv(struct, member, fmt) printk(KERN_INFO " "#member" = "fmt"\n", struct->member);
|
||||
#define pv(struct, member, fmt) printk(KERN_INFO " "#member" = "fmt"\n", \
|
||||
struct->member);
|
||||
#define pa(struct, member, count) print_array(#member, struct->member, count);
|
||||
|
||||
/**
|
||||
|
@ -357,7 +357,8 @@ static int gfs2_prepare_write(struct file *file, struct page *page,
|
||||
|
||||
if (gfs2_is_stuffed(ip)) {
|
||||
if (end > sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode)) {
|
||||
error = gfs2_unstuff_dinode(ip, gfs2_unstuffer_page, page);
|
||||
error = gfs2_unstuff_dinode(ip, gfs2_unstuffer_page,
|
||||
page);
|
||||
if (error == 0)
|
||||
goto prepare_write;
|
||||
} else if (!PageUptodate(page))
|
||||
@ -432,7 +433,8 @@ static int gfs2_commit_write(struct file *file, struct page *page,
|
||||
if (inode->i_size < file_size)
|
||||
i_size_write(inode, file_size);
|
||||
} else {
|
||||
if (sdp->sd_args.ar_data == GFS2_DATA_ORDERED || gfs2_is_jdata(ip))
|
||||
if (sdp->sd_args.ar_data == GFS2_DATA_ORDERED ||
|
||||
gfs2_is_jdata(ip))
|
||||
gfs2_page_add_databufs(ip, page, from, to);
|
||||
error = generic_commit_write(file, page, from, to);
|
||||
if (error)
|
||||
|
@ -531,7 +531,8 @@ static int gfs2_readdir(struct file *file, void *dirent, filldir_t filldir)
|
||||
static int gfs2_ioctl_flags(struct gfs2_inode *ip, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
unsigned int lmode = (cmd == GFS2_IOCTL_SETFLAGS) ? LM_ST_EXCLUSIVE : LM_ST_SHARED;
|
||||
unsigned int lmode = (cmd == GFS2_IOCTL_SETFLAGS) ?
|
||||
LM_ST_EXCLUSIVE : LM_ST_SHARED;
|
||||
struct buffer_head *dibh;
|
||||
struct gfs2_holder i_gh;
|
||||
int error;
|
||||
@ -559,7 +560,8 @@ static int gfs2_ioctl_flags(struct gfs2_inode *ip, unsigned int cmd,
|
||||
if (!S_ISREG(ip->i_di.di_mode))
|
||||
goto out;
|
||||
}
|
||||
if (flags & (GFS2_DIF_INHERIT_JDATA|GFS2_DIF_INHERIT_DIRECTIO)) {
|
||||
if (flags &
|
||||
(GFS2_DIF_INHERIT_JDATA|GFS2_DIF_INHERIT_DIRECTIO)) {
|
||||
if (!S_ISDIR(ip->i_di.di_mode))
|
||||
goto out;
|
||||
}
|
||||
|
@ -128,7 +128,8 @@ static void init_vfs(struct gfs2_sbd *sdp)
|
||||
to allow us to read-in the on-disk superblock. */
|
||||
sdp->sd_sb.sb_bsize = sb_min_blocksize(sb, GFS2_BASIC_BLOCK);
|
||||
sdp->sd_sb.sb_bsize_shift = sb->s_blocksize_bits;
|
||||
sdp->sd_fsb2bb_shift = sdp->sd_sb.sb_bsize_shift - GFS2_BASIC_BLOCK_SHIFT;
|
||||
sdp->sd_fsb2bb_shift = sdp->sd_sb.sb_bsize_shift -
|
||||
GFS2_BASIC_BLOCK_SHIFT;
|
||||
sdp->sd_fsb2bb = 1 << sdp->sd_fsb2bb_shift;
|
||||
}
|
||||
|
||||
@ -435,7 +436,8 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
|
||||
goto fail_jindex;
|
||||
}
|
||||
|
||||
error = gfs2_glock_nq_init(get_v2ip(sdp->sd_jdesc->jd_inode)->i_gl,
|
||||
error = gfs2_glock_nq_init(
|
||||
get_v2ip(sdp->sd_jdesc->jd_inode)->i_gl,
|
||||
LM_ST_SHARED,
|
||||
LM_FLAG_NOEXP | GL_EXACT,
|
||||
&sdp->sd_jinode_gh);
|
||||
|
@ -68,7 +68,8 @@ static int alloc_page_backing(struct gfs2_inode *ip, struct page *page)
|
||||
{
|
||||
struct gfs2_sbd *sdp = ip->i_sbd;
|
||||
unsigned long index = page->index;
|
||||
uint64_t lblock = index << (PAGE_CACHE_SHIFT - sdp->sd_sb.sb_bsize_shift);
|
||||
uint64_t lblock = index << (PAGE_CACHE_SHIFT -
|
||||
sdp->sd_sb.sb_bsize_shift);
|
||||
unsigned int blocks = PAGE_CACHE_SIZE >> sdp->sd_sb.sb_bsize_shift;
|
||||
struct gfs2_alloc *al;
|
||||
unsigned int data_blocks, ind_blocks;
|
||||
@ -143,7 +144,8 @@ static struct page *gfs2_sharewrite_nopage(struct vm_area_struct *area,
|
||||
struct gfs2_inode *ip = get_v2ip(area->vm_file->f_mapping->host);
|
||||
struct gfs2_holder i_gh;
|
||||
struct page *result = NULL;
|
||||
unsigned long index = ((address - area->vm_start) >> PAGE_CACHE_SHIFT) + area->vm_pgoff;
|
||||
unsigned long index = ((address - area->vm_start) >> PAGE_CACHE_SHIFT) +
|
||||
area->vm_pgoff;
|
||||
int alloc_required;
|
||||
int error;
|
||||
|
||||
|
@ -395,7 +395,8 @@ static int qd_trylock(struct gfs2_quota_data *qd)
|
||||
|
||||
static void qd_unlock(struct gfs2_quota_data *qd)
|
||||
{
|
||||
gfs2_assert_warn(qd->qd_gl->gl_sbd, test_bit(QDF_LOCKED, &qd->qd_flags));
|
||||
gfs2_assert_warn(qd->qd_gl->gl_sbd,
|
||||
test_bit(QDF_LOCKED, &qd->qd_flags));
|
||||
clear_bit(QDF_LOCKED, &qd->qd_flags);
|
||||
bh_put(qd);
|
||||
slot_put(qd);
|
||||
@ -715,7 +716,8 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
|
||||
qd = qda[x];
|
||||
offset = qd2offset(qd);
|
||||
error = gfs2_adjust_quota(ip, offset, qd->qd_change_sync,
|
||||
(struct gfs2_quota_data *)qd->qd_gl->gl_lvb);
|
||||
(struct gfs2_quota_data *)
|
||||
qd->qd_gl->gl_lvb);
|
||||
if (error)
|
||||
goto out_end_trans;
|
||||
|
||||
@ -932,7 +934,8 @@ static int print_message(struct gfs2_quota_data *qd, char *type)
|
||||
if (!line)
|
||||
return -ENOMEM;
|
||||
|
||||
len = snprintf(line, MAX_LINE-1, "GFS2: fsid=%s: quota %s for %s %u\r\n",
|
||||
len = snprintf(line, MAX_LINE-1,
|
||||
"GFS2: fsid=%s: quota %s for %s %u\r\n",
|
||||
sdp->sd_fsname, type,
|
||||
(test_bit(QDF_USER, &qd->qd_flags)) ? "user" : "group",
|
||||
qd->qd_id);
|
||||
@ -981,7 +984,8 @@ int gfs2_quota_check(struct gfs2_inode *ip, uint32_t uid, uint32_t gid)
|
||||
} else if (qd->qd_qb.qb_warn &&
|
||||
(int64_t)qd->qd_qb.qb_warn < value &&
|
||||
time_after_eq(jiffies, qd->qd_last_warn +
|
||||
gfs2_tune_get(sdp, gt_quota_warn_period) * HZ)) {
|
||||
gfs2_tune_get(sdp,
|
||||
gt_quota_warn_period) * HZ)) {
|
||||
error = print_message(qd, "warning");
|
||||
qd->qd_last_warn = jiffies;
|
||||
}
|
||||
|
@ -33,7 +33,8 @@ int gfs2_replay_read_block(struct gfs2_jdesc *jd, unsigned int blk,
|
||||
uint32_t extlen;
|
||||
int error;
|
||||
|
||||
error = gfs2_block_map(get_v2ip(jd->jd_inode), blk, &new, &dblock, &extlen);
|
||||
error = gfs2_block_map(get_v2ip(jd->jd_inode), blk, &new, &dblock,
|
||||
&extlen);
|
||||
if (error)
|
||||
return error;
|
||||
if (!dblock) {
|
||||
|
@ -233,7 +233,8 @@ static int compute_bitstructs(struct gfs2_rgrpd *rgd)
|
||||
bi->bi_len = bytes;
|
||||
/* other blocks */
|
||||
} else {
|
||||
bytes = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_meta_header);
|
||||
bytes = sdp->sd_sb.sb_bsize -
|
||||
sizeof(struct gfs2_meta_header);
|
||||
bi->bi_offset = sizeof(struct gfs2_meta_header);
|
||||
bi->bi_start = rgd->rd_ri.ri_bitbytes - bytes_left;
|
||||
bi->bi_len = bytes;
|
||||
|
@ -110,36 +110,43 @@ int gfs2_check_sb(struct gfs2_sbd *sdp, struct gfs2_sb *sb, int silent)
|
||||
break;
|
||||
|
||||
if (!gfs2_old_fs_formats[x]) {
|
||||
printk(KERN_WARNING "GFS2: code version (%u, %u) is incompatible "
|
||||
printk(KERN_WARNING
|
||||
"GFS2: code version (%u, %u) is incompatible "
|
||||
"with ondisk format (%u, %u)\n",
|
||||
GFS2_FORMAT_FS, GFS2_FORMAT_MULTI,
|
||||
sb->sb_fs_format, sb->sb_multihost_format);
|
||||
printk(KERN_WARNING "GFS2: I don't know how to upgrade this FS\n");
|
||||
printk(KERN_WARNING
|
||||
"GFS2: I don't know how to upgrade this FS\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
if (sb->sb_multihost_format != GFS2_FORMAT_MULTI) {
|
||||
for (x = 0; gfs2_old_multihost_formats[x]; x++)
|
||||
if (gfs2_old_multihost_formats[x] == sb->sb_multihost_format)
|
||||
if (gfs2_old_multihost_formats[x] ==
|
||||
sb->sb_multihost_format)
|
||||
break;
|
||||
|
||||
if (!gfs2_old_multihost_formats[x]) {
|
||||
printk(KERN_WARNING "GFS2: code version (%u, %u) is incompatible "
|
||||
printk(KERN_WARNING
|
||||
"GFS2: code version (%u, %u) is incompatible "
|
||||
"with ondisk format (%u, %u)\n",
|
||||
GFS2_FORMAT_FS, GFS2_FORMAT_MULTI,
|
||||
sb->sb_fs_format, sb->sb_multihost_format);
|
||||
printk(KERN_WARNING "GFS2: I don't know how to upgrade this FS\n");
|
||||
printk(KERN_WARNING
|
||||
"GFS2: I don't know how to upgrade this FS\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!sdp->sd_args.ar_upgrade) {
|
||||
printk(KERN_WARNING "GFS2: code version (%u, %u) is incompatible "
|
||||
printk(KERN_WARNING
|
||||
"GFS2: code version (%u, %u) is incompatible "
|
||||
"with ondisk format (%u, %u)\n",
|
||||
GFS2_FORMAT_FS, GFS2_FORMAT_MULTI,
|
||||
sb->sb_fs_format, sb->sb_multihost_format);
|
||||
printk(KERN_INFO "GFS2: Use the \"upgrade\" mount option to upgrade "
|
||||
printk(KERN_INFO
|
||||
"GFS2: Use the \"upgrade\" mount option to upgrade "
|
||||
"the FS\n");
|
||||
printk(KERN_INFO "GFS2: See the manual for more details\n");
|
||||
return -EINVAL;
|
||||
@ -289,7 +296,8 @@ int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)
|
||||
|
||||
name.len = sprintf(buf, "journal%u", sdp->sd_journals);
|
||||
|
||||
error = gfs2_dir_search(get_v2ip(sdp->sd_jindex), &name, NULL, NULL);
|
||||
error = gfs2_dir_search(get_v2ip(sdp->sd_jindex),
|
||||
&name, NULL, NULL);
|
||||
if (error == -ENOENT) {
|
||||
error = 0;
|
||||
break;
|
||||
@ -445,7 +453,8 @@ int gfs2_lookup_master_dir(struct gfs2_sbd *sdp)
|
||||
sdp->sd_sb.sb_master_dir.no_addr,
|
||||
&gfs2_inode_glops, CREATE, &gl);
|
||||
if (!error) {
|
||||
error = gfs2_lookup_simple(sdp->sd_root_dir, ".gfs2_admin", &inode);
|
||||
error = gfs2_lookup_simple(sdp->sd_root_dir, ".gfs2_admin",
|
||||
&inode);
|
||||
sdp->sd_master_dir = inode;
|
||||
gfs2_glock_put(gl);
|
||||
}
|
||||
@ -854,7 +863,8 @@ int gfs2_lock_fs_check_clean(struct gfs2_sbd *sdp, struct gfs2_holder *t_gh)
|
||||
error = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
error = gfs2_glock_nq_init(get_v2ip(jd->jd_inode)->i_gl, LM_ST_SHARED, 0,
|
||||
error = gfs2_glock_nq_init(get_v2ip(jd->jd_inode)->i_gl,
|
||||
LM_ST_SHARED, 0,
|
||||
&lfcc->gh);
|
||||
if (error) {
|
||||
kfree(lfcc);
|
||||
|
Loading…
Reference in New Issue
Block a user