You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw
* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw: (27 commits) GFS2: Use DEFINE_SPINLOCK GFS2: Fix use-after-free bug on umount (try #2) Revert "GFS2: Fix use-after-free bug on umount" GFS2: Streamline alloc calculations for writes GFS2: Send useful information with uevent messages GFS2: Fix use-after-free bug on umount GFS2: Remove ancient, unused code GFS2: Move four functions from super.c GFS2: Fix bug in gfs2_lock_fs_check_clean() GFS2: Send some sensible sysfs stuff GFS2: Kill two daemons with one patch GFS2: Move gfs2_recoverd into recovery.c GFS2: Fix "truncate in progress" hang GFS2: Clean up & move gfs2_quotad GFS2: Add more detail to debugfs glock dumps GFS2: Banish struct gfs2_rgrpd_host GFS2: Move rg_free from gfs2_rgrpd_host to gfs2_rgrpd GFS2: Move rg_igeneration into struct gfs2_rgrpd GFS2: Banish struct gfs2_dinode_host GFS2: Move i_size from gfs2_dinode_host and rename it to i_disksize ...
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
||||
obj-$(CONFIG_GFS2_FS) += gfs2.o
|
||||
gfs2-y := acl.o bmap.o daemon.o dir.o eaops.o eattr.o glock.o \
|
||||
gfs2-y := acl.o bmap.o dir.o eaops.o eattr.o glock.o \
|
||||
glops.o inode.o log.o lops.o locking.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 \
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ static int acl_get(struct gfs2_inode *ip, int access, struct posix_acl **acl,
|
||||
struct gfs2_ea_location el_this;
|
||||
int error;
|
||||
|
||||
if (!ip->i_di.di_eattr)
|
||||
if (!ip->i_eattr)
|
||||
return 0;
|
||||
|
||||
memset(&er, 0, sizeof(struct gfs2_ea_request));
|
||||
|
||||
+21
-56
@@ -75,9 +75,9 @@ static int gfs2_unstuffer_page(struct gfs2_inode *ip, struct buffer_head *dibh,
|
||||
void *kaddr = kmap(page);
|
||||
|
||||
memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode),
|
||||
ip->i_di.di_size);
|
||||
memset(kaddr + ip->i_di.di_size, 0,
|
||||
PAGE_CACHE_SIZE - ip->i_di.di_size);
|
||||
ip->i_disksize);
|
||||
memset(kaddr + ip->i_disksize, 0,
|
||||
PAGE_CACHE_SIZE - ip->i_disksize);
|
||||
kunmap(page);
|
||||
|
||||
SetPageUptodate(page);
|
||||
@@ -132,7 +132,7 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page)
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
if (ip->i_di.di_size) {
|
||||
if (ip->i_disksize) {
|
||||
/* Get a free block, fill it with the stuffed data,
|
||||
and write it out to disk */
|
||||
|
||||
@@ -159,7 +159,7 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page)
|
||||
di = (struct gfs2_dinode *)dibh->b_data;
|
||||
gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));
|
||||
|
||||
if (ip->i_di.di_size) {
|
||||
if (ip->i_disksize) {
|
||||
*(__be64 *)(di + 1) = cpu_to_be64(block);
|
||||
gfs2_add_inode_blocks(&ip->i_inode, 1);
|
||||
di->di_blocks = cpu_to_be64(gfs2_get_inode_blocks(&ip->i_inode));
|
||||
@@ -926,7 +926,7 @@ static int do_grow(struct gfs2_inode *ip, u64 size)
|
||||
}
|
||||
}
|
||||
|
||||
ip->i_di.di_size = size;
|
||||
ip->i_disksize = size;
|
||||
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);
|
||||
@@ -1033,7 +1033,7 @@ static int trunc_start(struct gfs2_inode *ip, u64 size)
|
||||
goto out;
|
||||
|
||||
if (gfs2_is_stuffed(ip)) {
|
||||
ip->i_di.di_size = size;
|
||||
ip->i_disksize = size;
|
||||
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);
|
||||
@@ -1045,9 +1045,9 @@ static int trunc_start(struct gfs2_inode *ip, u64 size)
|
||||
error = gfs2_block_truncate_page(ip->i_inode.i_mapping);
|
||||
|
||||
if (!error) {
|
||||
ip->i_di.di_size = size;
|
||||
ip->i_disksize = size;
|
||||
ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
|
||||
ip->i_di.di_flags |= GFS2_DIF_TRUNC_IN_PROG;
|
||||
ip->i_diskflags |= GFS2_DIF_TRUNC_IN_PROG;
|
||||
gfs2_trans_add_bh(ip->i_gl, dibh, 1);
|
||||
gfs2_dinode_out(ip, dibh->b_data);
|
||||
}
|
||||
@@ -1114,13 +1114,13 @@ static int trunc_end(struct gfs2_inode *ip)
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
if (!ip->i_di.di_size) {
|
||||
if (!ip->i_disksize) {
|
||||
ip->i_height = 0;
|
||||
ip->i_goal = ip->i_no_addr;
|
||||
gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));
|
||||
}
|
||||
ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
|
||||
ip->i_di.di_flags &= ~GFS2_DIF_TRUNC_IN_PROG;
|
||||
ip->i_diskflags &= ~GFS2_DIF_TRUNC_IN_PROG;
|
||||
|
||||
gfs2_trans_add_bh(ip->i_gl, dibh, 1);
|
||||
gfs2_dinode_out(ip, dibh->b_data);
|
||||
@@ -1205,9 +1205,9 @@ int gfs2_truncatei(struct gfs2_inode *ip, u64 size)
|
||||
if (gfs2_assert_warn(GFS2_SB(&ip->i_inode), S_ISREG(ip->i_inode.i_mode)))
|
||||
return -EINVAL;
|
||||
|
||||
if (size > ip->i_di.di_size)
|
||||
if (size > ip->i_disksize)
|
||||
error = do_grow(ip, size);
|
||||
else if (size < ip->i_di.di_size)
|
||||
else if (size < ip->i_disksize)
|
||||
error = do_shrink(ip, size);
|
||||
else
|
||||
/* update time stamps */
|
||||
@@ -1219,7 +1219,7 @@ int gfs2_truncatei(struct gfs2_inode *ip, u64 size)
|
||||
int gfs2_truncatei_resume(struct gfs2_inode *ip)
|
||||
{
|
||||
int error;
|
||||
error = trunc_dealloc(ip, ip->i_di.di_size);
|
||||
error = trunc_dealloc(ip, ip->i_disksize);
|
||||
if (!error)
|
||||
error = trunc_end(ip);
|
||||
return error;
|
||||
@@ -1230,35 +1230,6 @@ int gfs2_file_dealloc(struct gfs2_inode *ip)
|
||||
return trunc_dealloc(ip, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* gfs2_write_calc_reserv - calculate number of blocks needed to write to a file
|
||||
* @ip: the file
|
||||
* @len: the number of bytes to be written to the file
|
||||
* @data_blocks: returns the number of data blocks required
|
||||
* @ind_blocks: returns the number of indirect blocks required
|
||||
*
|
||||
*/
|
||||
|
||||
void gfs2_write_calc_reserv(struct gfs2_inode *ip, unsigned int len,
|
||||
unsigned int *data_blocks, unsigned int *ind_blocks)
|
||||
{
|
||||
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
|
||||
unsigned int tmp;
|
||||
|
||||
if (gfs2_is_dir(ip)) {
|
||||
*data_blocks = DIV_ROUND_UP(len, sdp->sd_jbsize) + 2;
|
||||
*ind_blocks = 3 * (sdp->sd_max_jheight - 1);
|
||||
} else {
|
||||
*data_blocks = (len >> sdp->sd_sb.sb_bsize_shift) + 3;
|
||||
*ind_blocks = 3 * (sdp->sd_max_height - 1);
|
||||
}
|
||||
|
||||
for (tmp = *data_blocks; tmp > sdp->sd_diptrs;) {
|
||||
tmp = DIV_ROUND_UP(tmp, sdp->sd_inptrs);
|
||||
*ind_blocks += tmp;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gfs2_write_alloc_required - figure out if a write will require an allocation
|
||||
* @ip: the file being written to
|
||||
@@ -1276,6 +1247,7 @@ int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset,
|
||||
struct buffer_head bh;
|
||||
unsigned int shift;
|
||||
u64 lblock, lblock_stop, size;
|
||||
u64 end_of_file;
|
||||
|
||||
*alloc_required = 0;
|
||||
|
||||
@@ -1291,19 +1263,12 @@ int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset,
|
||||
|
||||
*alloc_required = 1;
|
||||
shift = sdp->sd_sb.sb_bsize_shift;
|
||||
if (gfs2_is_dir(ip)) {
|
||||
unsigned int bsize = sdp->sd_jbsize;
|
||||
lblock = offset;
|
||||
do_div(lblock, bsize);
|
||||
lblock_stop = offset + len + bsize - 1;
|
||||
do_div(lblock_stop, bsize);
|
||||
} else {
|
||||
u64 end_of_file = (ip->i_di.di_size + sdp->sd_sb.sb_bsize - 1) >> shift;
|
||||
lblock = offset >> shift;
|
||||
lblock_stop = (offset + len + sdp->sd_sb.sb_bsize - 1) >> shift;
|
||||
if (lblock_stop > end_of_file)
|
||||
return 0;
|
||||
}
|
||||
BUG_ON(gfs2_is_dir(ip));
|
||||
end_of_file = (ip->i_disksize + sdp->sd_sb.sb_bsize - 1) >> shift;
|
||||
lblock = offset >> shift;
|
||||
lblock_stop = (offset + len + sdp->sd_sb.sb_bsize - 1) >> shift;
|
||||
if (lblock_stop > end_of_file)
|
||||
return 0;
|
||||
|
||||
size = (lblock_stop - lblock) << shift;
|
||||
do {
|
||||
|
||||
+30
-4
@@ -10,10 +10,40 @@
|
||||
#ifndef __BMAP_DOT_H__
|
||||
#define __BMAP_DOT_H__
|
||||
|
||||
#include "inode.h"
|
||||
|
||||
struct inode;
|
||||
struct gfs2_inode;
|
||||
struct page;
|
||||
|
||||
|
||||
/**
|
||||
* gfs2_write_calc_reserv - calculate number of blocks needed to write to a file
|
||||
* @ip: the file
|
||||
* @len: the number of bytes to be written to the file
|
||||
* @data_blocks: returns the number of data blocks required
|
||||
* @ind_blocks: returns the number of indirect blocks required
|
||||
*
|
||||
*/
|
||||
|
||||
static inline void gfs2_write_calc_reserv(const struct gfs2_inode *ip,
|
||||
unsigned int len,
|
||||
unsigned int *data_blocks,
|
||||
unsigned int *ind_blocks)
|
||||
{
|
||||
const struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
|
||||
unsigned int tmp;
|
||||
|
||||
BUG_ON(gfs2_is_dir(ip));
|
||||
*data_blocks = (len >> sdp->sd_sb.sb_bsize_shift) + 3;
|
||||
*ind_blocks = 3 * (sdp->sd_max_height - 1);
|
||||
|
||||
for (tmp = *data_blocks; tmp > sdp->sd_diptrs;) {
|
||||
tmp = DIV_ROUND_UP(tmp, sdp->sd_inptrs);
|
||||
*ind_blocks += tmp;
|
||||
}
|
||||
}
|
||||
|
||||
int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page);
|
||||
int gfs2_block_map(struct inode *inode, sector_t lblock, struct buffer_head *bh, int create);
|
||||
int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsigned *extlen);
|
||||
@@ -21,10 +51,6 @@ int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsi
|
||||
int gfs2_truncatei(struct gfs2_inode *ip, u64 size);
|
||||
int gfs2_truncatei_resume(struct gfs2_inode *ip);
|
||||
int gfs2_file_dealloc(struct gfs2_inode *ip);
|
||||
|
||||
void gfs2_write_calc_reserv(struct gfs2_inode *ip, unsigned int len,
|
||||
unsigned int *data_blocks,
|
||||
unsigned int *ind_blocks);
|
||||
int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset,
|
||||
unsigned int len, int *alloc_required);
|
||||
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
|
||||
* Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use,
|
||||
* modify, copy, or redistribute it subject to the terms and conditions
|
||||
* of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#include <linux/sched.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/completion.h>
|
||||
#include <linux/buffer_head.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/gfs2_ondisk.h>
|
||||
#include <linux/lm_interface.h>
|
||||
#include <linux/freezer.h>
|
||||
|
||||
#include "gfs2.h"
|
||||
#include "incore.h"
|
||||
#include "daemon.h"
|
||||
#include "glock.h"
|
||||
#include "log.h"
|
||||
#include "quota.h"
|
||||
#include "recovery.h"
|
||||
#include "super.h"
|
||||
#include "util.h"
|
||||
|
||||
/* This uses schedule_timeout() instead of msleep() because it's good for
|
||||
the daemons to wake up more often than the timeout when unmounting so
|
||||
the user's unmount doesn't sit there forever.
|
||||
|
||||
The kthread functions used to start these daemons block and flush signals. */
|
||||
|
||||
/**
|
||||
* gfs2_glockd - Reclaim unused glock structures
|
||||
* @sdp: Pointer to GFS2 superblock
|
||||
*
|
||||
* One or more of these daemons run, reclaiming glocks on sd_reclaim_list.
|
||||
* Number of daemons can be set by user, with num_glockd mount option.
|
||||
*/
|
||||
|
||||
int gfs2_glockd(void *data)
|
||||
{
|
||||
struct gfs2_sbd *sdp = data;
|
||||
|
||||
while (!kthread_should_stop()) {
|
||||
while (atomic_read(&sdp->sd_reclaim_count))
|
||||
gfs2_reclaim_glock(sdp);
|
||||
|
||||
wait_event_interruptible(sdp->sd_reclaim_wq,
|
||||
(atomic_read(&sdp->sd_reclaim_count) ||
|
||||
kthread_should_stop()));
|
||||
if (freezing(current))
|
||||
refrigerator();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* gfs2_recoverd - Recover dead machine's journals
|
||||
* @sdp: Pointer to GFS2 superblock
|
||||
*
|
||||
*/
|
||||
|
||||
int gfs2_recoverd(void *data)
|
||||
{
|
||||
struct gfs2_sbd *sdp = data;
|
||||
unsigned long t;
|
||||
|
||||
while (!kthread_should_stop()) {
|
||||
gfs2_check_journals(sdp);
|
||||
t = gfs2_tune_get(sdp, gt_recoverd_secs) * HZ;
|
||||
if (freezing(current))
|
||||
refrigerator();
|
||||
schedule_timeout_interruptible(t);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* gfs2_quotad - Write cached quota changes into the quota file
|
||||
* @sdp: Pointer to GFS2 superblock
|
||||
*
|
||||
*/
|
||||
|
||||
int gfs2_quotad(void *data)
|
||||
{
|
||||
struct gfs2_sbd *sdp = data;
|
||||
unsigned long t;
|
||||
int error;
|
||||
|
||||
while (!kthread_should_stop()) {
|
||||
/* Update the master statfs file */
|
||||
|
||||
t = sdp->sd_statfs_sync_time +
|
||||
gfs2_tune_get(sdp, gt_statfs_quantum) * HZ;
|
||||
|
||||
if (time_after_eq(jiffies, t)) {
|
||||
error = gfs2_statfs_sync(sdp);
|
||||
if (error &&
|
||||
error != -EROFS &&
|
||||
!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))
|
||||
fs_err(sdp, "quotad: (1) error=%d\n", error);
|
||||
sdp->sd_statfs_sync_time = jiffies;
|
||||
}
|
||||
|
||||
/* Update quota file */
|
||||
|
||||
t = sdp->sd_quota_sync_time +
|
||||
gfs2_tune_get(sdp, gt_quota_quantum) * HZ;
|
||||
|
||||
if (time_after_eq(jiffies, t)) {
|
||||
error = gfs2_quota_sync(sdp);
|
||||
if (error &&
|
||||
error != -EROFS &&
|
||||
!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))
|
||||
fs_err(sdp, "quotad: (2) error=%d\n", error);
|
||||
sdp->sd_quota_sync_time = jiffies;
|
||||
}
|
||||
|
||||
gfs2_quota_scan(sdp);
|
||||
|
||||
t = gfs2_tune_get(sdp, gt_quotad_secs) * HZ;
|
||||
if (freezing(current))
|
||||
refrigerator();
|
||||
schedule_timeout_interruptible(t);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
|
||||
* Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use,
|
||||
* modify, copy, or redistribute it subject to the terms and conditions
|
||||
* of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef __DAEMON_DOT_H__
|
||||
#define __DAEMON_DOT_H__
|
||||
|
||||
int gfs2_glockd(void *data);
|
||||
int gfs2_recoverd(void *data);
|
||||
int gfs2_quotad(void *data);
|
||||
|
||||
#endif /* __DAEMON_DOT_H__ */
|
||||
+31
-31
@@ -36,7 +36,7 @@
|
||||
* the block. In leaves, they begin at offset sizeof(struct gfs2_leaf) from the
|
||||
* beginning of the leaf block. The dirents reside in leaves when
|
||||
*
|
||||
* dip->i_di.di_flags & GFS2_DIF_EXHASH is true
|
||||
* dip->i_diskflags & GFS2_DIF_EXHASH is true
|
||||
*
|
||||
* Otherwise, the dirents are "linear", within a single stuffed dinode block.
|
||||
*
|
||||
@@ -128,8 +128,8 @@ static int gfs2_dir_write_stuffed(struct gfs2_inode *ip, const char *buf,
|
||||
|
||||
gfs2_trans_add_bh(ip->i_gl, dibh, 1);
|
||||
memcpy(dibh->b_data + offset + sizeof(struct gfs2_dinode), buf, size);
|
||||
if (ip->i_di.di_size < offset + size)
|
||||
ip->i_di.di_size = offset + size;
|
||||
if (ip->i_disksize < offset + size)
|
||||
ip->i_disksize = offset + size;
|
||||
ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
|
||||
gfs2_dinode_out(ip, dibh->b_data);
|
||||
|
||||
@@ -226,8 +226,8 @@ out:
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (ip->i_di.di_size < offset + copied)
|
||||
ip->i_di.di_size = offset + copied;
|
||||
if (ip->i_disksize < offset + copied)
|
||||
ip->i_disksize = offset + copied;
|
||||
ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
|
||||
|
||||
gfs2_trans_add_bh(ip->i_gl, dibh, 1);
|
||||
@@ -277,11 +277,11 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, char *buf, u64 offset,
|
||||
int copied = 0;
|
||||
int error = 0;
|
||||
|
||||
if (offset >= ip->i_di.di_size)
|
||||
if (offset >= ip->i_disksize)
|
||||
return 0;
|
||||
|
||||
if (offset + size > ip->i_di.di_size)
|
||||
size = ip->i_di.di_size - offset;
|
||||
if (offset + size > ip->i_disksize)
|
||||
size = ip->i_disksize - offset;
|
||||
|
||||
if (!size)
|
||||
return 0;
|
||||
@@ -755,12 +755,12 @@ static struct gfs2_dirent *gfs2_dirent_search(struct inode *inode,
|
||||
struct gfs2_inode *ip = GFS2_I(inode);
|
||||
int error;
|
||||
|
||||
if (ip->i_di.di_flags & GFS2_DIF_EXHASH) {
|
||||
if (ip->i_diskflags & GFS2_DIF_EXHASH) {
|
||||
struct gfs2_leaf *leaf;
|
||||
unsigned hsize = 1 << ip->i_depth;
|
||||
unsigned index;
|
||||
u64 ln;
|
||||
if (hsize * sizeof(u64) != ip->i_di.di_size) {
|
||||
if (hsize * sizeof(u64) != ip->i_disksize) {
|
||||
gfs2_consist_inode(ip);
|
||||
return ERR_PTR(-EIO);
|
||||
}
|
||||
@@ -858,8 +858,8 @@ static int dir_make_exhash(struct inode *inode)
|
||||
return -ENOSPC;
|
||||
bn = bh->b_blocknr;
|
||||
|
||||
gfs2_assert(sdp, dip->i_di.di_entries < (1 << 16));
|
||||
leaf->lf_entries = cpu_to_be16(dip->i_di.di_entries);
|
||||
gfs2_assert(sdp, dip->i_entries < (1 << 16));
|
||||
leaf->lf_entries = cpu_to_be16(dip->i_entries);
|
||||
|
||||
/* Copy dirents */
|
||||
|
||||
@@ -905,9 +905,9 @@ static int dir_make_exhash(struct inode *inode)
|
||||
for (x = sdp->sd_hash_ptrs; x--; lp++)
|
||||
*lp = cpu_to_be64(bn);
|
||||
|
||||
dip->i_di.di_size = sdp->sd_sb.sb_bsize / 2;
|
||||
dip->i_disksize = sdp->sd_sb.sb_bsize / 2;
|
||||
gfs2_add_inode_blocks(&dip->i_inode, 1);
|
||||
dip->i_di.di_flags |= GFS2_DIF_EXHASH;
|
||||
dip->i_diskflags |= GFS2_DIF_EXHASH;
|
||||
|
||||
for (x = sdp->sd_hash_ptrs, y = -1; x; x >>= 1, y++) ;
|
||||
dip->i_depth = y;
|
||||
@@ -1082,7 +1082,7 @@ static int dir_double_exhash(struct gfs2_inode *dip)
|
||||
int error = 0;
|
||||
|
||||
hsize = 1 << dip->i_depth;
|
||||
if (hsize * sizeof(u64) != dip->i_di.di_size) {
|
||||
if (hsize * sizeof(u64) != dip->i_disksize) {
|
||||
gfs2_consist_inode(dip);
|
||||
return -EIO;
|
||||
}
|
||||
@@ -1091,7 +1091,7 @@ static int dir_double_exhash(struct gfs2_inode *dip)
|
||||
|
||||
buf = kcalloc(3, sdp->sd_hash_bsize, GFP_NOFS | __GFP_NOFAIL);
|
||||
|
||||
for (block = dip->i_di.di_size >> sdp->sd_hash_bsize_shift; block--;) {
|
||||
for (block = dip->i_disksize >> sdp->sd_hash_bsize_shift; block--;) {
|
||||
error = gfs2_dir_read_data(dip, (char *)buf,
|
||||
block * sdp->sd_hash_bsize,
|
||||
sdp->sd_hash_bsize, 1);
|
||||
@@ -1370,7 +1370,7 @@ static int dir_e_read(struct inode *inode, u64 *offset, void *opaque,
|
||||
unsigned depth = 0;
|
||||
|
||||
hsize = 1 << dip->i_depth;
|
||||
if (hsize * sizeof(u64) != dip->i_di.di_size) {
|
||||
if (hsize * sizeof(u64) != dip->i_disksize) {
|
||||
gfs2_consist_inode(dip);
|
||||
return -EIO;
|
||||
}
|
||||
@@ -1426,10 +1426,10 @@ int gfs2_dir_read(struct inode *inode, u64 *offset, void *opaque,
|
||||
int copied = 0;
|
||||
int error;
|
||||
|
||||
if (!dip->i_di.di_entries)
|
||||
if (!dip->i_entries)
|
||||
return 0;
|
||||
|
||||
if (dip->i_di.di_flags & GFS2_DIF_EXHASH)
|
||||
if (dip->i_diskflags & GFS2_DIF_EXHASH)
|
||||
return dir_e_read(inode, offset, opaque, filldir);
|
||||
|
||||
if (!gfs2_is_stuffed(dip)) {
|
||||
@@ -1453,17 +1453,17 @@ int gfs2_dir_read(struct inode *inode, u64 *offset, void *opaque,
|
||||
error = PTR_ERR(dent);
|
||||
goto out;
|
||||
}
|
||||
if (dip->i_di.di_entries != g.offset) {
|
||||
if (dip->i_entries != g.offset) {
|
||||
fs_warn(sdp, "Number of entries corrupt in dir %llu, "
|
||||
"ip->i_di.di_entries (%u) != g.offset (%u)\n",
|
||||
"ip->i_entries (%u) != g.offset (%u)\n",
|
||||
(unsigned long long)dip->i_no_addr,
|
||||
dip->i_di.di_entries,
|
||||
dip->i_entries,
|
||||
g.offset);
|
||||
error = -EIO;
|
||||
goto out;
|
||||
}
|
||||
error = do_filldir_main(dip, offset, opaque, filldir, darr,
|
||||
dip->i_di.di_entries, &copied);
|
||||
dip->i_entries, &copied);
|
||||
out:
|
||||
kfree(darr);
|
||||
}
|
||||
@@ -1612,7 +1612,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name,
|
||||
dent = gfs2_init_dirent(inode, dent, name, bh);
|
||||
gfs2_inum_out(nip, dent);
|
||||
dent->de_type = cpu_to_be16(type);
|
||||
if (ip->i_di.di_flags & GFS2_DIF_EXHASH) {
|
||||
if (ip->i_diskflags & GFS2_DIF_EXHASH) {
|
||||
leaf = (struct gfs2_leaf *)bh->b_data;
|
||||
be16_add_cpu(&leaf->lf_entries, 1);
|
||||
}
|
||||
@@ -1621,14 +1621,14 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name,
|
||||
if (error)
|
||||
break;
|
||||
gfs2_trans_add_bh(ip->i_gl, bh, 1);
|
||||
ip->i_di.di_entries++;
|
||||
ip->i_entries++;
|
||||
ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
|
||||
gfs2_dinode_out(ip, bh->b_data);
|
||||
brelse(bh);
|
||||
error = 0;
|
||||
break;
|
||||
}
|
||||
if (!(ip->i_di.di_flags & GFS2_DIF_EXHASH)) {
|
||||
if (!(ip->i_diskflags & GFS2_DIF_EXHASH)) {
|
||||
error = dir_make_exhash(inode);
|
||||
if (error)
|
||||
break;
|
||||
@@ -1691,7 +1691,7 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct qstr *name)
|
||||
}
|
||||
|
||||
dirent_del(dip, bh, prev, dent);
|
||||
if (dip->i_di.di_flags & GFS2_DIF_EXHASH) {
|
||||
if (dip->i_diskflags & GFS2_DIF_EXHASH) {
|
||||
struct gfs2_leaf *leaf = (struct gfs2_leaf *)bh->b_data;
|
||||
u16 entries = be16_to_cpu(leaf->lf_entries);
|
||||
if (!entries)
|
||||
@@ -1704,10 +1704,10 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct qstr *name)
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (!dip->i_di.di_entries)
|
||||
if (!dip->i_entries)
|
||||
gfs2_consist_inode(dip);
|
||||
gfs2_trans_add_bh(dip->i_gl, bh, 1);
|
||||
dip->i_di.di_entries--;
|
||||
dip->i_entries--;
|
||||
dip->i_inode.i_mtime = dip->i_inode.i_ctime = CURRENT_TIME;
|
||||
gfs2_dinode_out(dip, bh->b_data);
|
||||
brelse(bh);
|
||||
@@ -1748,7 +1748,7 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
|
||||
gfs2_inum_out(nip, dent);
|
||||
dent->de_type = cpu_to_be16(new_type);
|
||||
|
||||
if (dip->i_di.di_flags & GFS2_DIF_EXHASH) {
|
||||
if (dip->i_diskflags & GFS2_DIF_EXHASH) {
|
||||
brelse(bh);
|
||||
error = gfs2_meta_inode_buffer(dip, &bh);
|
||||
if (error)
|
||||
@@ -1784,7 +1784,7 @@ static int foreach_leaf(struct gfs2_inode *dip, leaf_call_t lc, void *data)
|
||||
int error = 0;
|
||||
|
||||
hsize = 1 << dip->i_depth;
|
||||
if (hsize * sizeof(u64) != dip->i_di.di_size) {
|
||||
if (hsize * sizeof(u64) != dip->i_disksize) {
|
||||
gfs2_consist_inode(dip);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#define __DIR_DOT_H__
|
||||
|
||||
#include <linux/dcache.h>
|
||||
#include <linux/crc32.h>
|
||||
|
||||
struct inode;
|
||||
struct gfs2_inode;
|
||||
|
||||
+20
-20
@@ -114,11 +114,11 @@ static int ea_foreach(struct gfs2_inode *ip, ea_call_t ea_call, void *data)
|
||||
__be64 *eablk, *end;
|
||||
int error;
|
||||
|
||||
error = gfs2_meta_read(ip->i_gl, ip->i_di.di_eattr, DIO_WAIT, &bh);
|
||||
error = gfs2_meta_read(ip->i_gl, ip->i_eattr, DIO_WAIT, &bh);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (!(ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT)) {
|
||||
if (!(ip->i_diskflags & GFS2_DIF_EA_INDIRECT)) {
|
||||
error = ea_foreach_i(ip, bh, ea_call, data);
|
||||
goto out;
|
||||
}
|
||||
@@ -414,7 +414,7 @@ int gfs2_ea_list(struct gfs2_inode *ip, struct gfs2_ea_request *er)
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (ip->i_di.di_eattr) {
|
||||
if (ip->i_eattr) {
|
||||
struct ea_list ei = { .ei_er = er, .ei_size = 0 };
|
||||
|
||||
error = ea_foreach(ip, ea_list_i, &ei);
|
||||
@@ -514,7 +514,7 @@ int gfs2_ea_get_i(struct gfs2_inode *ip, struct gfs2_ea_request *er)
|
||||
struct gfs2_ea_location el;
|
||||
int error;
|
||||
|
||||
if (!ip->i_di.di_eattr)
|
||||
if (!ip->i_eattr)
|
||||
return -ENODATA;
|
||||
|
||||
error = gfs2_ea_find(ip, er, &el);
|
||||
@@ -741,7 +741,7 @@ static int ea_init_i(struct gfs2_inode *ip, struct gfs2_ea_request *er,
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
ip->i_di.di_eattr = bh->b_blocknr;
|
||||
ip->i_eattr = bh->b_blocknr;
|
||||
error = ea_write(ip, GFS2_EA_BH2FIRST(bh), er);
|
||||
|
||||
brelse(bh);
|
||||
@@ -935,10 +935,10 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er,
|
||||
int error;
|
||||
int mh_size = sizeof(struct gfs2_meta_header);
|
||||
|
||||
if (ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT) {
|
||||
if (ip->i_diskflags & GFS2_DIF_EA_INDIRECT) {
|
||||
__be64 *end;
|
||||
|
||||
error = gfs2_meta_read(ip->i_gl, ip->i_di.di_eattr, DIO_WAIT,
|
||||
error = gfs2_meta_read(ip->i_gl, ip->i_eattr, DIO_WAIT,
|
||||
&indbh);
|
||||
if (error)
|
||||
return error;
|
||||
@@ -972,9 +972,9 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er,
|
||||
gfs2_buffer_clear_tail(indbh, mh_size);
|
||||
|
||||
eablk = (__be64 *)(indbh->b_data + mh_size);
|
||||
*eablk = cpu_to_be64(ip->i_di.di_eattr);
|
||||
ip->i_di.di_eattr = blk;
|
||||
ip->i_di.di_flags |= GFS2_DIF_EA_INDIRECT;
|
||||
*eablk = cpu_to_be64(ip->i_eattr);
|
||||
ip->i_eattr = blk;
|
||||
ip->i_diskflags |= GFS2_DIF_EA_INDIRECT;
|
||||
gfs2_add_inode_blocks(&ip->i_inode, 1);
|
||||
|
||||
eablk++;
|
||||
@@ -1015,7 +1015,7 @@ static int ea_set_i(struct gfs2_inode *ip, struct gfs2_ea_request *er,
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (!(ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT))
|
||||
if (!(ip->i_diskflags & GFS2_DIF_EA_INDIRECT))
|
||||
blks++;
|
||||
if (GFS2_EAREQ_SIZE_STUFFED(er) > GFS2_SB(&ip->i_inode)->sd_jbsize)
|
||||
blks += DIV_ROUND_UP(er->er_data_len, GFS2_SB(&ip->i_inode)->sd_jbsize);
|
||||
@@ -1040,7 +1040,7 @@ int gfs2_ea_set_i(struct gfs2_inode *ip, struct gfs2_ea_request *er)
|
||||
struct gfs2_ea_location el;
|
||||
int error;
|
||||
|
||||
if (!ip->i_di.di_eattr) {
|
||||
if (!ip->i_eattr) {
|
||||
if (er->er_flags & XATTR_REPLACE)
|
||||
return -ENODATA;
|
||||
return ea_init(ip, er);
|
||||
@@ -1051,7 +1051,7 @@ int gfs2_ea_set_i(struct gfs2_inode *ip, struct gfs2_ea_request *er)
|
||||
return error;
|
||||
|
||||
if (el.el_ea) {
|
||||
if (ip->i_di.di_flags & GFS2_DIF_APPENDONLY) {
|
||||
if (ip->i_diskflags & GFS2_DIF_APPENDONLY) {
|
||||
brelse(el.el_bh);
|
||||
return -EPERM;
|
||||
}
|
||||
@@ -1145,7 +1145,7 @@ int gfs2_ea_remove_i(struct gfs2_inode *ip, struct gfs2_ea_request *er)
|
||||
struct gfs2_ea_location el;
|
||||
int error;
|
||||
|
||||
if (!ip->i_di.di_eattr)
|
||||
if (!ip->i_eattr)
|
||||
return -ENODATA;
|
||||
|
||||
error = gfs2_ea_find(ip, er, &el);
|
||||
@@ -1309,7 +1309,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
|
||||
|
||||
memset(&rlist, 0, sizeof(struct gfs2_rgrp_list));
|
||||
|
||||
error = gfs2_meta_read(ip->i_gl, ip->i_di.di_eattr, DIO_WAIT, &indbh);
|
||||
error = gfs2_meta_read(ip->i_gl, ip->i_eattr, DIO_WAIT, &indbh);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
@@ -1388,7 +1388,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
|
||||
if (bstart)
|
||||
gfs2_free_meta(ip, bstart, blen);
|
||||
|
||||
ip->i_di.di_flags &= ~GFS2_DIF_EA_INDIRECT;
|
||||
ip->i_diskflags &= ~GFS2_DIF_EA_INDIRECT;
|
||||
|
||||
error = gfs2_meta_inode_buffer(ip, &dibh);
|
||||
if (!error) {
|
||||
@@ -1416,7 +1416,7 @@ static int ea_dealloc_block(struct gfs2_inode *ip)
|
||||
struct buffer_head *dibh;
|
||||
int error;
|
||||
|
||||
rgd = gfs2_blk2rgrpd(sdp, ip->i_di.di_eattr);
|
||||
rgd = gfs2_blk2rgrpd(sdp, ip->i_eattr);
|
||||
if (!rgd) {
|
||||
gfs2_consist_inode(ip);
|
||||
return -EIO;
|
||||
@@ -1432,9 +1432,9 @@ static int ea_dealloc_block(struct gfs2_inode *ip)
|
||||
if (error)
|
||||
goto out_gunlock;
|
||||
|
||||
gfs2_free_meta(ip, ip->i_di.di_eattr, 1);
|
||||
gfs2_free_meta(ip, ip->i_eattr, 1);
|
||||
|
||||
ip->i_di.di_eattr = 0;
|
||||
ip->i_eattr = 0;
|
||||
gfs2_add_inode_blocks(&ip->i_inode, -1);
|
||||
|
||||
error = gfs2_meta_inode_buffer(ip, &dibh);
|
||||
@@ -1479,7 +1479,7 @@ int gfs2_ea_dealloc(struct gfs2_inode *ip)
|
||||
if (error)
|
||||
goto out_rindex;
|
||||
|
||||
if (ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT) {
|
||||
if (ip->i_diskflags & GFS2_DIF_EA_INDIRECT) {
|
||||
error = ea_dealloc_indirect(ip);
|
||||
if (error)
|
||||
goto out_rindex;
|
||||
|
||||
+158
-149
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -129,9 +129,9 @@ int gfs2_lvb_hold(struct gfs2_glock *gl);
|
||||
void gfs2_lvb_unhold(struct gfs2_glock *gl);
|
||||
|
||||
void gfs2_glock_cb(void *cb_data, unsigned int type, void *data);
|
||||
void gfs2_glock_schedule_for_reclaim(struct gfs2_glock *gl);
|
||||
void gfs2_reclaim_glock(struct gfs2_sbd *sdp);
|
||||
void gfs2_gl_hash_clear(struct gfs2_sbd *sdp);
|
||||
void gfs2_glock_finish_truncate(struct gfs2_inode *ip);
|
||||
|
||||
int __init gfs2_glock_init(void);
|
||||
void gfs2_glock_exit(void);
|
||||
|
||||
+37
-19
@@ -201,19 +201,12 @@ static void inode_go_inval(struct gfs2_glock *gl, int flags)
|
||||
* Returns: 1 if it's ok
|
||||
*/
|
||||
|
||||
static int inode_go_demote_ok(struct gfs2_glock *gl)
|
||||
static int inode_go_demote_ok(const struct gfs2_glock *gl)
|
||||
{
|
||||
struct gfs2_sbd *sdp = gl->gl_sbd;
|
||||
int demote = 0;
|
||||
|
||||
if (!gl->gl_object && !gl->gl_aspace->i_mapping->nrpages)
|
||||
demote = 1;
|
||||
else if (!sdp->sd_args.ar_localcaching &&
|
||||
time_after_eq(jiffies, gl->gl_stamp +
|
||||
gfs2_tune_get(sdp, gt_demote_secs) * HZ))
|
||||
demote = 1;
|
||||
|
||||
return demote;
|
||||
if (sdp->sd_jindex == gl->gl_object || sdp->sd_rindex == gl->gl_object)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,6 +220,7 @@ static int inode_go_demote_ok(struct gfs2_glock *gl)
|
||||
static int inode_go_lock(struct gfs2_holder *gh)
|
||||
{
|
||||
struct gfs2_glock *gl = gh->gh_gl;
|
||||
struct gfs2_sbd *sdp = gl->gl_sbd;
|
||||
struct gfs2_inode *ip = gl->gl_object;
|
||||
int error = 0;
|
||||
|
||||
@@ -239,10 +233,16 @@ static int inode_go_lock(struct gfs2_holder *gh)
|
||||
return error;
|
||||
}
|
||||
|
||||
if ((ip->i_di.di_flags & GFS2_DIF_TRUNC_IN_PROG) &&
|
||||
if ((ip->i_diskflags & GFS2_DIF_TRUNC_IN_PROG) &&
|
||||
(gl->gl_state == LM_ST_EXCLUSIVE) &&
|
||||
(gh->gh_state == LM_ST_EXCLUSIVE))
|
||||
error = gfs2_truncatei_resume(ip);
|
||||
(gh->gh_state == LM_ST_EXCLUSIVE)) {
|
||||
spin_lock(&sdp->sd_trunc_lock);
|
||||
if (list_empty(&ip->i_trunc_list))
|
||||
list_add(&sdp->sd_trunc_list, &ip->i_trunc_list);
|
||||
spin_unlock(&sdp->sd_trunc_lock);
|
||||
wake_up(&sdp->sd_quota_wait);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
@@ -260,10 +260,13 @@ static int inode_go_dump(struct seq_file *seq, const struct gfs2_glock *gl)
|
||||
const struct gfs2_inode *ip = gl->gl_object;
|
||||
if (ip == NULL)
|
||||
return 0;
|
||||
gfs2_print_dbg(seq, " I: n:%llu/%llu t:%u f:0x%08lx\n",
|
||||
gfs2_print_dbg(seq, " I: n:%llu/%llu t:%u f:0x%02lx d:0x%08x s:%llu/%llu\n",
|
||||
(unsigned long long)ip->i_no_formal_ino,
|
||||
(unsigned long long)ip->i_no_addr,
|
||||
IF2DT(ip->i_inode.i_mode), ip->i_flags);
|
||||
IF2DT(ip->i_inode.i_mode), ip->i_flags,
|
||||
(unsigned int)ip->i_diskflags,
|
||||
(unsigned long long)ip->i_inode.i_size,
|
||||
(unsigned long long)ip->i_disksize);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -274,7 +277,7 @@ static int inode_go_dump(struct seq_file *seq, const struct gfs2_glock *gl)
|
||||
* Returns: 1 if it's ok
|
||||
*/
|
||||
|
||||
static int rgrp_go_demote_ok(struct gfs2_glock *gl)
|
||||
static int rgrp_go_demote_ok(const struct gfs2_glock *gl)
|
||||
{
|
||||
return !gl->gl_aspace->i_mapping->nrpages;
|
||||
}
|
||||
@@ -318,7 +321,9 @@ 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\n", (unsigned long long)rgd->rd_addr);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -373,6 +378,18 @@ static int trans_go_xmote_bh(struct gfs2_glock *gl, struct gfs2_holder *gh)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* trans_go_demote_ok
|
||||
* @gl: the glock
|
||||
*
|
||||
* Always returns 0
|
||||
*/
|
||||
|
||||
static int trans_go_demote_ok(const struct gfs2_glock *gl)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* quota_go_demote_ok - Check to see if it's ok to unlock a quota glock
|
||||
* @gl: the glock
|
||||
@@ -380,7 +397,7 @@ static int trans_go_xmote_bh(struct gfs2_glock *gl, struct gfs2_holder *gh)
|
||||
* Returns: 1 if it's ok
|
||||
*/
|
||||
|
||||
static int quota_go_demote_ok(struct gfs2_glock *gl)
|
||||
static int quota_go_demote_ok(const struct gfs2_glock *gl)
|
||||
{
|
||||
return !atomic_read(&gl->gl_lvb_count);
|
||||
}
|
||||
@@ -414,6 +431,7 @@ const struct gfs2_glock_operations gfs2_rgrp_glops = {
|
||||
const struct gfs2_glock_operations gfs2_trans_glops = {
|
||||
.go_xmote_th = trans_go_sync,
|
||||
.go_xmote_bh = trans_go_xmote_bh,
|
||||
.go_demote_ok = trans_go_demote_ok,
|
||||
.go_type = LM_TYPE_NONDISK,
|
||||
};
|
||||
|
||||
|
||||
+18
-39
@@ -68,12 +68,6 @@ struct gfs2_bitmap {
|
||||
u32 bi_len;
|
||||
};
|
||||
|
||||
struct gfs2_rgrp_host {
|
||||
u32 rg_free;
|
||||
u32 rg_dinodes;
|
||||
u64 rg_igeneration;
|
||||
};
|
||||
|
||||
struct gfs2_rgrpd {
|
||||
struct list_head rd_list; /* Link with superblock */
|
||||
struct list_head rd_list_mru;
|
||||
@@ -83,14 +77,16 @@ struct gfs2_rgrpd {
|
||||
u32 rd_length; /* length of rgrp header in fs blocks */
|
||||
u32 rd_data; /* num of data blocks in rgrp */
|
||||
u32 rd_bitbytes; /* number of bytes in data bitmaps */
|
||||
struct gfs2_rgrp_host rd_rg;
|
||||
struct gfs2_bitmap *rd_bits;
|
||||
unsigned int rd_bh_count;
|
||||
struct mutex rd_mutex;
|
||||
u32 rd_free;
|
||||
u32 rd_free_clone;
|
||||
u32 rd_dinodes;
|
||||
u64 rd_igeneration;
|
||||
struct gfs2_bitmap *rd_bits;
|
||||
struct mutex rd_mutex;
|
||||
struct gfs2_log_element rd_le;
|
||||
u32 rd_last_alloc;
|
||||
struct gfs2_sbd *rd_sbd;
|
||||
unsigned int rd_bh_count;
|
||||
u32 rd_last_alloc;
|
||||
unsigned char rd_flags;
|
||||
#define GFS2_RDF_CHECK 0x01 /* Need to check for unlinked inodes */
|
||||
#define GFS2_RDF_NOALLOC 0x02 /* rg prohibits allocation */
|
||||
@@ -129,7 +125,7 @@ struct gfs2_glock_operations {
|
||||
void (*go_xmote_th) (struct gfs2_glock *gl);
|
||||
int (*go_xmote_bh) (struct gfs2_glock *gl, struct gfs2_holder *gh);
|
||||
void (*go_inval) (struct gfs2_glock *gl, int flags);
|
||||
int (*go_demote_ok) (struct gfs2_glock *gl);
|
||||
int (*go_demote_ok) (const struct gfs2_glock *gl);
|
||||
int (*go_lock) (struct gfs2_holder *gh);
|
||||
void (*go_unlock) (struct gfs2_holder *gh);
|
||||
int (*go_dump)(struct seq_file *seq, const struct gfs2_glock *gl);
|
||||
@@ -159,7 +155,6 @@ struct gfs2_holder {
|
||||
|
||||
enum {
|
||||
GLF_LOCK = 1,
|
||||
GLF_STICKY = 2,
|
||||
GLF_DEMOTE = 3,
|
||||
GLF_PENDING_DEMOTE = 4,
|
||||
GLF_DEMOTE_IN_PROGRESS = 5,
|
||||
@@ -194,7 +189,7 @@ struct gfs2_glock {
|
||||
unsigned long gl_tchange;
|
||||
void *gl_object;
|
||||
|
||||
struct list_head gl_reclaim;
|
||||
struct list_head gl_lru;
|
||||
|
||||
struct gfs2_sbd *gl_sbd;
|
||||
|
||||
@@ -233,29 +228,24 @@ enum {
|
||||
GIF_USER = 4, /* user inode, not metadata addr space */
|
||||
};
|
||||
|
||||
struct gfs2_dinode_host {
|
||||
u64 di_size; /* number of bytes in file */
|
||||
u64 di_generation; /* generation number for NFS */
|
||||
u32 di_flags; /* GFS2_DIF_... */
|
||||
/* These only apply to directories */
|
||||
u32 di_entries; /* The number of entries in the directory */
|
||||
u64 di_eattr; /* extended attribute block number */
|
||||
};
|
||||
|
||||
struct gfs2_inode {
|
||||
struct inode i_inode;
|
||||
u64 i_no_addr;
|
||||
u64 i_no_formal_ino;
|
||||
u64 i_generation;
|
||||
u64 i_eattr;
|
||||
loff_t i_disksize;
|
||||
unsigned long i_flags; /* GIF_... */
|
||||
|
||||
struct gfs2_dinode_host i_di; /* To be replaced by ref to block */
|
||||
|
||||
struct gfs2_glock *i_gl; /* Move into i_gh? */
|
||||
struct gfs2_holder i_iopen_gh;
|
||||
struct gfs2_holder i_gh; /* for prepare/commit_write only */
|
||||
struct gfs2_alloc *i_alloc;
|
||||
u64 i_goal; /* goal block for allocations */
|
||||
struct rw_semaphore i_rw_mutex;
|
||||
struct list_head i_trunc_list;
|
||||
u32 i_entries;
|
||||
u32 i_diskflags;
|
||||
u8 i_height;
|
||||
u8 i_depth;
|
||||
};
|
||||
@@ -406,13 +396,11 @@ struct gfs2_args {
|
||||
struct gfs2_tune {
|
||||
spinlock_t gt_spin;
|
||||
|
||||
unsigned int gt_demote_secs; /* Cache retention for unheld glock */
|
||||
unsigned int gt_incore_log_blocks;
|
||||
unsigned int gt_log_flush_secs;
|
||||
|
||||
unsigned int gt_recoverd_secs;
|
||||
unsigned int gt_logd_secs;
|
||||
unsigned int gt_quotad_secs;
|
||||
|
||||
unsigned int gt_quota_simul_sync; /* Max quotavals to sync at once */
|
||||
unsigned int gt_quota_warn_period; /* Secs between quota warn msgs */
|
||||
@@ -488,10 +476,6 @@ struct gfs2_sbd {
|
||||
/* Lock Stuff */
|
||||
|
||||
struct lm_lockstruct sd_lockstruct;
|
||||
struct list_head sd_reclaim_list;
|
||||
spinlock_t sd_reclaim_lock;
|
||||
wait_queue_head_t sd_reclaim_wq;
|
||||
atomic_t sd_reclaim_count;
|
||||
struct gfs2_holder sd_live_gh;
|
||||
struct gfs2_glock *sd_rename_gl;
|
||||
struct gfs2_glock *sd_trans_gl;
|
||||
@@ -519,7 +503,6 @@ struct gfs2_sbd {
|
||||
spinlock_t sd_statfs_spin;
|
||||
struct gfs2_statfs_change_host sd_statfs_master;
|
||||
struct gfs2_statfs_change_host sd_statfs_local;
|
||||
unsigned long sd_statfs_sync_time;
|
||||
|
||||
/* Resource group stuff */
|
||||
|
||||
@@ -552,8 +535,6 @@ struct gfs2_sbd {
|
||||
struct task_struct *sd_recoverd_process;
|
||||
struct task_struct *sd_logd_process;
|
||||
struct task_struct *sd_quotad_process;
|
||||
struct task_struct *sd_glockd_process[GFS2_GLOCKD_MAX];
|
||||
unsigned int sd_glockd_num;
|
||||
|
||||
/* Quota stuff */
|
||||
|
||||
@@ -561,13 +542,15 @@ struct gfs2_sbd {
|
||||
atomic_t sd_quota_count;
|
||||
spinlock_t sd_quota_spin;
|
||||
struct mutex sd_quota_mutex;
|
||||
wait_queue_head_t sd_quota_wait;
|
||||
struct list_head sd_trunc_list;
|
||||
spinlock_t sd_trunc_lock;
|
||||
|
||||
unsigned int sd_quota_slots;
|
||||
unsigned int sd_quota_chunks;
|
||||
unsigned char **sd_quota_bitmap;
|
||||
|
||||
u64 sd_quota_sync_gen;
|
||||
unsigned long sd_quota_sync_time;
|
||||
|
||||
/* Log stuff */
|
||||
|
||||
@@ -624,10 +607,6 @@ struct gfs2_sbd {
|
||||
struct mutex sd_freeze_lock;
|
||||
unsigned int sd_freeze_count;
|
||||
|
||||
/* Counters */
|
||||
|
||||
atomic_t sd_reclaimed;
|
||||
|
||||
char sd_fsname[GFS2_FSNAME_LEN];
|
||||
char sd_table_name[GFS2_FSNAME_LEN];
|
||||
char sd_proto_name[GFS2_FSNAME_LEN];
|
||||
|
||||
+24
-29
@@ -32,7 +32,6 @@
|
||||
#include "log.h"
|
||||
#include "meta_io.h"
|
||||
#include "ops_address.h"
|
||||
#include "ops_inode.h"
|
||||
#include "quota.h"
|
||||
#include "rgrp.h"
|
||||
#include "trans.h"
|
||||
@@ -248,7 +247,6 @@ fail:
|
||||
|
||||
static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
|
||||
{
|
||||
struct gfs2_dinode_host *di = &ip->i_di;
|
||||
const struct gfs2_dinode *str = buf;
|
||||
struct timespec atime;
|
||||
u16 height, depth;
|
||||
@@ -274,8 +272,8 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
|
||||
* to do that.
|
||||
*/
|
||||
ip->i_inode.i_nlink = be32_to_cpu(str->di_nlink);
|
||||
di->di_size = be64_to_cpu(str->di_size);
|
||||
i_size_write(&ip->i_inode, di->di_size);
|
||||
ip->i_disksize = be64_to_cpu(str->di_size);
|
||||
i_size_write(&ip->i_inode, ip->i_disksize);
|
||||
gfs2_set_inode_blocks(&ip->i_inode, be64_to_cpu(str->di_blocks));
|
||||
atime.tv_sec = be64_to_cpu(str->di_atime);
|
||||
atime.tv_nsec = be32_to_cpu(str->di_atime_nsec);
|
||||
@@ -287,9 +285,9 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
|
||||
ip->i_inode.i_ctime.tv_nsec = be32_to_cpu(str->di_ctime_nsec);
|
||||
|
||||
ip->i_goal = be64_to_cpu(str->di_goal_meta);
|
||||
di->di_generation = be64_to_cpu(str->di_generation);
|
||||
ip->i_generation = be64_to_cpu(str->di_generation);
|
||||
|
||||
di->di_flags = be32_to_cpu(str->di_flags);
|
||||
ip->i_diskflags = be32_to_cpu(str->di_flags);
|
||||
gfs2_set_inode_flags(&ip->i_inode);
|
||||
height = be16_to_cpu(str->di_height);
|
||||
if (unlikely(height > GFS2_MAX_META_HEIGHT))
|
||||
@@ -300,9 +298,9 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
|
||||
if (unlikely(depth > GFS2_DIR_MAX_DEPTH))
|
||||
goto corrupt;
|
||||
ip->i_depth = (u8)depth;
|
||||
di->di_entries = be32_to_cpu(str->di_entries);
|
||||
ip->i_entries = be32_to_cpu(str->di_entries);
|
||||
|
||||
di->di_eattr = be64_to_cpu(str->di_eattr);
|
||||
ip->i_eattr = be64_to_cpu(str->di_eattr);
|
||||
if (S_ISREG(ip->i_inode.i_mode))
|
||||
gfs2_set_aops(&ip->i_inode);
|
||||
|
||||
@@ -388,7 +386,6 @@ int gfs2_dinode_dealloc(struct gfs2_inode *ip)
|
||||
gfs2_free_di(rgd, ip);
|
||||
|
||||
gfs2_trans_end(sdp);
|
||||
clear_bit(GLF_STICKY, &ip->i_gl->gl_flags);
|
||||
|
||||
out_rg_gunlock:
|
||||
gfs2_glock_dq_uninit(&al->al_rgd_gh);
|
||||
@@ -690,7 +687,7 @@ static int create_ok(struct gfs2_inode *dip, const struct qstr *name,
|
||||
return error;
|
||||
}
|
||||
|
||||
if (dip->i_di.di_entries == (u32)-1)
|
||||
if (dip->i_entries == (u32)-1)
|
||||
return -EFBIG;
|
||||
if (S_ISDIR(mode) && dip->i_inode.i_nlink == (u32)-1)
|
||||
return -EMLINK;
|
||||
@@ -790,11 +787,11 @@ static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl,
|
||||
di->di_flags = 0;
|
||||
|
||||
if (S_ISREG(mode)) {
|
||||
if ((dip->i_di.di_flags & GFS2_DIF_INHERIT_JDATA) ||
|
||||
if ((dip->i_diskflags & GFS2_DIF_INHERIT_JDATA) ||
|
||||
gfs2_tune_get(sdp, gt_new_files_jdata))
|
||||
di->di_flags |= cpu_to_be32(GFS2_DIF_JDATA);
|
||||
} else if (S_ISDIR(mode)) {
|
||||
di->di_flags |= cpu_to_be32(dip->i_di.di_flags &
|
||||
di->di_flags |= cpu_to_be32(dip->i_diskflags &
|
||||
GFS2_DIF_INHERIT_JDATA);
|
||||
}
|
||||
|
||||
@@ -1068,7 +1065,7 @@ int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name,
|
||||
struct qstr dotname;
|
||||
int error;
|
||||
|
||||
if (ip->i_di.di_entries != 2) {
|
||||
if (ip->i_entries != 2) {
|
||||
if (gfs2_consist_inode(ip))
|
||||
gfs2_dinode_print(ip);
|
||||
return -EIO;
|
||||
@@ -1168,7 +1165,7 @@ int gfs2_readlinki(struct gfs2_inode *ip, char **buf, unsigned int *len)
|
||||
return error;
|
||||
}
|
||||
|
||||
if (!ip->i_di.di_size) {
|
||||
if (!ip->i_disksize) {
|
||||
gfs2_consist_inode(ip);
|
||||
error = -EIO;
|
||||
goto out;
|
||||
@@ -1178,7 +1175,7 @@ int gfs2_readlinki(struct gfs2_inode *ip, char **buf, unsigned int *len)
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
x = ip->i_di.di_size + 1;
|
||||
x = ip->i_disksize + 1;
|
||||
if (x > *len) {
|
||||
*buf = kmalloc(x, GFP_NOFS);
|
||||
if (!*buf) {
|
||||
@@ -1242,7 +1239,6 @@ int gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr)
|
||||
|
||||
void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
|
||||
{
|
||||
const struct gfs2_dinode_host *di = &ip->i_di;
|
||||
struct gfs2_dinode *str = buf;
|
||||
|
||||
str->di_header.mh_magic = cpu_to_be32(GFS2_MAGIC);
|
||||
@@ -1256,7 +1252,7 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
|
||||
str->di_uid = cpu_to_be32(ip->i_inode.i_uid);
|
||||
str->di_gid = cpu_to_be32(ip->i_inode.i_gid);
|
||||
str->di_nlink = cpu_to_be32(ip->i_inode.i_nlink);
|
||||
str->di_size = cpu_to_be64(di->di_size);
|
||||
str->di_size = cpu_to_be64(ip->i_disksize);
|
||||
str->di_blocks = cpu_to_be64(gfs2_get_inode_blocks(&ip->i_inode));
|
||||
str->di_atime = cpu_to_be64(ip->i_inode.i_atime.tv_sec);
|
||||
str->di_mtime = cpu_to_be64(ip->i_inode.i_mtime.tv_sec);
|
||||
@@ -1264,17 +1260,17 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
|
||||
|
||||
str->di_goal_meta = cpu_to_be64(ip->i_goal);
|
||||
str->di_goal_data = cpu_to_be64(ip->i_goal);
|
||||
str->di_generation = cpu_to_be64(di->di_generation);
|
||||
str->di_generation = cpu_to_be64(ip->i_generation);
|
||||
|
||||
str->di_flags = cpu_to_be32(di->di_flags);
|
||||
str->di_flags = cpu_to_be32(ip->i_diskflags);
|
||||
str->di_height = cpu_to_be16(ip->i_height);
|
||||
str->di_payload_format = cpu_to_be32(S_ISDIR(ip->i_inode.i_mode) &&
|
||||
!(ip->i_di.di_flags & GFS2_DIF_EXHASH) ?
|
||||
!(ip->i_diskflags & GFS2_DIF_EXHASH) ?
|
||||
GFS2_FORMAT_DE : 0);
|
||||
str->di_depth = cpu_to_be16(ip->i_depth);
|
||||
str->di_entries = cpu_to_be32(di->di_entries);
|
||||
str->di_entries = cpu_to_be32(ip->i_entries);
|
||||
|
||||
str->di_eattr = cpu_to_be64(di->di_eattr);
|
||||
str->di_eattr = cpu_to_be64(ip->i_eattr);
|
||||
str->di_atime_nsec = cpu_to_be32(ip->i_inode.i_atime.tv_nsec);
|
||||
str->di_mtime_nsec = cpu_to_be32(ip->i_inode.i_mtime.tv_nsec);
|
||||
str->di_ctime_nsec = cpu_to_be32(ip->i_inode.i_ctime.tv_nsec);
|
||||
@@ -1282,22 +1278,21 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
|
||||
|
||||
void gfs2_dinode_print(const struct gfs2_inode *ip)
|
||||
{
|
||||
const struct gfs2_dinode_host *di = &ip->i_di;
|
||||
|
||||
printk(KERN_INFO " no_formal_ino = %llu\n",
|
||||
(unsigned long long)ip->i_no_formal_ino);
|
||||
printk(KERN_INFO " no_addr = %llu\n",
|
||||
(unsigned long long)ip->i_no_addr);
|
||||
printk(KERN_INFO " di_size = %llu\n", (unsigned long long)di->di_size);
|
||||
printk(KERN_INFO " i_disksize = %llu\n",
|
||||
(unsigned long long)ip->i_disksize);
|
||||
printk(KERN_INFO " blocks = %llu\n",
|
||||
(unsigned long long)gfs2_get_inode_blocks(&ip->i_inode));
|
||||
printk(KERN_INFO " i_goal = %llu\n",
|
||||
(unsigned long long)ip->i_goal);
|
||||
printk(KERN_INFO " di_flags = 0x%.8X\n", di->di_flags);
|
||||
printk(KERN_INFO " i_diskflags = 0x%.8X\n", ip->i_diskflags);
|
||||
printk(KERN_INFO " i_height = %u\n", ip->i_height);
|
||||
printk(KERN_INFO " i_depth = %u\n", ip->i_depth);
|
||||
printk(KERN_INFO " di_entries = %u\n", di->di_entries);
|
||||
printk(KERN_INFO " di_eattr = %llu\n",
|
||||
(unsigned long long)di->di_eattr);
|
||||
printk(KERN_INFO " i_entries = %u\n", ip->i_entries);
|
||||
printk(KERN_INFO " i_eattr = %llu\n",
|
||||
(unsigned long long)ip->i_eattr);
|
||||
}
|
||||
|
||||
|
||||
+12
-1
@@ -10,6 +10,7 @@
|
||||
#ifndef __INODE_DOT_H__
|
||||
#define __INODE_DOT_H__
|
||||
|
||||
#include <linux/fs.h>
|
||||
#include "util.h"
|
||||
|
||||
static inline int gfs2_is_stuffed(const struct gfs2_inode *ip)
|
||||
@@ -19,7 +20,7 @@ static inline int gfs2_is_stuffed(const struct gfs2_inode *ip)
|
||||
|
||||
static inline int gfs2_is_jdata(const struct gfs2_inode *ip)
|
||||
{
|
||||
return ip->i_di.di_flags & GFS2_DIF_JDATA;
|
||||
return ip->i_diskflags & GFS2_DIF_JDATA;
|
||||
}
|
||||
|
||||
static inline int gfs2_is_writeback(const struct gfs2_inode *ip)
|
||||
@@ -97,5 +98,15 @@ struct inode *gfs2_lookup_simple(struct inode *dip, const char *name);
|
||||
void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf);
|
||||
void gfs2_dinode_print(const struct gfs2_inode *ip);
|
||||
|
||||
extern const struct inode_operations gfs2_file_iops;
|
||||
extern const struct inode_operations gfs2_dir_iops;
|
||||
extern const struct inode_operations gfs2_symlink_iops;
|
||||
extern const struct file_operations gfs2_file_fops;
|
||||
extern const struct file_operations gfs2_dir_fops;
|
||||
extern const struct file_operations gfs2_file_fops_nolock;
|
||||
extern const struct file_operations gfs2_dir_fops_nolock;
|
||||
|
||||
extern void gfs2_set_inode_flags(struct inode *inode);
|
||||
|
||||
#endif /* __INODE_DOT_H__ */
|
||||
|
||||
|
||||
@@ -194,17 +194,25 @@ out:
|
||||
static void gdlm_recovery_done(void *lockspace, unsigned int jid,
|
||||
unsigned int message)
|
||||
{
|
||||
char env_jid[20];
|
||||
char env_status[20];
|
||||
char *envp[] = { env_jid, env_status, NULL };
|
||||
struct gdlm_ls *ls = lockspace;
|
||||
ls->recover_jid_done = jid;
|
||||
ls->recover_jid_status = message;
|
||||
kobject_uevent(&ls->kobj, KOBJ_CHANGE);
|
||||
sprintf(env_jid, "JID=%d", jid);
|
||||
sprintf(env_status, "RECOVERY=%s",
|
||||
message == LM_RD_SUCCESS ? "Done" : "Failed");
|
||||
kobject_uevent_env(&ls->kobj, KOBJ_CHANGE, envp);
|
||||
}
|
||||
|
||||
static void gdlm_others_may_mount(void *lockspace)
|
||||
{
|
||||
char *message = "FIRSTMOUNT=Done";
|
||||
char *envp[] = { message, NULL };
|
||||
struct gdlm_ls *ls = lockspace;
|
||||
ls->first_done = 1;
|
||||
kobject_uevent(&ls->kobj, KOBJ_CHANGE);
|
||||
kobject_uevent_env(&ls->kobj, KOBJ_CHANGE, envp);
|
||||
}
|
||||
|
||||
/* Userspace gets the offline uevent, blocks new gfs locks on
|
||||
|
||||
@@ -195,9 +195,23 @@ void gdlm_kobject_release(struct gdlm_ls *ls)
|
||||
kobject_put(&ls->kobj);
|
||||
}
|
||||
|
||||
static int gdlm_uevent(struct kset *kset, struct kobject *kobj,
|
||||
struct kobj_uevent_env *env)
|
||||
{
|
||||
struct gdlm_ls *ls = container_of(kobj, struct gdlm_ls, kobj);
|
||||
add_uevent_var(env, "LOCKTABLE=%s:%s", ls->clustername, ls->fsname);
|
||||
add_uevent_var(env, "LOCKPROTO=lock_dlm");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct kset_uevent_ops gdlm_uevent_ops = {
|
||||
.uevent = gdlm_uevent,
|
||||
};
|
||||
|
||||
|
||||
int gdlm_sysfs_init(void)
|
||||
{
|
||||
gdlm_kset = kset_create_and_add("lock_dlm", NULL, kernel_kobj);
|
||||
gdlm_kset = kset_create_and_add("lock_dlm", &gdlm_uevent_ops, kernel_kobj);
|
||||
if (!gdlm_kset) {
|
||||
printk(KERN_WARNING "%s: can not create kset\n", __func__);
|
||||
return -ENOMEM;
|
||||
|
||||
+13
-2
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "gfs2.h"
|
||||
#include "incore.h"
|
||||
#include "ops_fstype.h"
|
||||
#include "super.h"
|
||||
#include "sys.h"
|
||||
#include "util.h"
|
||||
#include "glock.h"
|
||||
@@ -30,6 +30,7 @@ static void gfs2_init_inode_once(void *foo)
|
||||
|
||||
inode_init_once(&ip->i_inode);
|
||||
init_rwsem(&ip->i_rw_mutex);
|
||||
INIT_LIST_HEAD(&ip->i_trunc_list);
|
||||
ip->i_alloc = NULL;
|
||||
}
|
||||
|
||||
@@ -42,7 +43,7 @@ static void gfs2_init_glock_once(void *foo)
|
||||
INIT_LIST_HEAD(&gl->gl_holders);
|
||||
gl->gl_lvb = NULL;
|
||||
atomic_set(&gl->gl_lvb_count, 0);
|
||||
INIT_LIST_HEAD(&gl->gl_reclaim);
|
||||
INIT_LIST_HEAD(&gl->gl_lru);
|
||||
INIT_LIST_HEAD(&gl->gl_ail_list);
|
||||
atomic_set(&gl->gl_ail_count, 0);
|
||||
}
|
||||
@@ -93,6 +94,12 @@ static int __init init_gfs2_fs(void)
|
||||
if (!gfs2_rgrpd_cachep)
|
||||
goto fail;
|
||||
|
||||
gfs2_quotad_cachep = kmem_cache_create("gfs2_quotad",
|
||||
sizeof(struct gfs2_quota_data),
|
||||
0, 0, NULL);
|
||||
if (!gfs2_quotad_cachep)
|
||||
goto fail;
|
||||
|
||||
error = register_filesystem(&gfs2_fs_type);
|
||||
if (error)
|
||||
goto fail;
|
||||
@@ -112,6 +119,9 @@ fail_unregister:
|
||||
fail:
|
||||
gfs2_glock_exit();
|
||||
|
||||
if (gfs2_quotad_cachep)
|
||||
kmem_cache_destroy(gfs2_quotad_cachep);
|
||||
|
||||
if (gfs2_rgrpd_cachep)
|
||||
kmem_cache_destroy(gfs2_rgrpd_cachep);
|
||||
|
||||
@@ -140,6 +150,7 @@ static void __exit exit_gfs2_fs(void)
|
||||
unregister_filesystem(&gfs2_fs_type);
|
||||
unregister_filesystem(&gfs2meta_fs_type);
|
||||
|
||||
kmem_cache_destroy(gfs2_quotad_cachep);
|
||||
kmem_cache_destroy(gfs2_rgrpd_cachep);
|
||||
kmem_cache_destroy(gfs2_bufdata_cachep);
|
||||
kmem_cache_destroy(gfs2_inode_cachep);
|
||||
|
||||
+1
-28
@@ -32,7 +32,6 @@ enum {
|
||||
Opt_debug,
|
||||
Opt_nodebug,
|
||||
Opt_upgrade,
|
||||
Opt_num_glockd,
|
||||
Opt_acl,
|
||||
Opt_noacl,
|
||||
Opt_quota_off,
|
||||
@@ -57,7 +56,6 @@ static const match_table_t tokens = {
|
||||
{Opt_debug, "debug"},
|
||||
{Opt_nodebug, "nodebug"},
|
||||
{Opt_upgrade, "upgrade"},
|
||||
{Opt_num_glockd, "num_glockd=%d"},
|
||||
{Opt_acl, "acl"},
|
||||
{Opt_noacl, "noacl"},
|
||||
{Opt_quota_off, "quota=off"},
|
||||
@@ -87,16 +85,7 @@ int gfs2_mount_args(struct gfs2_sbd *sdp, char *data_arg, int remount)
|
||||
int error = 0;
|
||||
|
||||
if (!remount) {
|
||||
/* If someone preloaded options, use those instead */
|
||||
spin_lock(&gfs2_sys_margs_lock);
|
||||
if (gfs2_sys_margs) {
|
||||
data = gfs2_sys_margs;
|
||||
gfs2_sys_margs = NULL;
|
||||
}
|
||||
spin_unlock(&gfs2_sys_margs_lock);
|
||||
|
||||
/* Set some defaults */
|
||||
args->ar_num_glockd = GFS2_GLOCKD_DEFAULT;
|
||||
args->ar_quota = GFS2_QUOTA_DEFAULT;
|
||||
args->ar_data = GFS2_DATA_DEFAULT;
|
||||
}
|
||||
@@ -105,7 +94,7 @@ int gfs2_mount_args(struct gfs2_sbd *sdp, char *data_arg, int remount)
|
||||
process them */
|
||||
|
||||
for (options = data; (o = strsep(&options, ",")); ) {
|
||||
int token, option;
|
||||
int token;
|
||||
substring_t tmp[MAX_OPT_ARGS];
|
||||
|
||||
if (!*o)
|
||||
@@ -196,22 +185,6 @@ int gfs2_mount_args(struct gfs2_sbd *sdp, char *data_arg, int remount)
|
||||
goto cant_remount;
|
||||
args->ar_upgrade = 1;
|
||||
break;
|
||||
case Opt_num_glockd:
|
||||
if ((error = match_int(&tmp[0], &option))) {
|
||||
fs_info(sdp, "problem getting num_glockd\n");
|
||||
goto out_error;
|
||||
}
|
||||
|
||||
if (remount && option != args->ar_num_glockd)
|
||||
goto cant_remount;
|
||||
if (!option || option > GFS2_GLOCKD_MAX) {
|
||||
fs_info(sdp, "0 < num_glockd <= %u (not %u)\n",
|
||||
GFS2_GLOCKD_MAX, option);
|
||||
error = -EINVAL;
|
||||
goto out_error;
|
||||
}
|
||||
args->ar_num_glockd = option;
|
||||
break;
|
||||
case Opt_acl:
|
||||
args->ar_posix_acl = 1;
|
||||
sdp->sd_vfs->s_flags |= MS_POSIXACL;
|
||||
|
||||
+16
-16
@@ -210,25 +210,23 @@ static int gfs2_jdata_writepage(struct page *page, struct writeback_control *wbc
|
||||
{
|
||||
struct inode *inode = page->mapping->host;
|
||||
struct gfs2_sbd *sdp = GFS2_SB(inode);
|
||||
int error;
|
||||
int ret;
|
||||
int done_trans = 0;
|
||||
|
||||
error = gfs2_writepage_common(page, wbc);
|
||||
if (error <= 0)
|
||||
return error;
|
||||
|
||||
if (PageChecked(page)) {
|
||||
if (wbc->sync_mode != WB_SYNC_ALL)
|
||||
goto out_ignore;
|
||||
error = gfs2_trans_begin(sdp, RES_DINODE + 1, 0);
|
||||
if (error)
|
||||
ret = gfs2_trans_begin(sdp, RES_DINODE + 1, 0);
|
||||
if (ret)
|
||||
goto out_ignore;
|
||||
done_trans = 1;
|
||||
}
|
||||
error = __gfs2_jdata_writepage(page, wbc);
|
||||
ret = gfs2_writepage_common(page, wbc);
|
||||
if (ret > 0)
|
||||
ret = __gfs2_jdata_writepage(page, wbc);
|
||||
if (done_trans)
|
||||
gfs2_trans_end(sdp);
|
||||
return error;
|
||||
return ret;
|
||||
|
||||
out_ignore:
|
||||
redirty_page_for_writepage(wbc, page);
|
||||
@@ -453,8 +451,8 @@ static int stuffed_readpage(struct gfs2_inode *ip, struct page *page)
|
||||
|
||||
kaddr = kmap_atomic(page, KM_USER0);
|
||||
memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode),
|
||||
ip->i_di.di_size);
|
||||
memset(kaddr + ip->i_di.di_size, 0, PAGE_CACHE_SIZE - ip->i_di.di_size);
|
||||
ip->i_disksize);
|
||||
memset(kaddr + ip->i_disksize, 0, PAGE_CACHE_SIZE - ip->i_disksize);
|
||||
kunmap_atomic(kaddr, KM_USER0);
|
||||
flush_dcache_page(page);
|
||||
brelse(dibh);
|
||||
@@ -627,7 +625,7 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
|
||||
{
|
||||
struct gfs2_inode *ip = GFS2_I(mapping->host);
|
||||
struct gfs2_sbd *sdp = GFS2_SB(mapping->host);
|
||||
unsigned int data_blocks, ind_blocks, rblocks;
|
||||
unsigned int data_blocks = 0, ind_blocks = 0, rblocks;
|
||||
int alloc_required;
|
||||
int error = 0;
|
||||
struct gfs2_alloc *al;
|
||||
@@ -641,11 +639,13 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
|
||||
if (unlikely(error))
|
||||
goto out_uninit;
|
||||
|
||||
gfs2_write_calc_reserv(ip, len, &data_blocks, &ind_blocks);
|
||||
error = gfs2_write_alloc_required(ip, pos, len, &alloc_required);
|
||||
if (error)
|
||||
goto out_unlock;
|
||||
|
||||
if (alloc_required || gfs2_is_jdata(ip))
|
||||
gfs2_write_calc_reserv(ip, len, &data_blocks, &ind_blocks);
|
||||
|
||||
if (alloc_required) {
|
||||
al = gfs2_alloc_get(ip);
|
||||
if (!al) {
|
||||
@@ -782,7 +782,7 @@ static int gfs2_stuffed_write_end(struct inode *inode, struct buffer_head *dibh,
|
||||
|
||||
if (inode->i_size < to) {
|
||||
i_size_write(inode, to);
|
||||
ip->i_di.di_size = inode->i_size;
|
||||
ip->i_disksize = inode->i_size;
|
||||
di->di_size = cpu_to_be64(inode->i_size);
|
||||
mark_inode_dirty(inode);
|
||||
}
|
||||
@@ -847,9 +847,9 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping,
|
||||
|
||||
ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata);
|
||||
|
||||
if (likely(ret >= 0) && (inode->i_size > ip->i_di.di_size)) {
|
||||
if (likely(ret >= 0) && (inode->i_size > ip->i_disksize)) {
|
||||
di = (struct gfs2_dinode *)dibh->b_data;
|
||||
ip->i_di.di_size = inode->i_size;
|
||||
ip->i_disksize = inode->i_size;
|
||||
di->di_size = cpu_to_be64(inode->i_size);
|
||||
mark_inode_dirty(inode);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user