Commit f2c80837 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'gfs2-for-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2

Pull gfs2 updates from Andreas Gruenbacher:

 - Fix some compiler and kernel-doc warnings

 - Various minor cleanups and optimizations

 - Add a new sysfs gfs2 status file with some filesystem wide
   information

* tag 'gfs2-for-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2:
  gfs2: Fix fall-through warnings for Clang
  gfs2: Fix a number of kernel-doc warnings
  gfs2: Make gfs2_setattr_simple static
  gfs2: Add new sysfs file for gfs2 status
  gfs2: Silence possible null pointer dereference warning
  gfs2: Turn gfs2_meta_indirect_buffer into gfs2_meta_buffer
  gfs2: Replace gfs2_lblk_to_dblk with gfs2_get_extent
  gfs2: Turn gfs2_extent_map into gfs2_{get,alloc}_extent
  gfs2: Add new gfs2_iomap_get helper
  gfs2: Remove unused variable sb_format
  gfs2: Fix dir.c function parameter descriptions
  gfs2: Eliminate gh parameter from go_xmote_bh func
  gfs2: don't create empty buffers for NO_CREATE
parents 8ae8932c e5966cf2
...@@ -540,10 +540,7 @@ int gfs2_internal_read(struct gfs2_inode *ip, char *buf, loff_t *pos, ...@@ -540,10 +540,7 @@ int gfs2_internal_read(struct gfs2_inode *ip, char *buf, loff_t *pos,
/** /**
* gfs2_readahead - Read a bunch of pages at once * gfs2_readahead - Read a bunch of pages at once
* @file: The file to read from * @rac: Read-ahead control structure
* @mapping: Address space info
* @pages: List of pages to read
* @nr_pages: Number of pages to read
* *
* Some notes: * Some notes:
* 1. This is only for readahead, so we can simply ignore any things * 1. This is only for readahead, so we can simply ignore any things
......
...@@ -331,7 +331,7 @@ static int __fillup_metapath(struct gfs2_inode *ip, struct metapath *mp, ...@@ -331,7 +331,7 @@ static int __fillup_metapath(struct gfs2_inode *ip, struct metapath *mp,
if (!dblock) if (!dblock)
break; break;
ret = gfs2_meta_indirect_buffer(ip, x + 1, dblock, &mp->mp_bh[x + 1]); ret = gfs2_meta_buffer(ip, GFS2_METATYPE_IN, dblock, &mp->mp_bh[x + 1]);
if (ret) if (ret)
return ret; return ret;
} }
...@@ -632,7 +632,7 @@ enum alloc_state { ...@@ -632,7 +632,7 @@ enum alloc_state {
}; };
/** /**
* gfs2_iomap_alloc - Build a metadata tree of the requested height * __gfs2_iomap_alloc - Build a metadata tree of the requested height
* @inode: The GFS2 inode * @inode: The GFS2 inode
* @iomap: The iomap structure * @iomap: The iomap structure
* @mp: The metapath, with proper height information calculated * @mp: The metapath, with proper height information calculated
...@@ -642,7 +642,7 @@ enum alloc_state { ...@@ -642,7 +642,7 @@ enum alloc_state {
* ii) Indirect blocks to fill in lower part of the metadata tree * ii) Indirect blocks to fill in lower part of the metadata tree
* iii) Data blocks * iii) Data blocks
* *
* This function is called after gfs2_iomap_get, which works out the * This function is called after __gfs2_iomap_get, which works out the
* total number of blocks which we need via gfs2_alloc_size. * total number of blocks which we need via gfs2_alloc_size.
* *
* We then do the actual allocation asking for an extent at a time (if * We then do the actual allocation asking for an extent at a time (if
...@@ -660,8 +660,8 @@ enum alloc_state { ...@@ -660,8 +660,8 @@ enum alloc_state {
* Returns: errno on error * Returns: errno on error
*/ */
static int gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap, static int __gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap,
struct metapath *mp) struct metapath *mp)
{ {
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_sbd *sdp = GFS2_SB(inode); struct gfs2_sbd *sdp = GFS2_SB(inode);
...@@ -802,10 +802,10 @@ static u64 gfs2_alloc_size(struct inode *inode, struct metapath *mp, u64 size) ...@@ -802,10 +802,10 @@ static u64 gfs2_alloc_size(struct inode *inode, struct metapath *mp, u64 size)
/* /*
* For writes to stuffed files, this function is called twice via * For writes to stuffed files, this function is called twice via
* gfs2_iomap_get, before and after unstuffing. The size we return the * __gfs2_iomap_get, before and after unstuffing. The size we return the
* first time needs to be large enough to get the reservation and * first time needs to be large enough to get the reservation and
* allocation sizes right. The size we return the second time must * allocation sizes right. The size we return the second time must
* be exact or else gfs2_iomap_alloc won't do the right thing. * be exact or else __gfs2_iomap_alloc won't do the right thing.
*/ */
if (gfs2_is_stuffed(ip) || mp->mp_fheight != mp->mp_aheight) { if (gfs2_is_stuffed(ip) || mp->mp_fheight != mp->mp_aheight) {
...@@ -829,7 +829,7 @@ static u64 gfs2_alloc_size(struct inode *inode, struct metapath *mp, u64 size) ...@@ -829,7 +829,7 @@ static u64 gfs2_alloc_size(struct inode *inode, struct metapath *mp, u64 size)
} }
/** /**
* gfs2_iomap_get - Map blocks from an inode to disk blocks * __gfs2_iomap_get - Map blocks from an inode to disk blocks
* @inode: The inode * @inode: The inode
* @pos: Starting position in bytes * @pos: Starting position in bytes
* @length: Length to map, in bytes * @length: Length to map, in bytes
...@@ -839,9 +839,9 @@ static u64 gfs2_alloc_size(struct inode *inode, struct metapath *mp, u64 size) ...@@ -839,9 +839,9 @@ static u64 gfs2_alloc_size(struct inode *inode, struct metapath *mp, u64 size)
* *
* Returns: errno * Returns: errno
*/ */
static int gfs2_iomap_get(struct inode *inode, loff_t pos, loff_t length, static int __gfs2_iomap_get(struct inode *inode, loff_t pos, loff_t length,
unsigned flags, struct iomap *iomap, unsigned flags, struct iomap *iomap,
struct metapath *mp) struct metapath *mp)
{ {
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_sbd *sdp = GFS2_SB(inode); struct gfs2_sbd *sdp = GFS2_SB(inode);
...@@ -961,32 +961,6 @@ static int gfs2_iomap_get(struct inode *inode, loff_t pos, loff_t length, ...@@ -961,32 +961,6 @@ static int gfs2_iomap_get(struct inode *inode, loff_t pos, loff_t length,
goto out; goto out;
} }
/**
* gfs2_lblk_to_dblk - convert logical block to disk block
* @inode: the inode of the file we're mapping
* @lblock: the block relative to the start of the file
* @dblock: the returned dblock, if no error
*
* This function maps a single block from a file logical block (relative to
* the start of the file) to a file system absolute block using iomap.
*
* Returns: the absolute file system block, or an error
*/
int gfs2_lblk_to_dblk(struct inode *inode, u32 lblock, u64 *dblock)
{
struct iomap iomap = { };
struct metapath mp = { .mp_aheight = 1, };
loff_t pos = (loff_t)lblock << inode->i_blkbits;
int ret;
ret = gfs2_iomap_get(inode, pos, i_blocksize(inode), 0, &iomap, &mp);
release_metapath(&mp);
if (ret == 0)
*dblock = iomap.addr >> inode->i_blkbits;
return ret;
}
static int gfs2_write_lock(struct inode *inode) static int gfs2_write_lock(struct inode *inode)
{ {
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
...@@ -1109,14 +1083,14 @@ static int gfs2_iomap_begin_write(struct inode *inode, loff_t pos, ...@@ -1109,14 +1083,14 @@ static int gfs2_iomap_begin_write(struct inode *inode, loff_t pos,
if (ret) if (ret)
goto out_trans_end; goto out_trans_end;
release_metapath(mp); release_metapath(mp);
ret = gfs2_iomap_get(inode, iomap->offset, ret = __gfs2_iomap_get(inode, iomap->offset,
iomap->length, flags, iomap, mp); iomap->length, flags, iomap, mp);
if (ret) if (ret)
goto out_trans_end; goto out_trans_end;
} }
if (iomap->type == IOMAP_HOLE) { if (iomap->type == IOMAP_HOLE) {
ret = gfs2_iomap_alloc(inode, iomap, mp); ret = __gfs2_iomap_alloc(inode, iomap, mp);
if (ret) { if (ret) {
gfs2_trans_end(sdp); gfs2_trans_end(sdp);
gfs2_inplace_release(ip); gfs2_inplace_release(ip);
...@@ -1168,7 +1142,7 @@ static int gfs2_iomap_begin(struct inode *inode, loff_t pos, loff_t length, ...@@ -1168,7 +1142,7 @@ static int gfs2_iomap_begin(struct inode *inode, loff_t pos, loff_t length,
goto out; goto out;
} }
ret = gfs2_iomap_get(inode, pos, length, flags, iomap, &mp); ret = __gfs2_iomap_get(inode, pos, length, flags, iomap, &mp);
if (ret) if (ret)
goto out_unlock; goto out_unlock;
...@@ -1290,9 +1264,7 @@ int gfs2_block_map(struct inode *inode, sector_t lblock, ...@@ -1290,9 +1264,7 @@ int gfs2_block_map(struct inode *inode, sector_t lblock,
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
loff_t pos = (loff_t)lblock << inode->i_blkbits; loff_t pos = (loff_t)lblock << inode->i_blkbits;
loff_t length = bh_map->b_size; loff_t length = bh_map->b_size;
struct metapath mp = { .mp_aheight = 1, };
struct iomap iomap = { }; struct iomap iomap = { };
int flags = create ? IOMAP_WRITE : 0;
int ret; int ret;
clear_buffer_mapped(bh_map); clear_buffer_mapped(bh_map);
...@@ -1300,10 +1272,10 @@ int gfs2_block_map(struct inode *inode, sector_t lblock, ...@@ -1300,10 +1272,10 @@ int gfs2_block_map(struct inode *inode, sector_t lblock,
clear_buffer_boundary(bh_map); clear_buffer_boundary(bh_map);
trace_gfs2_bmap(ip, bh_map, lblock, create, 1); trace_gfs2_bmap(ip, bh_map, lblock, create, 1);
ret = gfs2_iomap_get(inode, pos, length, flags, &iomap, &mp); if (!create)
if (create && !ret && iomap.type == IOMAP_HOLE) ret = gfs2_iomap_get(inode, pos, length, &iomap);
ret = gfs2_iomap_alloc(inode, &iomap, &mp); else
release_metapath(&mp); ret = gfs2_iomap_alloc(inode, pos, length, &iomap);
if (ret) if (ret)
goto out; goto out;
...@@ -1324,28 +1296,47 @@ int gfs2_block_map(struct inode *inode, sector_t lblock, ...@@ -1324,28 +1296,47 @@ int gfs2_block_map(struct inode *inode, sector_t lblock,
return ret; return ret;
} }
/* int gfs2_get_extent(struct inode *inode, u64 lblock, u64 *dblock,
* Deprecated: do not use in new code unsigned int *extlen)
*/
int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsigned *extlen)
{ {
struct buffer_head bh = { .b_state = 0, .b_blocknr = 0 }; unsigned int blkbits = inode->i_blkbits;
struct iomap iomap = { };
unsigned int len;
int ret; int ret;
int create = *new;
ret = gfs2_iomap_get(inode, lblock << blkbits, *extlen << blkbits,
BUG_ON(!extlen); &iomap);
BUG_ON(!dblock); if (ret)
BUG_ON(!new); return ret;
if (iomap.type != IOMAP_MAPPED)
bh.b_size = BIT(inode->i_blkbits + (create ? 0 : 5)); return -EIO;
ret = gfs2_block_map(inode, lblock, &bh, create); *dblock = iomap.addr >> blkbits;
*extlen = bh.b_size >> inode->i_blkbits; len = iomap.length >> blkbits;
*dblock = bh.b_blocknr; if (len < *extlen)
if (buffer_new(&bh)) *extlen = len;
*new = 1; return 0;
else }
*new = 0;
return ret; int gfs2_alloc_extent(struct inode *inode, u64 lblock, u64 *dblock,
unsigned int *extlen, bool *new)
{
unsigned int blkbits = inode->i_blkbits;
struct iomap iomap = { };
unsigned int len;
int ret;
ret = gfs2_iomap_alloc(inode, lblock << blkbits, *extlen << blkbits,
&iomap);
if (ret)
return ret;
if (iomap.type != IOMAP_MAPPED)
return -EIO;
*dblock = iomap.addr >> blkbits;
len = iomap.length >> blkbits;
if (len < *extlen)
*extlen = len;
*new = iomap.flags & IOMAP_F_NEW;
return 0;
} }
/* /*
...@@ -1461,15 +1452,26 @@ static int trunc_start(struct inode *inode, u64 newsize) ...@@ -1461,15 +1452,26 @@ static int trunc_start(struct inode *inode, u64 newsize)
return error; return error;
} }
int gfs2_iomap_get_alloc(struct inode *inode, loff_t pos, loff_t length, int gfs2_iomap_get(struct inode *inode, loff_t pos, loff_t length,
struct iomap *iomap) struct iomap *iomap)
{ {
struct metapath mp = { .mp_aheight = 1, }; struct metapath mp = { .mp_aheight = 1, };
int ret; int ret;
ret = gfs2_iomap_get(inode, pos, length, IOMAP_WRITE, iomap, &mp); ret = __gfs2_iomap_get(inode, pos, length, 0, iomap, &mp);
release_metapath(&mp);
return ret;
}
int gfs2_iomap_alloc(struct inode *inode, loff_t pos, loff_t length,
struct iomap *iomap)
{
struct metapath mp = { .mp_aheight = 1, };
int ret;
ret = __gfs2_iomap_get(inode, pos, length, IOMAP_WRITE, iomap, &mp);
if (!ret && iomap->type == IOMAP_HOLE) if (!ret && iomap->type == IOMAP_HOLE)
ret = gfs2_iomap_alloc(inode, iomap, &mp); ret = __gfs2_iomap_alloc(inode, iomap, &mp);
release_metapath(&mp); release_metapath(&mp);
return ret; return ret;
} }
...@@ -1477,7 +1479,7 @@ int gfs2_iomap_get_alloc(struct inode *inode, loff_t pos, loff_t length, ...@@ -1477,7 +1479,7 @@ int gfs2_iomap_get_alloc(struct inode *inode, loff_t pos, loff_t length,
/** /**
* sweep_bh_for_rgrps - find an rgrp in a meta buffer and free blocks therein * sweep_bh_for_rgrps - find an rgrp in a meta buffer and free blocks therein
* @ip: inode * @ip: inode
* @rg_gh: holder of resource group glock * @rd_gh: holder of resource group glock
* @bh: buffer head to sweep * @bh: buffer head to sweep
* @start: starting point in bh * @start: starting point in bh
* @end: end point in bh * @end: end point in bh
...@@ -1658,8 +1660,11 @@ static bool mp_eq_to_hgt(struct metapath *mp, __u16 *list, unsigned int h) ...@@ -1658,8 +1660,11 @@ static bool mp_eq_to_hgt(struct metapath *mp, __u16 *list, unsigned int h)
/** /**
* find_nonnull_ptr - find a non-null pointer given a metapath and height * find_nonnull_ptr - find a non-null pointer given a metapath and height
* @sdp: The superblock
* @mp: starting metapath * @mp: starting metapath
* @h: desired height to search * @h: desired height to search
* @end_list: See punch_hole().
* @end_aligned: See punch_hole().
* *
* Assumes the metapath is valid (with buffers) out to height h. * Assumes the metapath is valid (with buffers) out to height h.
* Returns: true if a non-null pointer was found in the metapath buffer * Returns: true if a non-null pointer was found in the metapath buffer
...@@ -2519,7 +2524,6 @@ int __gfs2_punch_hole(struct file *file, loff_t offset, loff_t length) ...@@ -2519,7 +2524,6 @@ int __gfs2_punch_hole(struct file *file, loff_t offset, loff_t length)
static int gfs2_map_blocks(struct iomap_writepage_ctx *wpc, struct inode *inode, static int gfs2_map_blocks(struct iomap_writepage_ctx *wpc, struct inode *inode,
loff_t offset) loff_t offset)
{ {
struct metapath mp = { .mp_aheight = 1, };
int ret; int ret;
if (WARN_ON_ONCE(gfs2_is_stuffed(GFS2_I(inode)))) if (WARN_ON_ONCE(gfs2_is_stuffed(GFS2_I(inode))))
...@@ -2530,8 +2534,7 @@ static int gfs2_map_blocks(struct iomap_writepage_ctx *wpc, struct inode *inode, ...@@ -2530,8 +2534,7 @@ static int gfs2_map_blocks(struct iomap_writepage_ctx *wpc, struct inode *inode,
return 0; return 0;
memset(&wpc->iomap, 0, sizeof(wpc->iomap)); memset(&wpc->iomap, 0, sizeof(wpc->iomap));
ret = gfs2_iomap_get(inode, offset, INT_MAX, 0, &wpc->iomap, &mp); ret = gfs2_iomap_get(inode, offset, INT_MAX, &wpc->iomap);
release_metapath(&mp);
return ret; return ret;
} }
......
...@@ -49,10 +49,14 @@ extern const struct iomap_writeback_ops gfs2_writeback_ops; ...@@ -49,10 +49,14 @@ extern const struct iomap_writeback_ops gfs2_writeback_ops;
extern int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page); extern int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page);
extern int gfs2_block_map(struct inode *inode, sector_t lblock, extern int gfs2_block_map(struct inode *inode, sector_t lblock,
struct buffer_head *bh, int create); struct buffer_head *bh, int create);
extern int gfs2_iomap_get_alloc(struct inode *inode, loff_t pos, loff_t length, extern int gfs2_iomap_get(struct inode *inode, loff_t pos, loff_t length,
struct iomap *iomap); struct iomap *iomap);
extern int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, extern int gfs2_iomap_alloc(struct inode *inode, loff_t pos, loff_t length,
u64 *dblock, unsigned *extlen); struct iomap *iomap);
extern int gfs2_get_extent(struct inode *inode, u64 lblock, u64 *dblock,
unsigned int *extlen);
extern int gfs2_alloc_extent(struct inode *inode, u64 lblock, u64 *dblock,
unsigned *extlen, bool *new);
extern int gfs2_setattr_size(struct inode *inode, u64 size); extern int gfs2_setattr_size(struct inode *inode, u64 size);
extern void gfs2_trim_blocks(struct inode *inode); extern void gfs2_trim_blocks(struct inode *inode);
extern int gfs2_truncatei_resume(struct gfs2_inode *ip); extern int gfs2_truncatei_resume(struct gfs2_inode *ip);
...@@ -62,6 +66,5 @@ extern int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset, ...@@ -62,6 +66,5 @@ extern int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset,
extern int gfs2_map_journal_extents(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd); extern int gfs2_map_journal_extents(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd);
extern void gfs2_free_journal_extents(struct gfs2_jdesc *jd); extern void gfs2_free_journal_extents(struct gfs2_jdesc *jd);
extern int __gfs2_punch_hole(struct file *file, loff_t offset, loff_t length); extern int __gfs2_punch_hole(struct file *file, loff_t offset, loff_t length);
extern int gfs2_lblk_to_dblk(struct inode *inode, u32 lblock, u64 *dblock);
#endif /* __BMAP_DOT_H__ */ #endif /* __BMAP_DOT_H__ */
...@@ -159,7 +159,7 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf, ...@@ -159,7 +159,7 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,
unsigned int o; unsigned int o;
int copied = 0; int copied = 0;
int error = 0; int error = 0;
int new = 0; bool new = false;
if (!size) if (!size)
return 0; return 0;
...@@ -189,9 +189,9 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf, ...@@ -189,9 +189,9 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,
amount = sdp->sd_sb.sb_bsize - o; amount = sdp->sd_sb.sb_bsize - o;
if (!extlen) { if (!extlen) {
new = 1; extlen = 1;
error = gfs2_extent_map(&ip->i_inode, lblock, &new, error = gfs2_alloc_extent(&ip->i_inode, lblock, &dblock,
&dblock, &extlen); &extlen, &new);
if (error) if (error)
goto fail; goto fail;
error = -EIO; error = -EIO;
...@@ -286,15 +286,14 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, __be64 *buf, ...@@ -286,15 +286,14 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, __be64 *buf,
while (copied < size) { while (copied < size) {
unsigned int amount; unsigned int amount;
struct buffer_head *bh; struct buffer_head *bh;
int new;
amount = size - copied; amount = size - copied;
if (amount > sdp->sd_sb.sb_bsize - o) if (amount > sdp->sd_sb.sb_bsize - o)
amount = sdp->sd_sb.sb_bsize - o; amount = sdp->sd_sb.sb_bsize - o;
if (!extlen) { if (!extlen) {
new = 0; extlen = 32;
error = gfs2_extent_map(&ip->i_inode, lblock, &new, error = gfs2_get_extent(&ip->i_inode, lblock,
&dblock, &extlen); &dblock, &extlen);
if (error || !dblock) if (error || !dblock)
goto fail; goto fail;
...@@ -770,14 +769,13 @@ static int get_leaf(struct gfs2_inode *dip, u64 leaf_no, ...@@ -770,14 +769,13 @@ static int get_leaf(struct gfs2_inode *dip, u64 leaf_no,
/** /**
* get_leaf_nr - Get a leaf number associated with the index * get_leaf_nr - Get a leaf number associated with the index
* @dip: The GFS2 inode * @dip: The GFS2 inode
* @index: * @index: hash table index of the targeted leaf
* @leaf_out: * @leaf_out: Resulting leaf block number
* *
* Returns: 0 on success, error code otherwise * Returns: 0 on success, error code otherwise
*/ */
static int get_leaf_nr(struct gfs2_inode *dip, u32 index, static int get_leaf_nr(struct gfs2_inode *dip, u32 index, u64 *leaf_out)
u64 *leaf_out)
{ {
__be64 *hash; __be64 *hash;
int error; int error;
...@@ -898,7 +896,7 @@ static struct gfs2_leaf *new_leaf(struct inode *inode, struct buffer_head **pbh, ...@@ -898,7 +896,7 @@ static struct gfs2_leaf *new_leaf(struct inode *inode, struct buffer_head **pbh,
/** /**
* dir_make_exhash - Convert a stuffed directory into an ExHash directory * dir_make_exhash - Convert a stuffed directory into an ExHash directory
* @dip: The GFS2 inode * @inode: The directory inode to be converted to exhash
* *
* Returns: 0 on success, error code otherwise * Returns: 0 on success, error code otherwise
*/ */
...@@ -991,9 +989,8 @@ static int dir_make_exhash(struct inode *inode) ...@@ -991,9 +989,8 @@ static int dir_make_exhash(struct inode *inode)
/** /**
* dir_split_leaf - Split a leaf block into two * dir_split_leaf - Split a leaf block into two
* @dip: The GFS2 inode * @inode: The directory inode to be split
* @index: * @name: name of the dirent we're trying to insert
* @leaf_no:
* *
* Returns: 0 on success, error code on failure * Returns: 0 on success, error code on failure
*/ */
...@@ -1252,6 +1249,7 @@ static int compare_dents(const void *a, const void *b) ...@@ -1252,6 +1249,7 @@ static int compare_dents(const void *a, const void *b)
* @ctx: what to feed the entries to * @ctx: what to feed the entries to
* @darr: an array of struct gfs2_dirent pointers to read * @darr: an array of struct gfs2_dirent pointers to read
* @entries: the number of entries in darr * @entries: the number of entries in darr
* @sort_start: index of the directory array to start our sort
* @copied: pointer to int that's non-zero if a entry has been copied out * @copied: pointer to int that's non-zero if a entry has been copied out
* *
* Jump through some hoops to make sure that if there are hash collsions, * Jump through some hoops to make sure that if there are hash collsions,
...@@ -1468,6 +1466,10 @@ static int gfs2_dir_read_leaf(struct inode *inode, struct dir_context *ctx, ...@@ -1468,6 +1466,10 @@ static int gfs2_dir_read_leaf(struct inode *inode, struct dir_context *ctx,
/** /**
* gfs2_dir_readahead - Issue read-ahead requests for leaf blocks. * gfs2_dir_readahead - Issue read-ahead requests for leaf blocks.
* @inode: the directory inode
* @hsize: hash table size
* @index: index into the hash table
* @f_ra: read-ahead parameters
* *
* Note: we can't calculate each index like dir_e_read can because we don't * Note: we can't calculate each index like dir_e_read can because we don't
* have the leaf, and therefore we don't have the depth, and therefore we * have the leaf, and therefore we don't have the depth, and therefore we
...@@ -1517,8 +1519,9 @@ static void gfs2_dir_readahead(struct inode *inode, unsigned hsize, u32 index, ...@@ -1517,8 +1519,9 @@ static void gfs2_dir_readahead(struct inode *inode, unsigned hsize, u32 index,
/** /**
* dir_e_read - Reads the entries from a directory into a filldir buffer * dir_e_read - Reads the entries from a directory into a filldir buffer
* @dip: dinode pointer * @inode: the directory inode
* @ctx: actor to feed the entries to * @ctx: actor to feed the entries to
* @f_ra: read-ahead parameters
* *
* Returns: errno * Returns: errno
*/ */
...@@ -1627,7 +1630,7 @@ int gfs2_dir_read(struct inode *inode, struct dir_context *ctx, ...@@ -1627,7 +1630,7 @@ int gfs2_dir_read(struct inode *inode, struct dir_context *ctx,
/** /**
* gfs2_dir_search - Search a directory * gfs2_dir_search - Search a directory
* @dip: The GFS2 dir inode * @dir: The GFS2 directory inode
* @name: The name we are looking up * @name: The name we are looking up
* @fail_on_exist: Fail if the name exists rather than looking it up * @fail_on_exist: Fail if the name exists rather than looking it up
* *
...@@ -1864,7 +1867,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name, ...@@ -1864,7 +1867,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name,
/** /**
* gfs2_dir_del - Delete a directory entry * gfs2_dir_del - Delete a directory entry
* @dip: The GFS2 inode * @dip: The GFS2 inode
* @filename: The filename * @dentry: The directory entry we want to delete
* *
* Returns: 0 on success, error code on failure * Returns: 0 on success, error code on failure
*/ */
...@@ -1918,9 +1921,10 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct dentry *dentry) ...@@ -1918,9 +1921,10 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct dentry *dentry)
/** /**
* gfs2_dir_mvino - Change inode number of directory entry * gfs2_dir_mvino - Change inode number of directory entry
* @dip: The GFS2 inode * @dip: The GFS2 directory inode
* @filename: * @filename: the filename to be moved
* @new_inode: * @nip: the new GFS2 inode
* @new_type: the de_type of the new dirent
* *
* This routine changes the inode number of a directory entry. It's used * This routine changes the inode number of a directory entry. It's used
* by rename to change ".." when a directory is moved. * by rename to change ".." when a directory is moved.
...@@ -1960,7 +1964,7 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename, ...@@ -1960,7 +1964,7 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
* @len: the number of pointers to this leaf * @len: the number of pointers to this leaf
* @leaf_no: the leaf number * @leaf_no: the leaf number
* @leaf_bh: buffer_head for the starting leaf * @leaf_bh: buffer_head for the starting leaf
* last_dealloc: 1 if this is the final dealloc for the leaf, else 0 * @last_dealloc: 1 if this is the final dealloc for the leaf, else 0
* *
* Returns: errno * Returns: errno
*/ */
...@@ -2142,8 +2146,8 @@ int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip) ...@@ -2142,8 +2146,8 @@ int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip)
/** /**
* gfs2_diradd_alloc_required - find if adding entry will require an allocation * gfs2_diradd_alloc_required - find if adding entry will require an allocation
* @ip: the file being written to * @inode: the directory inode being written to
* @filname: the filename that's going to be added * @name: the filename that's going to be added
* @da: The structure to return dir alloc info * @da: The structure to return dir alloc info
* *
* Returns: 0 if ok, -ve on error * Returns: 0 if ok, -ve on error
......
...@@ -119,8 +119,8 @@ static int gfs2_readdir(struct file *file, struct dir_context *ctx) ...@@ -119,8 +119,8 @@ static int gfs2_readdir(struct file *file, struct dir_context *ctx)
return error; return error;
} }
/** /*
* fsflag_gfs2flag * struct fsflag_gfs2flag
* *
* The FS_JOURNAL_DATA_FL flag maps to GFS2_DIF_INHERIT_JDATA for directories, * The FS_JOURNAL_DATA_FL flag maps to GFS2_DIF_INHERIT_JDATA for directories,
* and to GFS2_DIF_JDATA for non-directories. * and to GFS2_DIF_JDATA for non-directories.
...@@ -398,7 +398,7 @@ static int gfs2_allocate_page_backing(struct page *page, unsigned int length) ...@@ -398,7 +398,7 @@ static int gfs2_allocate_page_backing(struct page *page, unsigned int length)
do { do {
struct iomap iomap = { }; struct iomap iomap = { };
if (gfs2_iomap_get_alloc(page->mapping->host, pos, length, &iomap)) if (gfs2_iomap_alloc(page->mapping->host, pos, length, &iomap))
return -EIO; return -EIO;
if (length < iomap.length) if (length < iomap.length)
...@@ -412,7 +412,6 @@ static int gfs2_allocate_page_backing(struct page *page, unsigned int length) ...@@ -412,7 +412,6 @@ static int gfs2_allocate_page_backing(struct page *page, unsigned int length)
/** /**
* gfs2_page_mkwrite - Make a shared, mmap()ed, page writable * gfs2_page_mkwrite - Make a shared, mmap()ed, page writable
* @vma: The virtual memory area
* @vmf: The virtual memory fault containing the page to become writable * @vmf: The virtual memory fault containing the page to become writable
* *
* When the page becomes writable, we need to ensure that we have * When the page becomes writable, we need to ensure that we have
...@@ -563,7 +562,7 @@ static const struct vm_operations_struct gfs2_vm_ops = { ...@@ -563,7 +562,7 @@ static const struct vm_operations_struct gfs2_vm_ops = {
}; };
/** /**
* gfs2_mmap - * gfs2_mmap
* @file: The file to map * @file: The file to map
* @vma: The VMA which described the mapping * @vma: The VMA which described the mapping
* *
...@@ -968,8 +967,7 @@ static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len, ...@@ -968,8 +967,7 @@ static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len,
while (offset < end) { while (offset < end) {
struct iomap iomap = { }; struct iomap iomap = { };
error = gfs2_iomap_get_alloc(inode, offset, end - offset, error = gfs2_iomap_alloc(inode, offset, end - offset, &iomap);
&iomap);
if (error) if (error)
goto out; goto out;
offset = iomap.offset + iomap.length; offset = iomap.offset + iomap.length;
......
...@@ -359,7 +359,8 @@ static void gfs2_holder_wake(struct gfs2_holder *gh) ...@@ -359,7 +359,8 @@ static void gfs2_holder_wake(struct gfs2_holder *gh)
/** /**
* do_error - Something unexpected has happened during a lock request * do_error - Something unexpected has happened during a lock request
* * @gl: The glock
* @ret: The status from the DLM
*/ */
static void do_error(struct gfs2_glock *gl, const int ret) static void do_error(struct gfs2_glock *gl, const int ret)
...@@ -454,8 +455,7 @@ static inline struct gfs2_holder *find_first_waiter(const struct gfs2_glock *gl) ...@@ -454,8 +455,7 @@ static inline struct gfs2_holder *find_first_waiter(const struct gfs2_glock *gl)
/** /**
* state_change - record that the glock is now in a different state * state_change - record that the glock is now in a different state
* @gl: the glock * @gl: the glock
* @new_state the new state * @new_state: the new state
*
*/ */
static void state_change(struct gfs2_glock *gl, unsigned int new_state) static void state_change(struct gfs2_glock *gl, unsigned int new_state)
...@@ -566,7 +566,7 @@ static void finish_xmote(struct gfs2_glock *gl, unsigned int ret) ...@@ -566,7 +566,7 @@ static void finish_xmote(struct gfs2_glock *gl, unsigned int ret)
if (state != LM_ST_UNLOCKED) { if (state != LM_ST_UNLOCKED) {
if (glops->go_xmote_bh) { if (glops->go_xmote_bh) {
spin_unlock(&gl->gl_lockref.lock); spin_unlock(&gl->gl_lockref.lock);
rv = glops->go_xmote_bh(gl, gh); rv = glops->go_xmote_bh(gl);
spin_lock(&gl->gl_lockref.lock); spin_lock(&gl->gl_lockref.lock);
if (rv) { if (rv) {
do_error(gl, rv); do_error(gl, rv);
...@@ -1268,6 +1268,8 @@ int gfs2_glock_async_wait(unsigned int num_gh, struct gfs2_holder *ghs) ...@@ -1268,6 +1268,8 @@ int gfs2_glock_async_wait(unsigned int num_gh, struct gfs2_holder *ghs)
* handle_callback - process a demote request * handle_callback - process a demote request
* @gl: the glock * @gl: the glock
* @state: the state the caller wants us to change to * @state: the state the caller wants us to change to
* @delay: zero to demote immediately; otherwise pending demote
* @remote: true if this came from a different cluster node
* *
* There are only two requests that we are going to see in actual * There are only two requests that we are going to see in actual
* practise: LM_ST_SHARED and LM_ST_UNLOCKED * practise: LM_ST_SHARED and LM_ST_UNLOCKED
...@@ -1569,6 +1571,7 @@ static int glock_compare(const void *arg_a, const void *arg_b) ...@@ -1569,6 +1571,7 @@ static int glock_compare(const void *arg_a, const void *arg_b)
* nq_m_sync - synchonously acquire more than one glock in deadlock free order * nq_m_sync - synchonously acquire more than one glock in deadlock free order
* @num_gh: the number of structures * @num_gh: the number of structures
* @ghs: an array of struct gfs2_holder structures * @ghs: an array of struct gfs2_holder structures
* @p: placeholder for the holder structure to pass back
* *
* Returns: 0 on success (all glocks acquired), * Returns: 0 on success (all glocks acquired),
* errno on failure (no glocks acquired) * errno on failure (no glocks acquired)
...@@ -1986,7 +1989,6 @@ static void dump_glock_func(struct gfs2_glock *gl) ...@@ -1986,7 +1989,6 @@ static void dump_glock_func(struct gfs2_glock *gl)
/** /**
* gfs2_gl_hash_clear - Empty out the glock hash table * gfs2_gl_hash_clear - Empty out the glock hash table
* @sdp: the filesystem * @sdp: the filesystem
* @wait: wait until it's all gone
* *
* Called when unmounting the filesystem. * Called when unmounting the filesystem.
*/ */
......
...@@ -49,6 +49,7 @@ static void gfs2_ail_error(struct gfs2_glock *gl, const struct buffer_head *bh) ...@@ -49,6 +49,7 @@ static void gfs2_ail_error(struct gfs2_glock *gl, const struct buffer_head *bh)
* __gfs2_ail_flush - remove all buffers for a given lock from the AIL * __gfs2_ail_flush - remove all buffers for a given lock from the AIL
* @gl: the glock * @gl: the glock
* @fsync: set when called from fsync (not all buffers will be clean) * @fsync: set when called from fsync (not all buffers will be clean)
* @nr_revokes: Number of buffers to revoke
* *
* None of the buffers should be dirty, locked, or pinned. * None of the buffers should be dirty, locked, or pinned.
*/ */
...@@ -480,8 +481,7 @@ int gfs2_inode_refresh(struct gfs2_inode *ip) ...@@ -480,8 +481,7 @@ int gfs2_inode_refresh(struct gfs2_inode *ip)
/** /**
* inode_go_lock - operation done after an inode lock is locked by a process * inode_go_lock - operation done after an inode lock is locked by a process
* @gl: the glock * @gh: The glock holder
* @flags:
* *
* Returns: errno * Returns: errno
*/ */
...@@ -522,7 +522,7 @@ static int inode_go_lock(struct gfs2_holder *gh) ...@@ -522,7 +522,7 @@ static int inode_go_lock(struct gfs2_holder *gh)
/** /**
* inode_go_dump - print information about an inode * inode_go_dump - print information about an inode
* @seq: The iterator * @seq: The iterator
* @ip: the inode * @gl: The glock
* @fs_id_buf: file system id (may be empty) * @fs_id_buf: file system id (may be empty)
* *
*/ */
...@@ -553,9 +553,6 @@ static void inode_go_dump(struct seq_file *seq, struct gfs2_glock *gl, ...@@ -553,9 +553,6 @@ static void inode_go_dump(struct seq_file *seq, struct gfs2_glock *gl,
/** /**
* freeze_go_sync - promote/demote the freeze glock * freeze_go_sync - promote/demote the freeze glock
* @gl: the glock * @gl: the glock
* @state: the requested state
* @flags:
*
*/ */
static int freeze_go_sync(struct gfs2_glock *gl) static int freeze_go_sync(struct gfs2_glock *gl)
...@@ -600,10 +597,8 @@ static int freeze_go_sync(struct gfs2_glock *gl) ...@@ -600,10 +597,8 @@ static int freeze_go_sync(struct gfs2_glock *gl)
/** /**
* freeze_go_xmote_bh - After promoting/demoting the freeze glock * freeze_go_xmote_bh - After promoting/demoting the freeze glock
* @gl: the glock * @gl: the glock
*
*/ */
static int freeze_go_xmote_bh(struct gfs2_glock *gl)
static int freeze_go_xmote_bh(struct gfs2_glock *gl, struct gfs2_holder *gh)
{ {
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
struct gfs2_inode *ip = GFS2_I(sdp->sd_jdesc->jd_inode); struct gfs2_inode *ip = GFS2_I(sdp->sd_jdesc->jd_inode);
...@@ -630,7 +625,7 @@ static int freeze_go_xmote_bh(struct gfs2_glock *gl, struct gfs2_holder *gh) ...@@ -630,7 +625,7 @@ static int freeze_go_xmote_bh(struct gfs2_glock *gl, struct gfs2_holder *gh)
} }
/** /**
* trans_go_demote_ok * freeze_go_demote_ok
* @gl: the glock * @gl: the glock
* *
* Always returns 0 * Always returns 0
...@@ -644,6 +639,7 @@ static int freeze_go_demote_ok(const struct gfs2_glock *gl) ...@@ -644,6 +639,7 @@ static int freeze_go_demote_ok(const struct gfs2_glock *gl)
/** /**
* iopen_go_callback - schedule the dcache entry for the inode to be deleted * iopen_go_callback - schedule the dcache entry for the inode to be deleted
* @gl: the glock * @gl: the glock
* @remote: true if this came from a different cluster node
* *
* gl_lockref.lock lock is held while calling this * gl_lockref.lock lock is held while calling this
*/ */
......
...@@ -217,7 +217,7 @@ struct lm_lockname { ...@@ -217,7 +217,7 @@ struct lm_lockname {
struct gfs2_glock_operations { struct gfs2_glock_operations {
int (*go_sync) (struct gfs2_glock *gl); int (*go_sync) (struct gfs2_glock *gl);
int (*go_xmote_bh) (struct gfs2_glock *gl, struct gfs2_holder *gh); int (*go_xmote_bh)(struct gfs2_glock *gl);
void (*go_inval) (struct gfs2_glock *gl, int flags); void (*go_inval) (struct gfs2_glock *gl, int flags);
int (*go_demote_ok) (const struct gfs2_glock *gl); int (*go_demote_ok) (const struct gfs2_glock *gl);
int (*go_lock) (struct gfs2_holder *gh); int (*go_lock) (struct gfs2_holder *gh);
...@@ -625,7 +625,6 @@ struct gfs2_inum_host { ...@@ -625,7 +625,6 @@ struct gfs2_inum_host {
struct gfs2_sb_host { struct gfs2_sb_host {
u32 sb_magic; u32 sb_magic;
u32 sb_type; u32 sb_type;
u32 sb_format;
u32 sb_fs_format; u32 sb_fs_format;
u32 sb_multihost_format; u32 sb_multihost_format;
......
...@@ -285,10 +285,9 @@ struct inode *gfs2_lookup_simple(struct inode *dip, const char *name) ...@@ -285,10 +285,9 @@ struct inode *gfs2_lookup_simple(struct inode *dip, const char *name)
/** /**
* gfs2_lookupi - Look up a filename in a directory and return its inode * gfs2_lookupi - Look up a filename in a directory and return its inode
* @d_gh: An initialized holder for the directory glock * @dir: The inode of the directory containing the inode to look-up
* @name: The name of the inode to look for * @name: The name of the inode to look for
* @is_root: If 1, ignore the caller's permissions * @is_root: If 1, ignore the caller's permissions
* @i_gh: An uninitialized holder for the new inode glock
* *
* This can be called via the VFS filldir function when NFS is doing * This can be called via the VFS filldir function when NFS is doing
* a readdirplus and the inode which its intending to stat isn't * a readdirplus and the inode which its intending to stat isn't
...@@ -476,7 +475,6 @@ static void gfs2_init_xattr(struct gfs2_inode *ip) ...@@ -476,7 +475,6 @@ static void gfs2_init_xattr(struct gfs2_inode *ip)
* @dip: The directory this inode is being created in * @dip: The directory this inode is being created in
* @ip: The inode * @ip: The inode
* @symname: The symlink destination (if a symlink) * @symname: The symlink destination (if a symlink)
* @bhp: The buffer head (returned to caller)
* *
*/ */
...@@ -514,7 +512,7 @@ static void init_dinode(struct gfs2_inode *dip, struct gfs2_inode *ip, ...@@ -514,7 +512,7 @@ static void init_dinode(struct gfs2_inode *dip, struct gfs2_inode *ip,
} }
/** /**
* gfs2_trans_da_blocks - Calculate number of blocks to link inode * gfs2_trans_da_blks - Calculate number of blocks to link inode
* @dip: The directory we are linking into * @dip: The directory we are linking into
* @da: The dir add information * @da: The dir add information
* @nr_inodes: The number of inodes involved * @nr_inodes: The number of inodes involved
...@@ -595,6 +593,7 @@ static int gfs2_initxattrs(struct inode *inode, const struct xattr *xattr_array, ...@@ -595,6 +593,7 @@ static int gfs2_initxattrs(struct inode *inode, const struct xattr *xattr_array,
* @dev: For device nodes, this is the device number * @dev: For device nodes, this is the device number
* @symname: For symlinks, this is the link destination * @symname: For symlinks, this is the link destination
* @size: The initial size of the inode (ignored for directories) * @size: The initial size of the inode (ignored for directories)
* @excl: Force fail if inode exists
* *
* Returns: 0 on success, or error code * Returns: 0 on success, or error code
*/ */
...@@ -837,9 +836,11 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, ...@@ -837,9 +836,11 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
/** /**
* gfs2_create - Create a file * gfs2_create - Create a file
* @mnt_userns: User namespace of the mount the inode was found from
* @dir: The directory in which to create the file * @dir: The directory in which to create the file
* @dentry: The dentry of the new file * @dentry: The dentry of the new file
* @mode: The mode of the new file * @mode: The mode of the new file
* @excl: Force fail if inode exists
* *
* Returns: errno * Returns: errno
*/ */
...@@ -962,6 +963,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir, ...@@ -962,6 +963,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
break; break;
case 0: case 0:
error = -EEXIST; error = -EEXIST;
goto out_gunlock;
default: default:
goto out_gunlock; goto out_gunlock;
} }
...@@ -1080,8 +1082,7 @@ static int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, ...@@ -1080,8 +1082,7 @@ static int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
/** /**
* gfs2_unlink_inode - Removes an inode from its parent dir and unlinks it * gfs2_unlink_inode - Removes an inode from its parent dir and unlinks it
* @dip: The parent directory * @dip: The parent directory
* @name: The name of the entry in the parent directory * @dentry: The dentry to unlink
* @inode: The inode to be removed
* *
* Called with all the locks and in a transaction. This will only be * Called with all the locks and in a transaction. This will only be
* called for a directory after it has been checked to ensure it is empty. * called for a directory after it has been checked to ensure it is empty.
...@@ -1199,6 +1200,7 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry) ...@@ -1199,6 +1200,7 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
/** /**
* gfs2_symlink - Create a symlink * gfs2_symlink - Create a symlink
* @mnt_userns: User namespace of the mount the inode was found from
* @dir: The directory to create the symlink in * @dir: The directory to create the symlink in
* @dentry: The dentry to put the symlink in * @dentry: The dentry to put the symlink in
* @symname: The thing which the link points to * @symname: The thing which the link points to
...@@ -1220,6 +1222,7 @@ static int gfs2_symlink(struct user_namespace *mnt_userns, struct inode *dir, ...@@ -1220,6 +1222,7 @@ static int gfs2_symlink(struct user_namespace *mnt_userns, struct inode *dir,
/** /**
* gfs2_mkdir - Make a directory * gfs2_mkdir - Make a directory
* @mnt_userns: User namespace of the mount the inode was found from
* @dir: The parent directory of the new one * @dir: The parent directory of the new one
* @dentry: The dentry of the new directory * @dentry: The dentry of the new directory
* @mode: The mode of the new directory * @mode: The mode of the new directory
...@@ -1236,6 +1239,7 @@ static int gfs2_mkdir(struct user_namespace *mnt_userns, struct inode *dir, ...@@ -1236,6 +1239,7 @@ static int gfs2_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
/** /**
* gfs2_mknod - Make a special file * gfs2_mknod - Make a special file
* @mnt_userns: User namespace of the mount the inode was found from
* @dir: The directory in which the special file will reside * @dir: The directory in which the special file will reside
* @dentry: The dentry of the special file * @dentry: The dentry of the special file
* @mode: The mode of the special file * @mode: The mode of the special file
...@@ -1505,6 +1509,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, ...@@ -1505,6 +1509,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
break; break;
case 0: case 0:
error = -EEXIST; error = -EEXIST;
goto out_gunlock;
default: default:
goto out_gunlock; goto out_gunlock;
} }
...@@ -1828,10 +1833,10 @@ static const char *gfs2_get_link(struct dentry *dentry, ...@@ -1828,10 +1833,10 @@ static const char *gfs2_get_link(struct dentry *dentry,
} }
/** /**
* gfs2_permission - * gfs2_permission
* @mnt_userns: User namespace of the mount the inode was found from
* @inode: The inode * @inode: The inode
* @mask: The mask to be tested * @mask: The mask to be tested
* @flags: Indicates whether this is an RCU path walk or not
* *
* This may be called from the VFS directly, or from within GFS2 with the * This may be called from the VFS directly, or from within GFS2 with the
* inode locked, so we look to see if the glock is already locked and only * inode locked, so we look to see if the glock is already locked and only
...@@ -1874,15 +1879,7 @@ static int __gfs2_setattr_simple(struct inode *inode, struct iattr *attr) ...@@ -1874,15 +1879,7 @@ static int __gfs2_setattr_simple(struct inode *inode, struct iattr *attr)
return 0; return 0;
} }
/** static int gfs2_setattr_simple(struct inode *inode, struct iattr *attr)
* gfs2_setattr_simple -
* @ip:
* @attr:
*
* Returns: errno
*/
int gfs2_setattr_simple(struct inode *inode, struct iattr *attr)
{ {
int error; int error;
...@@ -1962,6 +1959,7 @@ static int setattr_chown(struct inode *inode, struct iattr *attr) ...@@ -1962,6 +1959,7 @@ static int setattr_chown(struct inode *inode, struct iattr *attr)
/** /**
* gfs2_setattr - Change attributes on an inode * gfs2_setattr - Change attributes on an inode
* @mnt_userns: User namespace of the mount the inode was found from
* @dentry: The dentry which is changing * @dentry: The dentry which is changing
* @attr: The structure describing the change * @attr: The structure describing the change
* *
......
...@@ -101,7 +101,6 @@ extern struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name, ...@@ -101,7 +101,6 @@ extern struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
int is_root); int is_root);
extern int gfs2_permission(struct user_namespace *mnt_userns, extern int gfs2_permission(struct user_namespace *mnt_userns,
struct inode *inode, int mask); struct inode *inode, int mask);
extern int gfs2_setattr_simple(struct inode *inode, struct iattr *attr);
extern struct inode *gfs2_lookup_simple(struct inode *dip, const char *name); extern struct inode *gfs2_lookup_simple(struct inode *dip, const char *name);
extern void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf); extern void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf);
extern int gfs2_open_common(struct inode *inode, struct file *file); extern int gfs2_open_common(struct inode *inode, struct file *file);
......
...@@ -24,28 +24,31 @@ ...@@ -24,28 +24,31 @@
/** /**
* gfs2_update_stats - Update time based stats * gfs2_update_stats - Update time based stats
* @mv: Pointer to mean/variance structure to update * @s: The stats to update (local or global)
* @index: The index inside @s
* @sample: New data to include * @sample: New data to include
*
* @delta is the difference between the current rtt sample and the
* running average srtt. We add 1/8 of that to the srtt in order to
* update the current srtt estimate. The variance estimate is a bit
* more complicated. We subtract the current variance estimate from
* the abs value of the @delta and add 1/4 of that to the running
* total. That's equivalent to 3/4 of the current variance
* estimate plus 1/4 of the abs of @delta.
*
* Note that the index points at the array entry containing the smoothed
* mean value, and the variance is always in the following entry
*
* Reference: TCP/IP Illustrated, vol 2, p. 831,832
* All times are in units of integer nanoseconds. Unlike the TCP/IP case,
* they are not scaled fixed point.
*/ */
static inline void gfs2_update_stats(struct gfs2_lkstats *s, unsigned index, static inline void gfs2_update_stats(struct gfs2_lkstats *s, unsigned index,
s64 sample) s64 sample)
{ {
/*
* @delta is the difference between the current rtt sample and the
* running average srtt. We add 1/8 of that to the srtt in order to
* update the current srtt estimate. The variance estimate is a bit
* more complicated. We subtract the current variance estimate from
* the abs value of the @delta and add 1/4 of that to the running
* total. That's equivalent to 3/4 of the current variance
* estimate plus 1/4 of the abs of @delta.
*
* Note that the index points at the array entry containing the
* smoothed mean value, and the variance is always in the following
* entry
*
* Reference: TCP/IP Illustrated, vol 2, p. 831,832
* All times are in units of integer nanoseconds. Unlike the TCP/IP
* case, they are not scaled fixed point.
*/
s64 delta = sample - s->stats[index]; s64 delta = sample - s->stats[index];
s->stats[index] += (delta >> 3); s->stats[index] += (delta >> 3);
index++; index++;
......
...@@ -65,7 +65,6 @@ unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct) ...@@ -65,7 +65,6 @@ unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct)
/** /**
* gfs2_remove_from_ail - Remove an entry from the ail lists, updating counters * gfs2_remove_from_ail - Remove an entry from the ail lists, updating counters
* @mapping: The associated mapping (maybe NULL)
* @bd: The gfs2_bufdata to remove * @bd: The gfs2_bufdata to remove
* *
* The ail lock _must_ be held when calling this function * The ail lock _must_ be held when calling this function
...@@ -82,11 +81,11 @@ void gfs2_remove_from_ail(struct gfs2_bufdata *bd) ...@@ -82,11 +81,11 @@ void gfs2_remove_from_ail(struct gfs2_bufdata *bd)
} }
/** /**
* gfs2_ail1_start_one - Start I/O on a part of the AIL * gfs2_ail1_start_one - Start I/O on a transaction
* @sdp: the filesystem * @sdp: The superblock
* @wbc: The writeback control structure * @wbc: The writeback control structure
* @ai: The ail structure * @tr: The transaction to start I/O on
* * @plug: The block plug currently active
*/ */
static int gfs2_ail1_start_one(struct gfs2_sbd *sdp, static int gfs2_ail1_start_one(struct gfs2_sbd *sdp,
...@@ -269,7 +268,7 @@ static void gfs2_log_update_head(struct gfs2_sbd *sdp) ...@@ -269,7 +268,7 @@ static void gfs2_log_update_head(struct gfs2_sbd *sdp)
sdp->sd_log_head = new_head; sdp->sd_log_head = new_head;
} }
/** /*
* gfs2_ail_empty_tr - empty one of the ail lists of a transaction * gfs2_ail_empty_tr - empty one of the ail lists of a transaction
*/ */
...@@ -859,7 +858,11 @@ void gfs2_write_log_header(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd, ...@@ -859,7 +858,11 @@ void gfs2_write_log_header(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
if (!list_empty(&jd->extent_list)) if (!list_empty(&jd->extent_list))
dblock = gfs2_log_bmap(jd, lblock); dblock = gfs2_log_bmap(jd, lblock);
else { else {
int ret = gfs2_lblk_to_dblk(jd->jd_inode, lblock, &dblock); unsigned int extlen;
int ret;
extlen = 1;
ret = gfs2_get_extent(jd->jd_inode, lblock, &dblock, &extlen);
if (gfs2_assert_withdraw(sdp, ret == 0)) if (gfs2_assert_withdraw(sdp, ret == 0))
return; return;
} }
...@@ -1014,7 +1017,7 @@ static void trans_drain(struct gfs2_trans *tr) ...@@ -1014,7 +1017,7 @@ static void trans_drain(struct gfs2_trans *tr)
/** /**
* gfs2_log_flush - flush incore transaction(s) * gfs2_log_flush - flush incore transaction(s)
* @sdp: the filesystem * @sdp: The filesystem
* @gl: The glock structure to flush. If NULL, flush the whole incore log * @gl: The glock structure to flush. If NULL, flush the whole incore log
* @flags: The log header flags: GFS2_LOG_HEAD_FLUSH_* and debug flags * @flags: The log header flags: GFS2_LOG_HEAD_FLUSH_* and debug flags
* *
...@@ -1166,7 +1169,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags) ...@@ -1166,7 +1169,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags)
/** /**
* gfs2_merge_trans - Merge a new transaction into a cached transaction * gfs2_merge_trans - Merge a new transaction into a cached transaction
* @old: Original transaction to be expanded * @sdp: the filesystem
* @new: New transaction to be merged * @new: New transaction to be merged
*/ */
...@@ -1283,7 +1286,7 @@ static inline int gfs2_ail_flush_reqd(struct gfs2_sbd *sdp) ...@@ -1283,7 +1286,7 @@ static inline int gfs2_ail_flush_reqd(struct gfs2_sbd *sdp)
/** /**
* gfs2_logd - Update log tail as Active Items get flushed to in-place blocks * gfs2_logd - Update log tail as Active Items get flushed to in-place blocks
* @sdp: Pointer to GFS2 superblock * @data: Pointer to GFS2 superblock
* *
* Also, periodically check to make sure that we're using the most recent * Also, periodically check to make sure that we're using the most recent
* journal index. * journal index.
......
...@@ -96,9 +96,7 @@ static void maybe_release_space(struct gfs2_bufdata *bd) ...@@ -96,9 +96,7 @@ static void maybe_release_space(struct gfs2_bufdata *bd)
* gfs2_unpin - Unpin a buffer * gfs2_unpin - Unpin a buffer
* @sdp: the filesystem the buffer belongs to * @sdp: the filesystem the buffer belongs to
* @bh: The buffer to unpin * @bh: The buffer to unpin
* @ai: * @tr: The system transaction being flushed
* @flags: The inode dirty flags
*
*/ */
static void gfs2_unpin(struct gfs2_sbd *sdp, struct buffer_head *bh, static void gfs2_unpin(struct gfs2_sbd *sdp, struct buffer_head *bh,
...@@ -281,7 +279,7 @@ static struct bio *gfs2_log_alloc_bio(struct gfs2_sbd *sdp, u64 blkno, ...@@ -281,7 +279,7 @@ static struct bio *gfs2_log_alloc_bio(struct gfs2_sbd *sdp, u64 blkno,
* gfs2_log_get_bio - Get cached log bio, or allocate a new one * gfs2_log_get_bio - Get cached log bio, or allocate a new one
* @sdp: The super block * @sdp: The super block
* @blkno: The device block number we want to write to * @blkno: The device block number we want to write to
* @bio: The bio to get or allocate * @biop: The bio to get or allocate
* @op: REQ_OP * @op: REQ_OP
* @end_io: The bi_end_io callback * @end_io: The bi_end_io callback
* @flush: Always flush the current bio and allocate a new one? * @flush: Always flush the current bio and allocate a new one?
...@@ -317,6 +315,7 @@ static struct bio *gfs2_log_get_bio(struct gfs2_sbd *sdp, u64 blkno, ...@@ -317,6 +315,7 @@ static struct bio *gfs2_log_get_bio(struct gfs2_sbd *sdp, u64 blkno,
/** /**
* gfs2_log_write - write to log * gfs2_log_write - write to log
* @sdp: the filesystem * @sdp: the filesystem
* @jd: The journal descriptor
* @page: the page to write * @page: the page to write
* @size: the size of the data to write * @size: the size of the data to write
* @offset: the offset within the page * @offset: the offset within the page
...@@ -417,6 +416,7 @@ static void gfs2_end_log_read(struct bio *bio) ...@@ -417,6 +416,7 @@ static void gfs2_end_log_read(struct bio *bio)
/** /**
* gfs2_jhead_pg_srch - Look for the journal head in a given page. * gfs2_jhead_pg_srch - Look for the journal head in a given page.
* @jd: The journal descriptor * @jd: The journal descriptor
* @head: The journal head to start from
* @page: The page to look in * @page: The page to look in
* *
* Returns: 1 if found, 0 otherwise. * Returns: 1 if found, 0 otherwise.
...@@ -450,6 +450,7 @@ static bool gfs2_jhead_pg_srch(struct gfs2_jdesc *jd, ...@@ -450,6 +450,7 @@ static bool gfs2_jhead_pg_srch(struct gfs2_jdesc *jd,
* gfs2_jhead_process_page - Search/cleanup a page * gfs2_jhead_process_page - Search/cleanup a page
* @jd: The journal descriptor * @jd: The journal descriptor
* @index: Index of the page to look into * @index: Index of the page to look into
* @head: The journal head to start from
* @done: If set, perform only cleanup, else search and set if found. * @done: If set, perform only cleanup, else search and set if found.
* *
* Find the page with 'index' in the journal's mapping. Search the page for * Find the page with 'index' in the journal's mapping. Search the page for
...@@ -502,6 +503,7 @@ static struct bio *gfs2_chain_bio(struct bio *prev, unsigned int nr_iovecs) ...@@ -502,6 +503,7 @@ static struct bio *gfs2_chain_bio(struct bio *prev, unsigned int nr_iovecs)
* gfs2_find_jhead - find the head of a log * gfs2_find_jhead - find the head of a log
* @jd: The journal descriptor * @jd: The journal descriptor
* @head: The log descriptor for the head of the log is returned here * @head: The log descriptor for the head of the log is returned here
* @keep_cache: If set inode pages will not be truncated
* *
* Do a search of a journal by reading it in large chunks using bios and find * Do a search of a journal by reading it in large chunks using bios and find
* the valid log entry with the highest sequence number. (i.e. the log head) * the valid log entry with the highest sequence number. (i.e. the log head)
...@@ -977,7 +979,8 @@ static void revoke_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) ...@@ -977,7 +979,8 @@ static void revoke_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
/** /**
* databuf_lo_before_commit - Scan the data buffers, writing as we go * databuf_lo_before_commit - Scan the data buffers, writing as we go
* * @sdp: The filesystem
* @tr: The system transaction being flushed
*/ */
static void databuf_lo_before_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr) static void databuf_lo_before_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
......
...@@ -131,16 +131,19 @@ struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create) ...@@ -131,16 +131,19 @@ struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create)
break; break;
yield(); yield();
} }
if (!page_has_buffers(page))
create_empty_buffers(page, sdp->sd_sb.sb_bsize, 0);
} else { } else {
page = find_get_page_flags(mapping, index, page = find_get_page_flags(mapping, index,
FGP_LOCK|FGP_ACCESSED); FGP_LOCK|FGP_ACCESSED);
if (!page) if (!page)
return NULL; return NULL;
if (!page_has_buffers(page)) {
bh = NULL;
goto out_unlock;
}
} }
if (!page_has_buffers(page))
create_empty_buffers(page, sdp->sd_sb.sb_bsize, 0);
/* Locate header for our buffer within our page */ /* Locate header for our buffer within our page */
for (bh = page_buffers(page); bufnum--; bh = bh->b_this_page) for (bh = page_buffers(page); bufnum--; bh = bh->b_this_page)
/* Do nothing */; /* Do nothing */;
...@@ -149,6 +152,7 @@ struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create) ...@@ -149,6 +152,7 @@ struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create)
if (!buffer_mapped(bh)) if (!buffer_mapped(bh))
map_bh(bh, sdp->sd_vfs, blkno); map_bh(bh, sdp->sd_vfs, blkno);
out_unlock:
unlock_page(page); unlock_page(page);
put_page(page); put_page(page);
...@@ -239,6 +243,7 @@ static void gfs2_submit_bhs(int op, int op_flags, struct buffer_head *bhs[], ...@@ -239,6 +243,7 @@ static void gfs2_submit_bhs(int op, int op_flags, struct buffer_head *bhs[],
* @gl: The glock covering the block * @gl: The glock covering the block
* @blkno: The block number * @blkno: The block number
* @flags: flags * @flags: flags
* @rahead: Do read-ahead
* @bhp: the place where the buffer is returned (NULL on failure) * @bhp: the place where the buffer is returned (NULL on failure)
* *
* Returns: errno * Returns: errno
...@@ -462,23 +467,22 @@ void gfs2_journal_wipe(struct gfs2_inode *ip, u64 bstart, u32 blen) ...@@ -462,23 +467,22 @@ void gfs2_journal_wipe(struct gfs2_inode *ip, u64 bstart, u32 blen)
} }
/** /**
* gfs2_meta_indirect_buffer - Get a metadata buffer * gfs2_meta_buffer - Get a metadata buffer
* @ip: The GFS2 inode * @ip: The GFS2 inode
* @height: The level of this buf in the metadata (indir addr) tree (if any) * @mtype: The block type (GFS2_METATYPE_*)
* @num: The block number (device relative) of the buffer * @num: The block number (device relative) of the buffer
* @bhp: the buffer is returned here * @bhp: the buffer is returned here
* *
* Returns: errno * Returns: errno
*/ */
int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, u64 num, int gfs2_meta_buffer(struct gfs2_inode *ip, u32 mtype, u64 num,
struct buffer_head **bhp) struct buffer_head **bhp)
{ {
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct gfs2_glock *gl = ip->i_gl; struct gfs2_glock *gl = ip->i_gl;
struct buffer_head *bh; struct buffer_head *bh;
int ret = 0; int ret = 0;
u32 mtype = height ? GFS2_METATYPE_IN : GFS2_METATYPE_DI;
int rahead = 0; int rahead = 0;
if (num == ip->i_no_addr) if (num == ip->i_no_addr)
......
...@@ -61,13 +61,13 @@ enum { ...@@ -61,13 +61,13 @@ enum {
extern void gfs2_remove_from_journal(struct buffer_head *bh, int meta); extern void gfs2_remove_from_journal(struct buffer_head *bh, int meta);
extern void gfs2_journal_wipe(struct gfs2_inode *ip, u64 bstart, u32 blen); extern void gfs2_journal_wipe(struct gfs2_inode *ip, u64 bstart, u32 blen);
extern int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, u64 num, extern int gfs2_meta_buffer(struct gfs2_inode *ip, u32 mtype, u64 num,
struct buffer_head **bhp); struct buffer_head **bhp);
static inline int gfs2_meta_inode_buffer(struct gfs2_inode *ip, static inline int gfs2_meta_inode_buffer(struct gfs2_inode *ip,
struct buffer_head **bhp) struct buffer_head **bhp)
{ {
return gfs2_meta_indirect_buffer(ip, 0, ip->i_no_addr, bhp); return gfs2_meta_buffer(ip, GFS2_METATYPE_DI, ip->i_no_addr, bhp);
} }
struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen); struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen);
......
...@@ -150,7 +150,6 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb) ...@@ -150,7 +150,6 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)
/** /**
* gfs2_check_sb - Check superblock * gfs2_check_sb - Check superblock
* @sdp: the filesystem * @sdp: the filesystem
* @sb: The superblock
* @silent: Don't print a message if the check fails * @silent: Don't print a message if the check fails
* *
* Checks the version code of the FS is one that we understand how to * Checks the version code of the FS is one that we understand how to
...@@ -204,7 +203,6 @@ static void gfs2_sb_in(struct gfs2_sbd *sdp, const void *buf) ...@@ -204,7 +203,6 @@ static void gfs2_sb_in(struct gfs2_sbd *sdp, const void *buf)
sb->sb_magic = be32_to_cpu(str->sb_header.mh_magic); sb->sb_magic = be32_to_cpu(str->sb_header.mh_magic);
sb->sb_type = be32_to_cpu(str->sb_header.mh_type); sb->sb_type = be32_to_cpu(str->sb_header.mh_type);
sb->sb_format = be32_to_cpu(str->sb_header.mh_format);
sb->sb_fs_format = be32_to_cpu(str->sb_fs_format); sb->sb_fs_format = be32_to_cpu(str->sb_fs_format);
sb->sb_multihost_format = be32_to_cpu(str->sb_multihost_format); sb->sb_multihost_format = be32_to_cpu(str->sb_multihost_format);
sb->sb_bsize = be32_to_cpu(str->sb_bsize); sb->sb_bsize = be32_to_cpu(str->sb_bsize);
...@@ -223,7 +221,7 @@ static void gfs2_sb_in(struct gfs2_sbd *sdp, const void *buf) ...@@ -223,7 +221,7 @@ static void gfs2_sb_in(struct gfs2_sbd *sdp, const void *buf)
* gfs2_read_super - Read the gfs2 super block from disk * gfs2_read_super - Read the gfs2 super block from disk
* @sdp: The GFS2 super block * @sdp: The GFS2 super block
* @sector: The location of the super block * @sector: The location of the super block
* @error: The error code to return * @silent: Don't print a message if the check fails
* *
* This uses the bio functions to read the super block from disk * This uses the bio functions to read the super block from disk
* because we want to be 100% sure that we never read cached data. * because we want to be 100% sure that we never read cached data.
...@@ -983,7 +981,6 @@ static const struct lm_lockops nolock_ops = { ...@@ -983,7 +981,6 @@ static const struct lm_lockops nolock_ops = {
/** /**
* gfs2_lm_mount - mount a locking protocol * gfs2_lm_mount - mount a locking protocol
* @sdp: the filesystem * @sdp: the filesystem
* @args: mount arguments
* @silent: if 1, don't complain if the FS isn't a GFS2 fs * @silent: if 1, don't complain if the FS isn't a GFS2 fs
* *
* Returns: errno * Returns: errno
...@@ -1093,8 +1090,7 @@ void gfs2_online_uevent(struct gfs2_sbd *sdp) ...@@ -1093,8 +1090,7 @@ void gfs2_online_uevent(struct gfs2_sbd *sdp)
/** /**
* gfs2_fill_super - Read in superblock * gfs2_fill_super - Read in superblock
* @sb: The VFS superblock * @sb: The VFS superblock
* @args: Mount options * @fc: Mount options and flags
* @silent: Don't complain if it's not a GFS2 filesystem
* *
* Returns: -errno * Returns: -errno
*/ */
......
...@@ -1375,8 +1375,8 @@ int gfs2_quota_init(struct gfs2_sbd *sdp) ...@@ -1375,8 +1375,8 @@ int gfs2_quota_init(struct gfs2_sbd *sdp)
unsigned int y; unsigned int y;
if (!extlen) { if (!extlen) {
int new = 0; extlen = 32;
error = gfs2_extent_map(&ip->i_inode, x, &new, &dblock, &extlen); error = gfs2_get_extent(&ip->i_inode, x, &dblock, &extlen);
if (error) if (error)
goto fail; goto fail;
} }
...@@ -1534,7 +1534,7 @@ void gfs2_wake_up_statfs(struct gfs2_sbd *sdp) { ...@@ -1534,7 +1534,7 @@ void gfs2_wake_up_statfs(struct gfs2_sbd *sdp) {
/** /**
* gfs2_quotad - Write cached quota changes into the quota file * gfs2_quotad - Write cached quota changes into the quota file
* @sdp: Pointer to GFS2 superblock * @data: Pointer to GFS2 superblock
* *
*/ */
......
...@@ -34,12 +34,12 @@ int gfs2_replay_read_block(struct gfs2_jdesc *jd, unsigned int blk, ...@@ -34,12 +34,12 @@ int gfs2_replay_read_block(struct gfs2_jdesc *jd, unsigned int blk,
{ {
struct gfs2_inode *ip = GFS2_I(jd->jd_inode); struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
struct gfs2_glock *gl = ip->i_gl; struct gfs2_glock *gl = ip->i_gl;
int new = 0;
u64 dblock; u64 dblock;
u32 extlen; u32 extlen;
int error; int error;
error = gfs2_extent_map(&ip->i_inode, blk, &new, &dblock, &extlen); extlen = 32;
error = gfs2_get_extent(&ip->i_inode, blk, &dblock, &extlen);
if (error) if (error)
return error; return error;
if (!dblock) { if (!dblock) {
...@@ -154,7 +154,7 @@ int __get_log_header(struct gfs2_sbd *sdp, const struct gfs2_log_header *lh, ...@@ -154,7 +154,7 @@ int __get_log_header(struct gfs2_sbd *sdp, const struct gfs2_log_header *lh,
* get_log_header - read the log header for a given segment * get_log_header - read the log header for a given segment
* @jd: the journal * @jd: the journal
* @blk: the block to look at * @blk: the block to look at
* @lh: the log header to return * @head: the log header to return
* *
* Read the log header for a given segement in a given journal. Do a few * Read the log header for a given segement in a given journal. Do a few
* sanity checks on it. * sanity checks on it.
...@@ -187,6 +187,7 @@ static int get_log_header(struct gfs2_jdesc *jd, unsigned int blk, ...@@ -187,6 +187,7 @@ static int get_log_header(struct gfs2_jdesc *jd, unsigned int blk,
* @jd: the journal * @jd: the journal
* @start: the first log header in the active region * @start: the first log header in the active region
* @end: the last log header (don't process the contents of this entry)) * @end: the last log header (don't process the contents of this entry))
* @pass: iteration number (foreach_descriptor() is called in a for() loop)
* *
* Call a given function once for every log descriptor in the active * Call a given function once for every log descriptor in the active
* portion of the log. * portion of the log.
...@@ -437,6 +438,7 @@ void gfs2_recover_func(struct work_struct *work) ...@@ -437,6 +438,7 @@ void gfs2_recover_func(struct work_struct *work)
case GLR_TRYFAILED: case GLR_TRYFAILED:
fs_info(sdp, "jid=%u: Busy\n", jd->jd_jid); fs_info(sdp, "jid=%u: Busy\n", jd->jd_jid);
error = 0; error = 0;
goto fail;
default: default:
goto fail; goto fail;
......
...@@ -743,7 +743,7 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp) ...@@ -743,7 +743,7 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp)
} }
/** /**
* gfs2_compute_bitstructs - Compute the bitmap sizes * compute_bitstructs - Compute the bitmap sizes
* @rgd: The resource group descriptor * @rgd: The resource group descriptor
* *
* Calculates bitmap descriptors, one for each block that contains bitmap data * Calculates bitmap descriptors, one for each block that contains bitmap data
...@@ -1534,8 +1534,9 @@ static void rs_insert(struct gfs2_inode *ip) ...@@ -1534,8 +1534,9 @@ static void rs_insert(struct gfs2_inode *ip)
} }
/** /**
* rgd_free - return the number of free blocks we can allocate. * rgd_free - return the number of free blocks we can allocate
* @rgd: the resource group * @rgd: the resource group
* @rs: The reservation to free
* *
* This function returns the number of free blocks for an rgrp. * This function returns the number of free blocks for an rgrp.
* That's the clone-free blocks (blocks that are free, not including those * That's the clone-free blocks (blocks that are free, not including those
...@@ -1783,7 +1784,7 @@ static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 *minext, ...@@ -1783,7 +1784,7 @@ static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 *minext,
goto next_bitmap; goto next_bitmap;
} }
rbm->offset = offset; rbm->offset = offset;
if (!rs) if (!rs || !minext)
return 0; return 0;
ret = gfs2_reservation_check_and_update(rbm, rs, *minext, ret = gfs2_reservation_check_and_update(rbm, rs, *minext,
...@@ -2019,6 +2020,7 @@ static bool gfs2_select_rgrp(struct gfs2_rgrpd **pos, const struct gfs2_rgrpd *b ...@@ -2019,6 +2020,7 @@ static bool gfs2_select_rgrp(struct gfs2_rgrpd **pos, const struct gfs2_rgrpd *b
/** /**
* fast_to_acquire - determine if a resource group will be fast to acquire * fast_to_acquire - determine if a resource group will be fast to acquire
* @rgd: The rgrp
* *
* If this is one of our preferred rgrps, it should be quicker to acquire, * If this is one of our preferred rgrps, it should be quicker to acquire,
* because we tried to set ourselves up as dlm lock master. * because we tried to set ourselves up as dlm lock master.
......
...@@ -387,8 +387,6 @@ struct lfcc { ...@@ -387,8 +387,6 @@ struct lfcc {
* gfs2_lock_fs_check_clean - Stop all writes to the FS and check that all * gfs2_lock_fs_check_clean - Stop all writes to the FS and check that all
* journals are clean * journals are clean
* @sdp: the file system * @sdp: the file system
* @state: the state to put the transaction lock into
* @t_gh: the hold on the transaction lock
* *
* Returns: errno * Returns: errno
*/ */
...@@ -701,6 +699,7 @@ static void gfs2_put_super(struct super_block *sb) ...@@ -701,6 +699,7 @@ static void gfs2_put_super(struct super_block *sb)
/** /**
* gfs2_sync_fs - sync the filesystem * gfs2_sync_fs - sync the filesystem
* @sb: the superblock * @sb: the superblock
* @wait: true to wait for completion
* *
* Flushes the log to disk. * Flushes the log to disk.
*/ */
...@@ -811,7 +810,7 @@ static int gfs2_unfreeze(struct super_block *sb) ...@@ -811,7 +810,7 @@ static int gfs2_unfreeze(struct super_block *sb)
} }
/** /**
* statfs_fill - fill in the sg for a given RG * statfs_slow_fill - fill in the sg for a given RG
* @rgd: the RG * @rgd: the RG
* @sc: the sc structure * @sc: the sc structure
* *
...@@ -909,7 +908,7 @@ static int gfs2_statfs_slow(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host ...@@ -909,7 +908,7 @@ static int gfs2_statfs_slow(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host
/** /**
* gfs2_statfs_i - Do a statfs * gfs2_statfs_i - Do a statfs
* @sdp: the filesystem * @sdp: the filesystem
* @sg: the sg structure * @sc: the sc structure
* *
* Returns: errno * Returns: errno
*/ */
...@@ -940,8 +939,8 @@ static int gfs2_statfs_i(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host *s ...@@ -940,8 +939,8 @@ static int gfs2_statfs_i(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host *s
/** /**
* gfs2_statfs - Gather and return stats about the filesystem * gfs2_statfs - Gather and return stats about the filesystem
* @sb: The superblock * @dentry: The name of the link
* @statfsbuf: The buffer * @buf: The buffer
* *
* Returns: 0 on success or error code * Returns: 0 on success or error code
*/ */
...@@ -1272,6 +1271,7 @@ static bool gfs2_upgrade_iopen_glock(struct inode *inode) ...@@ -1272,6 +1271,7 @@ static bool gfs2_upgrade_iopen_glock(struct inode *inode)
/** /**
* evict_should_delete - determine whether the inode is eligible for deletion * evict_should_delete - determine whether the inode is eligible for deletion
* @inode: The inode to evict * @inode: The inode to evict
* @gh: The glock holder structure
* *
* This function determines whether the evicted inode is eligible to be deleted * This function determines whether the evicted inode is eligible to be deleted
* and locks the inode glock. * and locks the inode glock.
......
...@@ -63,6 +63,71 @@ static ssize_t id_show(struct gfs2_sbd *sdp, char *buf) ...@@ -63,6 +63,71 @@ static ssize_t id_show(struct gfs2_sbd *sdp, char *buf)
MAJOR(sdp->sd_vfs->s_dev), MINOR(sdp->sd_vfs->s_dev)); MAJOR(sdp->sd_vfs->s_dev), MINOR(sdp->sd_vfs->s_dev));
} }
static ssize_t status_show(struct gfs2_sbd *sdp, char *buf)
{
unsigned long f = sdp->sd_flags;
ssize_t s;
s = snprintf(buf, PAGE_SIZE,
"Journal Checked: %d\n"
"Journal Live: %d\n"
"Journal ID: %d\n"
"Spectator: %d\n"
"Withdrawn: %d\n"
"No barriers: %d\n"
"No recovery: %d\n"
"Demote: %d\n"
"No Journal ID: %d\n"
"Mounted RO: %d\n"
"RO Recovery: %d\n"
"Skip DLM Unlock: %d\n"
"Force AIL Flush: %d\n"
"FS Frozen: %d\n"
"Withdrawing: %d\n"
"Withdraw In Prog: %d\n"
"Remote Withdraw: %d\n"
"Withdraw Recovery: %d\n"
"sd_log_error: %d\n"
"sd_log_flush_lock: %d\n"
"sd_log_num_revoke: %u\n"
"sd_log_in_flight: %d\n"
"sd_log_blks_needed: %d\n"
"sd_log_blks_free: %d\n"
"sd_log_flush_head: %d\n"
"sd_log_flush_tail: %d\n"
"sd_log_blks_reserved: %d\n"
"sd_log_revokes_available: %d\n",
test_bit(SDF_JOURNAL_CHECKED, &f),
test_bit(SDF_JOURNAL_LIVE, &f),
(sdp->sd_jdesc ? sdp->sd_jdesc->jd_jid : 0),
(sdp->sd_args.ar_spectator ? 1 : 0),
test_bit(SDF_WITHDRAWN, &f),
test_bit(SDF_NOBARRIERS, &f),
test_bit(SDF_NORECOVERY, &f),
test_bit(SDF_DEMOTE, &f),
test_bit(SDF_NOJOURNALID, &f),
(sb_rdonly(sdp->sd_vfs) ? 1 : 0),
test_bit(SDF_RORECOVERY, &f),
test_bit(SDF_SKIP_DLM_UNLOCK, &f),
test_bit(SDF_FORCE_AIL_FLUSH, &f),
test_bit(SDF_FS_FROZEN, &f),
test_bit(SDF_WITHDRAWING, &f),
test_bit(SDF_WITHDRAW_IN_PROG, &f),
test_bit(SDF_REMOTE_WITHDRAW, &f),
test_bit(SDF_WITHDRAW_RECOVERY, &f),
sdp->sd_log_error,
rwsem_is_locked(&sdp->sd_log_flush_lock),
sdp->sd_log_num_revoke,
atomic_read(&sdp->sd_log_in_flight),
atomic_read(&sdp->sd_log_blks_needed),
atomic_read(&sdp->sd_log_blks_free),
sdp->sd_log_flush_head,
sdp->sd_log_flush_tail,
sdp->sd_log_blks_reserved,
atomic_read(&sdp->sd_log_revokes_available));
return s;
}
static ssize_t fsname_show(struct gfs2_sbd *sdp, char *buf) static ssize_t fsname_show(struct gfs2_sbd *sdp, char *buf)
{ {
return snprintf(buf, PAGE_SIZE, "%s\n", sdp->sd_fsname); return snprintf(buf, PAGE_SIZE, "%s\n", sdp->sd_fsname);
...@@ -283,6 +348,7 @@ GFS2_ATTR(quota_sync, 0200, NULL, quota_sync_store); ...@@ -283,6 +348,7 @@ GFS2_ATTR(quota_sync, 0200, NULL, quota_sync_store);
GFS2_ATTR(quota_refresh_user, 0200, NULL, quota_refresh_user_store); GFS2_ATTR(quota_refresh_user, 0200, NULL, quota_refresh_user_store);
GFS2_ATTR(quota_refresh_group, 0200, NULL, quota_refresh_group_store); GFS2_ATTR(quota_refresh_group, 0200, NULL, quota_refresh_group_store);
GFS2_ATTR(demote_rq, 0200, NULL, demote_rq_store); GFS2_ATTR(demote_rq, 0200, NULL, demote_rq_store);
GFS2_ATTR(status, 0400, status_show, NULL);
static struct attribute *gfs2_attrs[] = { static struct attribute *gfs2_attrs[] = {
&gfs2_attr_id.attr, &gfs2_attr_id.attr,
...@@ -295,6 +361,7 @@ static struct attribute *gfs2_attrs[] = { ...@@ -295,6 +361,7 @@ static struct attribute *gfs2_attrs[] = {
&gfs2_attr_quota_refresh_user.attr, &gfs2_attr_quota_refresh_user.attr,
&gfs2_attr_quota_refresh_group.attr, &gfs2_attr_quota_refresh_group.attr,
&gfs2_attr_demote_rq.attr, &gfs2_attr_demote_rq.attr,
&gfs2_attr_status.attr,
NULL, NULL,
}; };
ATTRIBUTE_GROUPS(gfs2); ATTRIBUTE_GROUPS(gfs2);
......
...@@ -44,6 +44,7 @@ void gfs2_assert_i(struct gfs2_sbd *sdp) ...@@ -44,6 +44,7 @@ void gfs2_assert_i(struct gfs2_sbd *sdp)
* check_journal_clean - Make sure a journal is clean for a spectator mount * check_journal_clean - Make sure a journal is clean for a spectator mount
* @sdp: The GFS2 superblock * @sdp: The GFS2 superblock
* @jd: The journal descriptor * @jd: The journal descriptor
* @verbose: Show more prints in the log
* *
* Returns: 0 if the journal is clean or locked, else an error * Returns: 0 if the journal is clean or locked, else an error
*/ */
...@@ -362,7 +363,7 @@ int gfs2_withdraw(struct gfs2_sbd *sdp) ...@@ -362,7 +363,7 @@ int gfs2_withdraw(struct gfs2_sbd *sdp)
return -1; return -1;
} }
/** /*
* gfs2_assert_withdraw_i - Cause the machine to withdraw if @assertion is false * gfs2_assert_withdraw_i - Cause the machine to withdraw if @assertion is false
*/ */
...@@ -392,7 +393,7 @@ void gfs2_assert_withdraw_i(struct gfs2_sbd *sdp, char *assertion, ...@@ -392,7 +393,7 @@ void gfs2_assert_withdraw_i(struct gfs2_sbd *sdp, char *assertion,
dump_stack(); dump_stack();
} }
/** /*
* gfs2_assert_warn_i - Print a message to the console if @assertion is false * gfs2_assert_warn_i - Print a message to the console if @assertion is false
*/ */
...@@ -422,7 +423,7 @@ void gfs2_assert_warn_i(struct gfs2_sbd *sdp, char *assertion, ...@@ -422,7 +423,7 @@ void gfs2_assert_warn_i(struct gfs2_sbd *sdp, char *assertion,
sdp->sd_last_warning = jiffies; sdp->sd_last_warning = jiffies;
} }
/** /*
* gfs2_consist_i - Flag a filesystem consistency error and withdraw * gfs2_consist_i - Flag a filesystem consistency error and withdraw
*/ */
...@@ -435,7 +436,7 @@ void gfs2_consist_i(struct gfs2_sbd *sdp, const char *function, ...@@ -435,7 +436,7 @@ void gfs2_consist_i(struct gfs2_sbd *sdp, const char *function,
gfs2_withdraw(sdp); gfs2_withdraw(sdp);
} }
/** /*
* gfs2_consist_inode_i - Flag an inode consistency error and withdraw * gfs2_consist_inode_i - Flag an inode consistency error and withdraw
*/ */
...@@ -454,7 +455,7 @@ void gfs2_consist_inode_i(struct gfs2_inode *ip, ...@@ -454,7 +455,7 @@ void gfs2_consist_inode_i(struct gfs2_inode *ip,
gfs2_withdraw(sdp); gfs2_withdraw(sdp);
} }
/** /*
* gfs2_consist_rgrpd_i - Flag a RG consistency error and withdraw * gfs2_consist_rgrpd_i - Flag a RG consistency error and withdraw
*/ */
...@@ -475,7 +476,7 @@ void gfs2_consist_rgrpd_i(struct gfs2_rgrpd *rgd, ...@@ -475,7 +476,7 @@ void gfs2_consist_rgrpd_i(struct gfs2_rgrpd *rgd,
gfs2_withdraw(sdp); gfs2_withdraw(sdp);
} }
/** /*
* gfs2_meta_check_ii - Flag a magic number consistency error and withdraw * gfs2_meta_check_ii - Flag a magic number consistency error and withdraw
* Returns: -1 if this call withdrew the machine, * Returns: -1 if this call withdrew the machine,
* -2 if it was already withdrawn * -2 if it was already withdrawn
...@@ -497,7 +498,7 @@ int gfs2_meta_check_ii(struct gfs2_sbd *sdp, struct buffer_head *bh, ...@@ -497,7 +498,7 @@ int gfs2_meta_check_ii(struct gfs2_sbd *sdp, struct buffer_head *bh,
return (me) ? -1 : -2; return (me) ? -1 : -2;
} }
/** /*
* gfs2_metatype_check_ii - Flag a metadata type consistency error and withdraw * gfs2_metatype_check_ii - Flag a metadata type consistency error and withdraw
* Returns: -1 if this call withdrew the machine, * Returns: -1 if this call withdrew the machine,
* -2 if it was already withdrawn * -2 if it was already withdrawn
...@@ -519,7 +520,7 @@ int gfs2_metatype_check_ii(struct gfs2_sbd *sdp, struct buffer_head *bh, ...@@ -519,7 +520,7 @@ int gfs2_metatype_check_ii(struct gfs2_sbd *sdp, struct buffer_head *bh,
return (me) ? -1 : -2; return (me) ? -1 : -2;
} }
/** /*
* gfs2_io_error_i - Flag an I/O error and withdraw * gfs2_io_error_i - Flag an I/O error and withdraw
* Returns: -1 if this call withdrew the machine, * Returns: -1 if this call withdrew the machine,
* 0 if it was already withdrawn * 0 if it was already withdrawn
...@@ -535,7 +536,7 @@ int gfs2_io_error_i(struct gfs2_sbd *sdp, const char *function, char *file, ...@@ -535,7 +536,7 @@ int gfs2_io_error_i(struct gfs2_sbd *sdp, const char *function, char *file,
return gfs2_withdraw(sdp); return gfs2_withdraw(sdp);
} }
/** /*
* gfs2_io_error_bh_i - Flag a buffer I/O error * gfs2_io_error_bh_i - Flag a buffer I/O error
* @withdraw: withdraw the filesystem * @withdraw: withdraw the filesystem
*/ */
......
...@@ -26,12 +26,9 @@ ...@@ -26,12 +26,9 @@
#include "trans.h" #include "trans.h"
#include "util.h" #include "util.h"
/** /*
* ea_calc_size - returns the acutal number of bytes the request will take up * ea_calc_size - returns the actual number of bytes the request will take up
* (not counting any unstuffed data blocks) * (not counting any unstuffed data blocks)
* @sdp:
* @er:
* @size:
* *
* Returns: 1 if the EA should be stuffed * Returns: 1 if the EA should be stuffed
*/ */
...@@ -219,13 +216,8 @@ static int gfs2_ea_find(struct gfs2_inode *ip, int type, const char *name, ...@@ -219,13 +216,8 @@ static int gfs2_ea_find(struct gfs2_inode *ip, int type, const char *name,
return error; return error;
} }
/** /*
* ea_dealloc_unstuffed - * ea_dealloc_unstuffed
* @ip:
* @bh:
* @ea:
* @prev:
* @private:
* *
* Take advantage of the fact that all unstuffed blocks are * Take advantage of the fact that all unstuffed blocks are
* allocated from the same RG. But watch, this may not always * allocated from the same RG. But watch, this may not always
...@@ -448,8 +440,8 @@ ssize_t gfs2_listxattr(struct dentry *dentry, char *buffer, size_t size) ...@@ -448,8 +440,8 @@ ssize_t gfs2_listxattr(struct dentry *dentry, char *buffer, size_t size)
} }
/** /**
* ea_iter_unstuffed - copies the unstuffed xattr data to/from the * gfs2_iter_unstuffed - copies the unstuffed xattr data to/from the
* request buffer * request buffer
* @ip: The GFS2 inode * @ip: The GFS2 inode
* @ea: The extended attribute header structure * @ea: The extended attribute header structure
* @din: The data to be copied in * @din: The data to be copied in
...@@ -573,7 +565,7 @@ int gfs2_xattr_acl_get(struct gfs2_inode *ip, const char *name, char **ppdata) ...@@ -573,7 +565,7 @@ int gfs2_xattr_acl_get(struct gfs2_inode *ip, const char *name, char **ppdata)
} }
/** /**
* gfs2_xattr_get - Get a GFS2 extended attribute * __gfs2_xattr_get - Get a GFS2 extended attribute
* @inode: The inode * @inode: The inode
* @name: The name of the extended attribute * @name: The name of the extended attribute
* @buffer: The buffer to write the result into * @buffer: The buffer to write the result into
...@@ -801,14 +793,11 @@ static int ea_init_i(struct gfs2_inode *ip, struct gfs2_ea_request *er, ...@@ -801,14 +793,11 @@ static int ea_init_i(struct gfs2_inode *ip, struct gfs2_ea_request *er,
return error; return error;
} }
/** /*
* ea_init - initializes a new eattr block * ea_init - initializes a new eattr block
* @ip:
* @er:
* *
* Returns: errno * Returns: errno
*/ */
static int ea_init(struct gfs2_inode *ip, int type, const char *name, static int ea_init(struct gfs2_inode *ip, int type, const char *name,
const void *data, size_t size) const void *data, size_t size)
{ {
...@@ -1164,7 +1153,7 @@ static int gfs2_xattr_remove(struct gfs2_inode *ip, int type, const char *name) ...@@ -1164,7 +1153,7 @@ static int gfs2_xattr_remove(struct gfs2_inode *ip, int type, const char *name)
/** /**
* __gfs2_xattr_set - Set (or remove) a GFS2 extended attribute * __gfs2_xattr_set - Set (or remove) a GFS2 extended attribute
* @ip: The inode * @inode: The inode
* @name: The name of the extended attribute * @name: The name of the extended attribute
* @value: The value of the extended attribute (NULL for remove) * @value: The value of the extended attribute (NULL for remove)
* @size: The size of the @value argument * @size: The size of the @value argument
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment