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: (25 commits)
  GFS2: Merge gfs2_get_sb into gfs2_get_sb_meta
  GFS2: Fix cache coherency between truncate and O_DIRECT read
  GFS2: Fix locking issue mounting gfs2meta fs
  GFS2: Remove unused variable
  GFS2: smbd proccess hangs with flock() call.
  GFS2: Remove args subdir from gfs2 sysfs files
  GFS2: Remove lockstruct subdir from gfs2 sysfs files
  GFS2: Move gfs2_unlink_ok into ops_inode.c
  GFS2: Move gfs2_readlinki into ops_inode.c
  GFS2: Move gfs2_rmdiri into ops_inode.c
  GFS2: Merge mount.c and ops_super.c into super.c
  GFS2: Clean up some file names
  GFS2: Be more aggressive in reclaiming unlinked inodes
  GFS2: Add a rgrp bitmap full flag
  GFS2: Improve resource group error handling
  GFS2: Don't warn when delete inode fails on ro filesystem
  GFS2: Update docs
  GFS2: Umount recovery race fix
  GFS2: Remove a couple of unused sysfs entries
  GFS2: Add commit= mount option
  ...
  • Loading branch information
Linus Torvalds committed Jun 11, 2009
2 parents c29f5ec + 003dec8 commit 0a33f80
Show file tree
Hide file tree
Showing 33 changed files with 1,534 additions and 1,584 deletions.
2 changes: 1 addition & 1 deletion Documentation/filesystems/gfs2-glocks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ go_lock | Called for the first local holder of a lock
go_unlock | Called on the final local unlock of a lock
go_dump | Called to print content of object for debugfs file, or on
| error to dump glock to the log.
go_type; | The type of the glock, LM_TYPE_.....
go_type | The type of the glock, LM_TYPE_.....
go_min_hold_time | The minimum hold time

The minimum hold time for each lock is the time after a remote lock
Expand Down
19 changes: 11 additions & 8 deletions Documentation/filesystems/gfs2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,15 @@ their I/O so file system consistency is maintained. One of the nifty
features of GFS is perfect consistency -- changes made to the file system
on one machine show up immediately on all other machines in the cluster.

GFS uses interchangable inter-node locking mechanisms. Different lock
modules can plug into GFS and each file system selects the appropriate
lock module at mount time. Lock modules include:
GFS uses interchangable inter-node locking mechanisms, the currently
supported mechanisms are:

lock_nolock -- allows gfs to be used as a local file system

lock_dlm -- uses a distributed lock manager (dlm) for inter-node locking
The dlm is found at linux/fs/dlm/

In addition to interfacing with an external locking manager, a gfs lock
module is responsible for interacting with external cluster management
systems. Lock_dlm depends on user space cluster management systems found
Lock_dlm depends on user space cluster management systems found
at the URL above.

To use gfs as a local file system, no external clustering systems are
Expand All @@ -31,13 +28,19 @@ needed, simply:
$ mkfs -t gfs2 -p lock_nolock -j 1 /dev/block_device
$ mount -t gfs2 /dev/block_device /dir

GFS2 is not on-disk compatible with previous versions of GFS.
If you are using Fedora, you need to install the gfs2-utils package
and, for lock_dlm, you will also need to install the cman package
and write a cluster.conf as per the documentation.

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:
gfs2_fsck to repair 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
1 change: 1 addition & 0 deletions fs/gfs2/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ config GFS2_FS
select IP_SCTP if DLM_SCTP
select FS_POSIX_ACL
select CRC32
select SLOW_WORK
help
A cluster filesystem.

Expand Down
4 changes: 2 additions & 2 deletions fs/gfs2/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
obj-$(CONFIG_GFS2_FS) += gfs2.o
gfs2-y := acl.o bmap.o dir.o eaops.o eattr.o glock.o \
glops.o inode.o log.o lops.o main.o meta_io.o \
mount.o ops_address.o ops_dentry.o ops_export.o ops_file.o \
ops_fstype.o ops_inode.o ops_super.o quota.o \
aops.o dentry.o export.o file.o \
ops_fstype.o ops_inode.o quota.o \
recovery.o rgrp.o super.o sys.o trans.o util.o

