Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 38606
b: refs/heads/master
c: 18ec7d5
h: refs/heads/master
v: v3
  • Loading branch information
Steven Whitehouse committed Feb 8, 2006
1 parent db538eb commit ca5a755
Show file tree
Hide file tree
Showing 20 changed files with 722 additions and 1,478 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 257f9b4e97e9a6cceeb247cead92119a4396d37b
refs/heads/master: 18ec7d5c3f434aed9661ed10a9e1f48cdeb4981d
1 change: 0 additions & 1 deletion trunk/fs/gfs2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ gfs2-y := \
glock.o \
glops.o \
inode.o \
jdata.o \
lm.o \
log.o \
lops.o \
Expand Down
59 changes: 12 additions & 47 deletions trunk/fs/gfs2/bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
#include "bmap.h"
#include "glock.h"
#include "inode.h"
#include "jdata.h"
#include "meta_io.h"
#include "page.h"
#include "quota.h"
#include "rgrp.h"
#include "trans.h"
#include "dir.h"

/* This doesn't need to be that large as max 64 bit pointers in a 4k
* block is 512, so __u16 is fine for that. It saves stack space to
Expand Down Expand Up @@ -90,7 +90,7 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, gfs2_unstuffer_t unstuffer,
{
struct buffer_head *bh, *dibh;
uint64_t block = 0;
int journaled = gfs2_is_jdata(ip);
int isdir = gfs2_is_dir(ip);
int error;

down_write(&ip->i_rw_mutex);
Expand All @@ -103,10 +103,10 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, gfs2_unstuffer_t unstuffer,
/* Get a free block, fill it with the stuffed data,
and write it out to disk */

