Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw
Browse files Browse the repository at this point in the history
* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw:
  GFS2: Fix typo
  GFS2: stuck in inode wait, no glocks stuck
  GFS2: Eliminate useless err variable
  GFS2: Fix writing to non-page aligned gfs2_quota structures
  GFS2: Add some useful messages
  GFS2: fix quota state reporting
  GFS2: Various gfs2_logd improvements
  GFS2: glock livelock
  GFS2: Clean up stuffed file copying
  GFS2: docs update
  GFS2: Remove space from slab cache name
  • Loading branch information
Linus Torvalds committed May 21, 2010
2 parents e90e4d9 + 6a99be5 commit 677abe4
Show file tree
Hide file tree
Showing 20 changed files with 368 additions and 185 deletions.
12 changes: 6 additions & 6 deletions Documentation/filesystems/gfs2.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Global File System
------------------

http://sources.redhat.com/cluster/
http://sources.redhat.com/cluster/wiki/

GFS is a cluster file system. It allows a cluster of computers to
simultaneously use a block device that is shared between them (with FC,
Expand Down Expand Up @@ -36,11 +36,11 @@ GFS2 is not on-disk compatible with previous versions of GFS, but it
is pretty close.

The following man pages can be found at the URL above:
fsck.gfs2 to repair a filesystem
gfs2_grow to expand a filesystem online
gfs2_jadd to add journals to a filesystem online
gfs2_tool to manipulate, examine and tune a filesystem
fsck.gfs2 to repair a filesystem
gfs2_grow to expand a filesystem online
gfs2_jadd to add journals to a filesystem online
gfs2_tool to manipulate, examine and tune a filesystem
gfs2_quota to examine and change quota values in a filesystem
gfs2_convert to convert a gfs filesystem to gfs2 in-place
mount.gfs2 to help mount(8) mount a filesystem
mkfs.gfs2 to make a filesystem
mkfs.gfs2 to make a filesystem
8 changes: 5 additions & 3 deletions fs/gfs2/aops.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ static int gfs2_jdata_writepages(struct address_space *mapping,
static int stuffed_readpage(struct gfs2_inode *ip, struct page *page)
{
struct buffer_head *dibh;
u64 dsize = i_size_read(&ip->i_inode);
void *kaddr;
int error;

Expand All @@ -437,9 +438,10 @@ static int stuffed_readpage(struct gfs2_inode *ip, struct page *page)
return error;

kaddr = kmap_atomic(page, KM_USER0);
memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode),
ip->i_disksize);
memset(kaddr + ip->i_disksize, 0, PAGE_CACHE_SIZE - ip->i_disksize);
if (dsize > (dibh->b_size - sizeof(struct gfs2_dinode)))
dsize = (dibh->b_size - sizeof(struct gfs2_dinode));
memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), dsize);
memset(kaddr + dsize, 0, PAGE_CACHE_SIZE - dsize);
kunmap_atomic(kaddr, KM_USER0);
flush_dcache_page(page);
brelse(dibh);
Expand Down
17 changes: 10 additions & 7 deletions fs/gfs2/bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ static int gfs2_unstuffer_page(struct gfs2_inode *ip, struct buffer_head *dibh,

if (!PageUptodate(page)) {
void *kaddr = kmap(page);
u64 dsize = i_size_read(inode);

if (dsize > (dibh->b_size - sizeof(struct gfs2_dinode)))
dsize = dibh->b_size - sizeof(struct gfs2_dinode);

memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode),
ip->i_disksize);
memset(kaddr + ip->i_disksize, 0,
PAGE_CACHE_SIZE - ip->i_disksize);
memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), dsize);
memset(kaddr + dsize, 0, PAGE_CACHE_SIZE - dsize);
kunmap(page);

SetPageUptodate(page);
Expand Down Expand Up @@ -1038,13 +1040,14 @@ static int trunc_start(struct gfs2_inode *ip, u64 size)
goto out;