gfs2-$(CONFIG_GFS2_FS_LOCKING_DLM) += lock_dlm.o
Expand Down
21 changes: 10 additions & 11 deletions fs/gfs2/ops_address.c → fs/gfs2/aops.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "inode.h"
#include "log.h"
#include "meta_io.h"
#include "ops_address.h"
#include "quota.h"
#include "trans.h"
#include "rgrp.h"
Expand Down Expand Up @@ -781,10 +780,12 @@ static int gfs2_stuffed_write_end(struct inode *inode, struct buffer_head *dibh,
unlock_page(page);
page_cache_release(page);

if (inode->i_size < to) {
i_size_write(inode, to);
ip->i_disksize = inode->i_size;
di->di_size = cpu_to_be64(inode->i_size);
if (copied) {
if (inode->i_size < to) {
i_size_write(inode, to);
ip->i_disksize = inode->i_size;
}
gfs2_dinode_out(ip, di);
mark_inode_dirty(inode);
}

Expand Down Expand Up @@ -824,7 +825,6 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping,
struct gfs2_sbd *sdp = GFS2_SB(inode);
struct buffer_head *dibh;
struct gfs2_alloc *al = ip->i_alloc;
struct gfs2_dinode *di;
unsigned int from = pos & (PAGE_CACHE_SIZE - 1);
unsigned int to = from + len;
int ret;
Expand All @@ -847,11 +847,10 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping,
gfs2_page_add_databufs(ip, page, from, to);

ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata);

if (likely(ret >= 0) && (inode->i_size > ip->i_disksize)) {
di = (struct gfs2_dinode *)dibh->b_data;
ip->i_disksize = inode->i_size;
di->di_size = cpu_to_be64(inode->i_size);
if (ret > 0) {
if (inode->i_size > ip->i_disksize)
ip->i_disksize = inode->i_size;
gfs2_dinode_out(ip, dibh->b_data);
mark_inode_dirty(inode);
}

Expand Down
12 changes: 8 additions & 4 deletions fs/gfs2/bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "trans.h"
#include "dir.h"
#include "util.h"
#include "ops_address.h"

/* This doesn't need to be that large as max 64 bit pointers in a 4k
* block is 512, so __u16 is fine for that. It saves stack space to
Expand Down Expand Up @@ -136,7 +135,9 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page)
and write it out to disk */

unsigned int n = 1;
block = gfs2_alloc_block(ip, &n);
error = gfs2_alloc_block(ip, &block, &n);
if (error)
goto out_brelse;
if (isdir) {
gfs2_trans_add_unrevoke(GFS2_SB(&ip->i_inode), block, 1);
error = gfs2_dir_get_new_buffer(ip, block, &bh);
Expand Down Expand Up @@ -476,8 +477,11 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock,
blks = dblks + iblks;
i = sheight;
do {
int error;
n = blks - alloced;
bn = gfs2_alloc_block(ip, &n);
error = gfs2_alloc_block(ip, &bn, &n);
if (error)
return error;
alloced += n;
if (state != ALLOC_DATA || gfs2_is_jdata(ip))
gfs2_trans_add_unrevoke(sdp, bn, n);
Expand Down Expand Up @@ -1008,7 +1012,7 @@ static int gfs2_block_truncate_page(struct address_space *mapping)
gfs2_trans_add_bh(ip->i_gl, bh, 0);

zero_user(page, offset, length);

mark_buffer_dirty(bh);
unlock:
unlock_page(page);
page_cache_release(page);
Expand Down
File renamed without changes.
11 changes: 9 additions & 2 deletions fs/gfs2/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -803,13 +803,20 @@ static struct gfs2_leaf *new_leaf(struct inode *inode, struct buffer_head **pbh,
{
struct gfs2_inode *ip = GFS2_I(inode);
unsigned int n = 1;
u64 bn = gfs2_alloc_block(ip, &n);
struct buffer_head *bh = gfs2_meta_new(ip->i_gl, bn);
u64 bn;
int error;
struct buffer_head *bh;
struct gfs2_leaf *leaf;
struct gfs2_dirent *dent;
struct qstr name = { .name = "", .len = 0, .hash = 0 };

error = gfs2_alloc_block(ip, &bn, &n);
if (error)
return NULL;
bh = gfs2_meta_new(ip->i_gl, bn);
if (!bh)
return NULL;

gfs2_trans_add_unrevoke(GFS2_SB(inode), bn, 1);
gfs2_trans_add_bh(ip->i_gl, bh, 1);
gfs2_metatype_set(bh, GFS2_METATYPE_LF, GFS2_FORMAT_LF);
Expand Down
14 changes: 11 additions & 3 deletions fs/gfs2/eattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,11 @@ static int ea_alloc_blk(struct gfs2_inode *ip, struct buffer_head **bhp)
struct gfs2_ea_header *ea;
unsigned int n = 1;
u64 block;
int error;

block = gfs2_alloc_block(ip, &n);
error = gfs2_alloc_block(ip, &block, &n);
if (error)
return error;
gfs2_trans_add_unrevoke(sdp, block, 1);
*bhp = gfs2_meta_new(ip->i_gl, block);
gfs2_trans_add_bh(ip->i_gl, *bhp, 1);
Expand Down Expand Up @@ -617,6 +620,7 @@ static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
struct gfs2_ea_request *er)
{
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
int error;

ea->ea_data_len = cpu_to_be32(er->er_data_len);
ea->ea_name_len = er->er_name_len;
Expand All @@ -642,7 +646,9 @@ static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
int mh_size = sizeof(struct gfs2_meta_header);
unsigned int n = 1;

block = gfs2_alloc_block(ip, &n);
error = gfs2_alloc_block(ip, &block, &n);
if (error)
return error;
gfs2_trans_add_unrevoke(sdp, block, 1);
bh = gfs2_meta_new(ip->i_gl, block);
gfs2_trans_add_bh(ip->i_gl, bh, 1);
Expand Down Expand Up @@ -963,7 +969,9 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er,
} else {
u64 blk;
unsigned int n = 1;
blk = gfs2_alloc_block(ip, &n);
error = gfs2_alloc_block(ip, &blk, &n);
if (error)
return error;
gfs2_trans_add_unrevoke(sdp, blk, 1);
indbh = gfs2_meta_new(ip->i_gl, blk);
gfs2_trans_add_bh(ip->i_gl, indbh, 1);
Expand Down
File renamed without changes.
36 changes: 18 additions & 18 deletions fs/gfs2/ops_file.c → fs/gfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include "trans.h"
#include "util.h"
#include "eaops.h"
#include "ops_address.h"

/**
* gfs2_llseek - seek to a location in a file
Expand Down Expand Up @@ -425,33 +424,36 @@ static struct vm_operations_struct gfs2_vm_ops = {
.page_mkwrite = gfs2_page_mkwrite,
};


/**
* gfs2_mmap -
* @file: The file to map
* @vma: The VMA which described the mapping
*
* Returns: 0 or error code
* There is no need to get a lock here unless we should be updating
* atime. We ignore any locking errors since the only consequence is
* a missed atime update (which will just be deferred until later).
*
* Returns: 0
*/

static int gfs2_mmap(struct file *file, struct vm_area_struct *vma)
{
struct gfs2_inode *ip = GFS2_I(file->f_mapping->host);
struct gfs2_holder i_gh;
int error;

gfs2_holder_init(ip->i_gl, LM_ST_SHARED, 0, &i_gh);
error = gfs2_glock_nq(&i_gh);
if (error) {
gfs2_holder_uninit(&i_gh);
return error;
}
if (!(file->f_flags & O_NOATIME)) {
struct gfs2_holder i_gh;
int error;

gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh);
error = gfs2_glock_nq(&i_gh);
file_accessed(file);
if (error == 0)
gfs2_glock_dq_uninit(&i_gh);
}
vma->vm_ops = &gfs2_vm_ops;
vma->vm_flags |= VM_CAN_NONLINEAR;

gfs2_glock_dq_uninit(&i_gh);

return error;
return 0;
}

/**
Expand Down Expand Up @@ -692,12 +694,10 @@ static void do_unflock(struct file *file, struct file_lock *fl)

static int gfs2_flock(struct file *file, int cmd, struct file_lock *fl)
{
struct gfs2_inode *ip = GFS2_I(file->f_mapping->host);

if (!(fl->fl_flags & FL_FLOCK))
return -ENOLCK;
if (__mandatory_lock(&ip->i_inode))
return -ENOLCK;
if (fl->fl_type & LOCK_MAND)
return -EOPNOTSUPP;

if (fl->fl_type == F_UNLCK) {
do_unflock(file, fl);
Expand Down
21 changes: 18 additions & 3 deletions fs/gfs2/glock.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,22 +796,37 @@ void gfs2_holder_uninit(struct gfs2_holder *gh)
gh->gh_ip = 0;
}

static int just_schedule(void *word)
/**
* gfs2_glock_holder_wait
* @word: unused
*
* This function and gfs2_glock_demote_wait both show up in the WCHAN
* field. Thus I've separated these otherwise identical functions in
* order to be more informative to the user.
*/

static int gfs2_glock_holder_wait(void *word)
{
schedule();
return 0;
}

static int gfs2_glock_demote_wait(void *word)
{
schedule();
return 0;
}

static void wait_on_holder(struct gfs2_holder *gh)
{
might_sleep();
wait_on_bit(&gh->gh_iflags, HIF_WAIT, just_schedule, TASK_UNINTERRUPTIBLE);
wait_on_bit(&gh->gh_iflags, HIF_WAIT, gfs2_glock_holder_wait, TASK_UNINTERRUPTIBLE);
}

static void wait_on_demote(struct gfs2_glock *gl)
{
might_sleep();
wait_on_bit(&gl->gl_flags, GLF_DEMOTE, just_schedule, TASK_UNINTERRUPTIBLE);
wait_on_bit(&gl->gl_flags, GLF_DEMOTE, gfs2_glock_demote_wait, TASK_UNINTERRUPTIBLE);
}

/**
Expand Down
20 changes: 1 addition & 19 deletions fs/gfs2/glops.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,24 +309,6 @@ static void rgrp_go_unlock(struct gfs2_holder *gh)
gfs2_rgrp_bh_put(gh->gh_gl->gl_object);
}

/**
* rgrp_go_dump - print out an rgrp
* @seq: The iterator
* @gl: The glock in question
*
*/

static int rgrp_go_dump(struct seq_file *seq, const struct gfs2_glock *gl)
{
const struct gfs2_rgrpd *rgd = gl->gl_object;
if (rgd == NULL)
return 0;
gfs2_print_dbg(seq, " R: n:%llu f:%02x b:%u/%u i:%u\n",
(unsigned long long)rgd->rd_addr, rgd->rd_flags,
rgd->rd_free, rgd->rd_free_clone, rgd->rd_dinodes);
return 0;
}

/**
* trans_go_sync - promote/demote the transaction glock
* @gl: the glock
Expand Down Expand Up @@ -410,7 +392,7 @@ const struct gfs2_glock_operations gfs2_rgrp_glops = {
.go_demote_ok = rgrp_go_demote_ok,
.go_lock = rgrp_go_lock,
.go_unlock = rgrp_go_unlock,
.go_dump = rgrp_go_dump,
.go_dump = gfs2_rgrp_dump,
.go_type = LM_TYPE_RGRP,
.go_min_hold_time = HZ / 5,
};
Expand Down
Loading

0 comments on commit 0a33f80

Please sign in to comment.