if (journaled) {
if (isdir) {
block = gfs2_alloc_meta(ip);

error = gfs2_jdata_get_buffer(ip, block, 1, &bh);
error = gfs2_dir_get_buffer(ip, block, 1, &bh);
if (error)
goto out_brelse;
gfs2_buffer_copy_tail(bh,
Expand Down Expand Up @@ -168,7 +168,7 @@ static unsigned int calc_tree_height(struct gfs2_inode *ip, uint64_t size)
if (ip->i_di.di_size > size)
size = ip->i_di.di_size;

if (gfs2_is_jdata(ip)) {
if (gfs2_is_dir(ip)) {
arr = sdp->sd_jheightsize;
max = sdp->sd_max_jheight;
} else {
Expand Down Expand Up @@ -377,7 +377,7 @@ static void lookup_block(struct gfs2_inode *ip, struct buffer_head *bh,
return;

if (height == ip->i_di.di_height - 1 &&
!gfs2_is_jdata(ip))
!gfs2_is_dir(ip))
*block = gfs2_alloc_data(ip);
else
*block = gfs2_alloc_meta(ip);
Expand Down Expand Up @@ -430,7 +430,7 @@ int gfs2_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
if (gfs2_assert_warn(sdp, !gfs2_is_stuffed(ip)))
goto out;

bsize = (gfs2_is_jdata(ip)) ? sdp->sd_jbsize : sdp->sd_sb.sb_bsize;
bsize = (gfs2_is_dir(ip)) ? sdp->sd_jbsize : sdp->sd_sb.sb_bsize;

height = calc_tree_height(ip, (lblock + 1) * bsize);
if (ip->i_di.di_height < height) {
Expand Down Expand Up @@ -618,7 +618,7 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh,
sm->sm_first = 0;
}

metadata = (height != ip->i_di.di_height - 1) || gfs2_is_jdata(ip);
metadata = (height != ip->i_di.di_height - 1);
if (metadata)
revokes = (height) ? sdp->sd_inptrs : sdp->sd_diptrs;

Expand Down Expand Up @@ -814,33 +814,6 @@ static int do_grow(struct gfs2_inode *ip, uint64_t size)
return error;
}

static int truncator_journaled(struct gfs2_inode *ip, uint64_t size)
{
uint64_t lbn, dbn;
uint32_t off;
struct buffer_head *bh;
int new = 0;
int error;

lbn = size;
off = do_div(lbn, ip->i_sbd->sd_jbsize);

error = gfs2_block_map(ip, lbn, &new, &dbn, NULL);
if (error || !dbn)
return error;

error = gfs2_jdata_get_buffer(ip, dbn, 0, &bh);
if (error)
return error;

gfs2_trans_add_bh(ip->i_gl, bh, 1);
gfs2_buffer_clear_tail(bh, sizeof(struct gfs2_meta_header) + off);

brelse(bh);

return 0;
}

static int trunc_start(struct gfs2_inode *ip, uint64_t size)
{
struct gfs2_sbd *sdp = ip->i_sbd;
Expand All @@ -866,12 +839,7 @@ static int trunc_start(struct gfs2_inode *ip, uint64_t size)
error = 1;

} else {
if (journaled) {
uint64_t junk = size;
/* we're just interested in the modulus */
if (do_div(junk, sdp->sd_jbsize))
error = truncator_journaled(ip, size);
} else if (size & (uint64_t)(sdp->sd_sb.sb_bsize - 1))
if (size & (uint64_t)(sdp->sd_sb.sb_bsize - 1))
error = gfs2_block_truncate_page(ip->i_vnode->i_mapping);

if (!error) {
Expand Down Expand Up @@ -900,10 +868,7 @@ static int trunc_dealloc(struct gfs2_inode *ip, uint64_t size)

if (!size)
lblock = 0;
else if (gfs2_is_jdata(ip)) {
lblock = size - 1;
do_div(lblock, ip->i_sbd->sd_jbsize);
} else
else
lblock = (size - 1) >> ip->i_sbd->sd_sb.sb_bsize_shift;

find_metapath(ip, lblock, &mp);
Expand Down Expand Up @@ -1051,7 +1016,7 @@ void gfs2_write_calc_reserv(struct gfs2_inode *ip, unsigned int len,
struct gfs2_sbd *sdp = ip->i_sbd;
unsigned int tmp;

if (gfs2_is_jdata(ip)) {
if (gfs2_is_dir(ip)) {
*data_blocks = DIV_RU(len, sdp->sd_jbsize) + 2;
*ind_blocks = 3 * (sdp->sd_max_jheight - 1);
} else {
Expand Down Expand Up @@ -1096,7 +1061,7 @@ int gfs2_write_alloc_required(struct gfs2_inode *ip, uint64_t offset,
return 0;
}

if (gfs2_is_jdata(ip)) {
if (gfs2_is_dir(ip)) {
unsigned int bsize = sdp->sd_jbsize;
lblock = offset;
do_div(lblock, bsize);
Expand Down
4 changes: 2 additions & 2 deletions trunk/fs/gfs2/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ typedef int (*leaf_call_t) (struct gfs2_inode *dip,
uint32_t index, uint32_t len, uint64_t leaf_no,
void *data);

static int gfs2_dir_get_buffer(struct gfs2_inode *ip, uint64_t block, int new,
struct buffer_head **bhp)
int gfs2_dir_get_buffer(struct gfs2_inode *ip, uint64_t block, int new,
struct buffer_head **bhp)
{
struct buffer_head *bh;
int error = 0;
Expand Down
2 changes: 2 additions & 0 deletions trunk/fs/gfs2/dir.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,7 @@ int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip);

int gfs2_diradd_alloc_required(struct gfs2_inode *dip, struct qstr *filename,
int *alloc_required);
int gfs2_dir_get_buffer(struct gfs2_inode *ip, uint64_t block, int new,
struct buffer_head **bhp);

#endif /* __DIR_DOT_H__ */
7 changes: 6 additions & 1 deletion trunk/fs/gfs2/inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ static inline int gfs2_is_jdata(struct gfs2_inode *ip)
return ip->i_di.di_flags & GFS2_DIF_JDATA;
}

static inline int gfs2_is_dir(struct gfs2_inode *ip)
{
return S_ISDIR(ip->i_di.di_mode);
}

void gfs2_inode_attr_in(struct gfs2_inode *ip);
void gfs2_inode_attr_out(struct gfs2_inode *ip);
struct inode *gfs2_ip2v_lookup(struct gfs2_inode *ip);
Expand Down Expand Up @@ -72,9 +77,9 @@ static inline int gfs2_lookup_simple(struct inode *dip, char *name,
err = gfs2_lookupi(get_v2ip(dip), &qstr, 1, &ip);
if (err == 0) {
*ipp = gfs2_ip2v(ip);
gfs2_inode_put(ip);
if (*ipp == NULL)
err = -ENOMEM;
gfs2_inode_put(ip);
}
return err;
}
Expand Down
Loading

0 comments on commit ca5a755

Please sign in to comment.