if (gfs2_is_stuffed(ip)) {
ip->i_disksize = size;
u64 dsize = size + sizeof(struct gfs2_inode);
ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
gfs2_trans_add_bh(ip->i_gl, dibh, 1);
gfs2_dinode_out(ip, dibh->b_data);
gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode) + size);
if (dsize > dibh->b_size)
dsize = dibh->b_size;
gfs2_buffer_clear_tail(dibh, dsize);
error = 1;

} else {
if (size & (u64)(sdp->sd_sb.sb_bsize - 1))
error = gfs2_block_truncate_page(ip->i_inode.i_mapping);
Expand Down
2 changes: 1 addition & 1 deletion fs/gfs2/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,7 @@ struct inode *gfs2_dir_search(struct inode *dir, const struct qstr *name)
inode = gfs2_inode_lookup(dir->i_sb,
be16_to_cpu(dent->de_type),
be64_to_cpu(dent->de_inum.no_addr),
be64_to_cpu(dent->de_inum.no_formal_ino), 0);
be64_to_cpu(dent->de_inum.no_formal_ino));
brelse(bh);
return inode;
}
Expand Down
2 changes: 1 addition & 1 deletion fs/gfs2/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb,
if (error)
goto fail;

inode = gfs2_inode_lookup(sb, DT_UNKNOWN, inum->no_addr, 0, 0);
inode = gfs2_inode_lookup(sb, DT_UNKNOWN, inum->no_addr, 0);
if (IS_ERR(inode)) {
error = PTR_ERR(inode);
goto fail;
Expand Down
3 changes: 3 additions & 0 deletions fs/gfs2/glock.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,9 @@ void gfs2_holder_reinit(unsigned int state, unsigned flags, struct gfs2_holder *
gh->gh_flags = flags;
gh->gh_iflags = 0;
gh->gh_ip = (unsigned long)__builtin_return_address(0);
if (gh->gh_owner_pid)
put_pid(gh->gh_owner_pid);
gh->gh_owner_pid = get_pid(task_pid(current));
}

/**
Expand Down
11 changes: 6 additions & 5 deletions fs/gfs2/incore.h
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,6 @@ struct gfs2_args {
struct gfs2_tune {
spinlock_t gt_spin;

unsigned int gt_incore_log_blocks;
unsigned int gt_log_flush_secs;

unsigned int gt_logd_secs;

unsigned int gt_quota_simul_sync; /* Max quotavals to sync at once */
Expand All @@ -462,6 +459,7 @@ enum {
SDF_SHUTDOWN = 2,
SDF_NOBARRIERS = 3,
SDF_NORECOVERY = 4,
SDF_DEMOTE = 5,
};

#define GFS2_FSNAME_LEN 256
Expand Down Expand Up @@ -618,6 +616,7 @@ struct gfs2_sbd {
unsigned int sd_log_commited_databuf;
int sd_log_commited_revoke;

atomic_t sd_log_pinned;
unsigned int sd_log_num_buf;
unsigned int sd_log_num_revoke;
unsigned int sd_log_num_rg;
Expand All @@ -629,15 +628,17 @@ struct gfs2_sbd {
struct list_head sd_log_le_databuf;
struct list_head sd_log_le_ordered;

atomic_t sd_log_thresh1;
atomic_t sd_log_thresh2;
atomic_t sd_log_blks_free;
struct mutex sd_log_reserve_mutex;
wait_queue_head_t sd_log_waitq;
wait_queue_head_t sd_logd_waitq;

u64 sd_log_sequence;
unsigned int sd_log_head;
unsigned int sd_log_tail;
int sd_log_idle;

unsigned long sd_log_flush_time;
struct rw_semaphore sd_log_flush_lock;
atomic_t sd_log_in_flight;
wait_queue_head_t sd_log_flush_wait;
Expand Down
101 changes: 92 additions & 9 deletions fs/gfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,25 +158,21 @@ void gfs2_set_iop(struct inode *inode)
* @sb: The super block
* @no_addr: The inode number
* @type: The type of the inode
* @skip_freeing: set this not return an inode if it is currently being freed.
*
* Returns: A VFS inode, or an error
*/

struct inode *gfs2_inode_lookup(struct super_block *sb,
unsigned int type,
u64 no_addr,
u64 no_formal_ino, int skip_freeing)
u64 no_formal_ino)
{
struct inode *inode;
struct gfs2_inode *ip;
struct gfs2_glock *io_gl;
int error;

if (skip_freeing)
inode = gfs2_iget_skip(sb, no_addr);
else
inode = gfs2_iget(sb, no_addr);
inode = gfs2_iget(sb, no_addr);
ip = GFS2_I(inode);

if (!inode)
Expand Down Expand Up @@ -234,13 +230,100 @@ struct inode *gfs2_inode_lookup(struct super_block *sb,
fail_iopen:
gfs2_glock_put(io_gl);
fail_put:
ip->i_gl->gl_object = NULL;
if (inode->i_state & I_NEW)
ip->i_gl->gl_object = NULL;
gfs2_glock_put(ip->i_gl);
fail:
iget_failed(inode);
if (inode->i_state & I_NEW)
iget_failed(inode);
else
iput(inode);
return ERR_PTR(error);
}

/**
* gfs2_unlinked_inode_lookup - Lookup an unlinked inode for reclamation
* @sb: The super block
* no_addr: The inode number
* @@inode: A pointer to the inode found, if any
*
* Returns: 0 and *inode if no errors occurred. If an error occurs,
* the resulting *inode may or may not be NULL.
*/

int gfs2_unlinked_inode_lookup(struct super_block *sb, u64 no_addr,
struct inode **inode)
{
struct gfs2_sbd *sdp;
struct gfs2_inode *ip;
struct gfs2_glock *io_gl;
int error;
struct gfs2_holder gh;

*inode = gfs2_iget_skip(sb, no_addr);

if (!(*inode))
return -ENOBUFS;

if (!((*inode)->i_state & I_NEW))
return -ENOBUFS;

ip = GFS2_I(*inode);
sdp = GFS2_SB(*inode);
ip->i_no_formal_ino = -1;

error = gfs2_glock_get(sdp, no_addr, &gfs2_inode_glops, CREATE, &ip->i_gl);
if (unlikely(error))
goto fail;
ip->i_gl->gl_object = ip;

error = gfs2_glock_get(sdp, no_addr, &gfs2_iopen_glops, CREATE, &io_gl);
if (unlikely(error))
goto fail_put;

set_bit(GIF_INVALID, &ip->i_flags);
error = gfs2_glock_nq_init(io_gl, LM_ST_SHARED, LM_FLAG_TRY | GL_EXACT,
&ip->i_iopen_gh);
if (unlikely(error)) {
if (error == GLR_TRYFAILED)
error = 0;
goto fail_iopen;
}
ip->i_iopen_gh.gh_gl->gl_object = ip;
gfs2_glock_put(io_gl);

(*inode)->i_mode = DT2IF(DT_UNKNOWN);

/*
* We must read the inode in order to work out its type in
* this case. Note that this doesn't happen often as we normally
* know the type beforehand. This code path only occurs during
* unlinked inode recovery (where it is safe to do this glock,
* which is not true in the general case).
*/
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, LM_FLAG_TRY,
&gh);
if (unlikely(error)) {
if (error == GLR_TRYFAILED)
error = 0;
goto fail_glock;
}
/* Inode is now uptodate */
gfs2_glock_dq_uninit(&gh);
gfs2_set_iop(*inode);

return 0;
fail_glock:
gfs2_glock_dq(&ip->i_iopen_gh);
fail_iopen:
gfs2_glock_put(io_gl);
fail_put:
ip->i_gl->gl_object = NULL;
gfs2_glock_put(ip->i_gl);
fail:
return error;
}

static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
{
const struct gfs2_dinode *str = buf;
Expand Down Expand Up @@ -862,7 +945,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name,
goto fail_gunlock2;

inode = gfs2_inode_lookup(dir->i_sb, IF2DT(mode), inum.no_addr,
inum.no_formal_ino, 0);
inum.no_formal_ino);
if (IS_ERR(inode))
goto fail_gunlock2;

Expand Down
5 changes: 3 additions & 2 deletions fs/gfs2/inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ static inline void gfs2_inum_out(const struct gfs2_inode *ip,

extern void gfs2_set_iop(struct inode *inode);
extern struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned type,
u64 no_addr, u64 no_formal_ino,
int skip_freeing);
u64 no_addr, u64 no_formal_ino);
extern int gfs2_unlinked_inode_lookup(struct super_block *sb, u64 no_addr,
struct inode **inode);
extern struct inode *gfs2_ilookup(struct super_block *sb, u64 no_addr);

extern int gfs2_inode_refresh(struct gfs2_inode *ip);
Expand Down
Loading

0 comments on commit 677abe4

Please sign in to comment.