Commit b09e593d authored by Steven Whitehouse's avatar Steven Whitehouse

[GFS2] Fix a ref count bug and other clean ups

This fixes a ref count bug that sometimes showed up a umount time
(causing it to hang) but it otherwise mostly harmless. At the same
time there are some clean ups including making the log operations
structures const, moving a memory allocation so that its not done
in the fast path of checking to see if there is an outstanding
transaction related to a particular glock.

Removes the sd_log_wrap varaible which was updated, but never actually
used anywhere. Updates the gfs2 ioctl() to run without the kernel lock
(which it never needed anyway). Removes the "invalidate inodes" loop
from GFS2's put_super routine. This is done in kill super anyway so
we don't need to do it here. The loop was also bogus in that if there
are any inodes "stuck" at this point its a bug and we need to know
about it rather than hide it by hanging forever.
Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent 55eccc6d
...@@ -129,7 +129,7 @@ int gfs2_logd(void *data) ...@@ -129,7 +129,7 @@ int gfs2_logd(void *data)
gfs2_ail1_empty(sdp, DIO_ALL); gfs2_ail1_empty(sdp, DIO_ALL);
if (time_after_eq(jiffies, t)) { if (time_after_eq(jiffies, t)) {
gfs2_log_flush(sdp); gfs2_log_flush(sdp, NULL);
sdp->sd_log_flush_time = jiffies; sdp->sd_log_flush_time = jiffies;
} }
......
...@@ -789,6 +789,8 @@ static struct gfs2_dirent *gfs2_dirent_search(struct inode *inode, ...@@ -789,6 +789,8 @@ static struct gfs2_dirent *gfs2_dirent_search(struct inode *inode,
if (error) if (error)
return ERR_PTR(error); return ERR_PTR(error);
dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size, scan, name, NULL); dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size, scan, name, NULL);
brelse(bh);
got_dent: got_dent:
*pbh = bh; *pbh = bh;
return dent; return dent;
......
...@@ -45,7 +45,7 @@ static void meta_go_sync(struct gfs2_glock *gl, int flags) ...@@ -45,7 +45,7 @@ static void meta_go_sync(struct gfs2_glock *gl, int flags)
return; return;
if (test_and_clear_bit(GLF_DIRTY, &gl->gl_flags)) { if (test_and_clear_bit(GLF_DIRTY, &gl->gl_flags)) {
gfs2_log_flush_glock(gl); gfs2_log_flush(gl->gl_sbd, gl);
gfs2_meta_sync(gl, flags | DIO_START | DIO_WAIT); gfs2_meta_sync(gl, flags | DIO_START | DIO_WAIT);
if (flags & DIO_RELEASE) if (flags & DIO_RELEASE)
gfs2_ail_empty_gl(gl); gfs2_ail_empty_gl(gl);
...@@ -149,12 +149,12 @@ static void inode_go_sync(struct gfs2_glock *gl, int flags) ...@@ -149,12 +149,12 @@ static void inode_go_sync(struct gfs2_glock *gl, int flags)
if (test_bit(GLF_DIRTY, &gl->gl_flags)) { if (test_bit(GLF_DIRTY, &gl->gl_flags)) {
if (meta && data) { if (meta && data) {
gfs2_page_sync(gl, flags | DIO_START); gfs2_page_sync(gl, flags | DIO_START);
gfs2_log_flush_glock(gl); gfs2_log_flush(gl->gl_sbd, gl);
gfs2_meta_sync(gl, flags | DIO_START | DIO_WAIT); gfs2_meta_sync(gl, flags | DIO_START | DIO_WAIT);
gfs2_page_sync(gl, flags | DIO_WAIT); gfs2_page_sync(gl, flags | DIO_WAIT);
clear_bit(GLF_DIRTY, &gl->gl_flags); clear_bit(GLF_DIRTY, &gl->gl_flags);
} else if (meta) { } else if (meta) {
gfs2_log_flush_glock(gl); gfs2_log_flush(gl->gl_sbd, gl);
gfs2_meta_sync(gl, flags | DIO_START | DIO_WAIT); gfs2_meta_sync(gl, flags | DIO_START | DIO_WAIT);
} else if (data) } else if (data)
gfs2_page_sync(gl, flags | DIO_START | DIO_WAIT); gfs2_page_sync(gl, flags | DIO_START | DIO_WAIT);
......
...@@ -62,12 +62,12 @@ struct gfs2_log_operations { ...@@ -62,12 +62,12 @@ struct gfs2_log_operations {
struct gfs2_log_descriptor *ld, __be64 *ptr, struct gfs2_log_descriptor *ld, __be64 *ptr,
int pass); int pass);
void (*lo_after_scan) (struct gfs2_jdesc *jd, int error, int pass); void (*lo_after_scan) (struct gfs2_jdesc *jd, int error, int pass);
char *lo_name; const char *lo_name;
}; };
struct gfs2_log_element { struct gfs2_log_element {
struct list_head le_list; struct list_head le_list;
struct gfs2_log_operations *le_ops; const struct gfs2_log_operations *le_ops;
}; };
struct gfs2_bitmap { struct gfs2_bitmap {
...@@ -618,6 +618,7 @@ struct gfs2_sbd { ...@@ -618,6 +618,7 @@ struct gfs2_sbd {
unsigned int sd_log_num_rg; unsigned int sd_log_num_rg;
unsigned int sd_log_num_databuf; unsigned int sd_log_num_databuf;
unsigned int sd_log_num_jdata; unsigned int sd_log_num_jdata;
unsigned int sd_log_num_hdrs;
struct list_head sd_log_le_gl; struct list_head sd_log_le_gl;
struct list_head sd_log_le_buf; struct list_head sd_log_le_buf;
...@@ -631,7 +632,6 @@ struct gfs2_sbd { ...@@ -631,7 +632,6 @@ struct gfs2_sbd {
uint64_t sd_log_sequence; uint64_t sd_log_sequence;
unsigned int sd_log_head; unsigned int sd_log_head;
unsigned int sd_log_tail; unsigned int sd_log_tail;
uint64_t sd_log_wraps;
int sd_log_idle; int sd_log_idle;
unsigned long sd_log_flush_time; unsigned long sd_log_flush_time;
......
...@@ -171,13 +171,14 @@ int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks) ...@@ -171,13 +171,14 @@ int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks)
while(sdp->sd_log_blks_free <= blks) { while(sdp->sd_log_blks_free <= blks) {
gfs2_log_unlock(sdp); gfs2_log_unlock(sdp);
gfs2_ail1_empty(sdp, 0); gfs2_ail1_empty(sdp, 0);
gfs2_log_flush(sdp); gfs2_log_flush(sdp, NULL);
if (try++) if (try++)
gfs2_ail1_start(sdp, 0); gfs2_ail1_start(sdp, 0);
gfs2_log_lock(sdp); gfs2_log_lock(sdp);
} }
sdp->sd_log_blks_free -= blks; sdp->sd_log_blks_free -= blks;
/* printk(KERN_INFO "reserved %u blocks (%u left)\n", blks, sdp->sd_log_blks_free); */
gfs2_log_unlock(sdp); gfs2_log_unlock(sdp);
mutex_unlock(&sdp->sd_log_reserve_mutex); mutex_unlock(&sdp->sd_log_reserve_mutex);
...@@ -199,6 +200,7 @@ void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks) ...@@ -199,6 +200,7 @@ void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks)
gfs2_log_lock(sdp); gfs2_log_lock(sdp);
sdp->sd_log_blks_free += blks; sdp->sd_log_blks_free += blks;
/* printk(KERN_INFO "released %u blocks (%u left)\n", blks, sdp->sd_log_blks_free); */
gfs2_assert_withdraw(sdp, gfs2_assert_withdraw(sdp,
sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks); sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks);
gfs2_log_unlock(sdp); gfs2_log_unlock(sdp);
...@@ -342,6 +344,7 @@ static void log_pull_tail(struct gfs2_sbd *sdp, unsigned int new_tail, int pull) ...@@ -342,6 +344,7 @@ static void log_pull_tail(struct gfs2_sbd *sdp, unsigned int new_tail, int pull)
gfs2_log_lock(sdp); gfs2_log_lock(sdp);
sdp->sd_log_blks_free += dist - ((pull) ? 1 : 0); sdp->sd_log_blks_free += dist - ((pull) ? 1 : 0);
/* printk(KERN_INFO "pull tail refunding %u blocks (%u left) pull=%d\n", dist - ((pull) ? 1 : 0), sdp->sd_log_blks_free, pull); */
gfs2_assert_withdraw(sdp, gfs2_assert_withdraw(sdp,
sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks); sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks);
gfs2_log_unlock(sdp); gfs2_log_unlock(sdp);
...@@ -364,6 +367,8 @@ static void log_write_header(struct gfs2_sbd *sdp, uint32_t flags, int pull) ...@@ -364,6 +367,8 @@ static void log_write_header(struct gfs2_sbd *sdp, uint32_t flags, int pull)
unsigned int tail; unsigned int tail;
uint32_t hash; uint32_t hash;
/* printk(KERN_INFO "log write header start (flags=%08x, pull=%d)\n", flags, pull); */
bh = sb_getblk(sdp->sd_vfs, blkno); bh = sb_getblk(sdp->sd_vfs, blkno);
lock_buffer(bh); lock_buffer(bh);
memset(bh->b_data, 0, bh->b_size); memset(bh->b_data, 0, bh->b_size);
...@@ -398,6 +403,8 @@ static void log_write_header(struct gfs2_sbd *sdp, uint32_t flags, int pull) ...@@ -398,6 +403,8 @@ static void log_write_header(struct gfs2_sbd *sdp, uint32_t flags, int pull)
sdp->sd_log_idle = (tail == sdp->sd_log_flush_head); sdp->sd_log_idle = (tail == sdp->sd_log_flush_head);
log_incr_head(sdp); log_incr_head(sdp);
/* printk(KERN_INFO "log write header out\n"); */
} }
static void log_flush_commit(struct gfs2_sbd *sdp) static void log_flush_commit(struct gfs2_sbd *sdp)
...@@ -432,20 +439,16 @@ static void log_flush_commit(struct gfs2_sbd *sdp) ...@@ -432,20 +439,16 @@ static void log_flush_commit(struct gfs2_sbd *sdp)
} }
/** /**
* gfs2_log_flush_i - 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
* *
*/ */
void gfs2_log_flush_i(struct gfs2_sbd *sdp, struct gfs2_glock *gl) void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
{ {
struct gfs2_ail *ai; struct gfs2_ail *ai;
ai = kzalloc(sizeof(struct gfs2_ail), GFP_NOFS | __GFP_NOFAIL);
INIT_LIST_HEAD(&ai->ai_ail1_list);
INIT_LIST_HEAD(&ai->ai_ail2_list);
down_write(&sdp->sd_log_flush_lock); down_write(&sdp->sd_log_flush_lock);
if (gl) { if (gl) {
...@@ -453,12 +456,14 @@ void gfs2_log_flush_i(struct gfs2_sbd *sdp, struct gfs2_glock *gl) ...@@ -453,12 +456,14 @@ void gfs2_log_flush_i(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
if (list_empty(&gl->gl_le.le_list)) { if (list_empty(&gl->gl_le.le_list)) {
gfs2_log_unlock(sdp); gfs2_log_unlock(sdp);
up_write(&sdp->sd_log_flush_lock); up_write(&sdp->sd_log_flush_lock);
kfree(ai);
return; return;
} }
gfs2_log_unlock(sdp); gfs2_log_unlock(sdp);
} }
ai = kzalloc(sizeof(struct gfs2_ail), GFP_NOFS | __GFP_NOFAIL);
INIT_LIST_HEAD(&ai->ai_ail1_list);
INIT_LIST_HEAD(&ai->ai_ail2_list);
gfs2_assert_withdraw(sdp, gfs2_assert_withdraw(sdp,
sdp->sd_log_num_buf == sdp->sd_log_commited_buf); sdp->sd_log_num_buf == sdp->sd_log_commited_buf);
...@@ -476,11 +481,12 @@ void gfs2_log_flush_i(struct gfs2_sbd *sdp, struct gfs2_glock *gl) ...@@ -476,11 +481,12 @@ void gfs2_log_flush_i(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
log_write_header(sdp, 0, PULL); log_write_header(sdp, 0, PULL);
lops_after_commit(sdp, ai); lops_after_commit(sdp, ai);
sdp->sd_log_head = sdp->sd_log_flush_head; sdp->sd_log_head = sdp->sd_log_flush_head;
if (sdp->sd_log_flush_wrapped)
sdp->sd_log_wraps++; /* printk(KERN_INFO "sd_log_num_hdrs %u\n", sdp->sd_log_num_hdrs); */
sdp->sd_log_blks_reserved = sdp->sd_log_blks_reserved =
sdp->sd_log_commited_buf = sdp->sd_log_commited_buf =
sdp->sd_log_num_hdrs =
sdp->sd_log_commited_revoke = 0; sdp->sd_log_commited_revoke = 0;
gfs2_log_lock(sdp); gfs2_log_lock(sdp);
...@@ -519,8 +525,7 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr) ...@@ -519,8 +525,7 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
sdp->sd_log_blks_free += tr->tr_reserved - sdp->sd_log_blks_free += tr->tr_reserved -
(reserved - sdp->sd_log_blks_reserved); (reserved - sdp->sd_log_blks_reserved);
gfs2_assert_withdraw(sdp, gfs2_assert_withdraw(sdp, sdp->sd_log_blks_free >= old);
sdp->sd_log_blks_free >= old);
gfs2_assert_withdraw(sdp, gfs2_assert_withdraw(sdp,
sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks); sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks);
...@@ -548,7 +553,7 @@ void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr) ...@@ -548,7 +553,7 @@ void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
gfs2_log_lock(sdp); gfs2_log_lock(sdp);
if (sdp->sd_log_num_buf > gfs2_tune_get(sdp, gt_incore_log_blocks)) { if (sdp->sd_log_num_buf > gfs2_tune_get(sdp, gt_incore_log_blocks)) {
gfs2_log_unlock(sdp); gfs2_log_unlock(sdp);
gfs2_log_flush(sdp); gfs2_log_flush(sdp, NULL);
} else } else
gfs2_log_unlock(sdp); gfs2_log_unlock(sdp);
} }
...@@ -583,8 +588,6 @@ void gfs2_log_shutdown(struct gfs2_sbd *sdp) ...@@ -583,8 +588,6 @@ void gfs2_log_shutdown(struct gfs2_sbd *sdp)
gfs2_assert_withdraw(sdp, list_empty(&sdp->sd_ail2_list)); gfs2_assert_withdraw(sdp, list_empty(&sdp->sd_ail2_list));
sdp->sd_log_head = sdp->sd_log_flush_head; sdp->sd_log_head = sdp->sd_log_flush_head;
if (sdp->sd_log_flush_wrapped)
sdp->sd_log_wraps++;
sdp->sd_log_tail = sdp->sd_log_head; sdp->sd_log_tail = sdp->sd_log_head;
up_write(&sdp->sd_log_flush_lock); up_write(&sdp->sd_log_flush_lock);
......
...@@ -37,7 +37,6 @@ static inline void gfs2_log_pointers_init(struct gfs2_sbd *sdp, ...@@ -37,7 +37,6 @@ static inline void gfs2_log_pointers_init(struct gfs2_sbd *sdp,
{ {
if (++value == sdp->sd_jdesc->jd_blocks) { if (++value == sdp->sd_jdesc->jd_blocks) {
value = 0; value = 0;
sdp->sd_log_wraps++;
} }
sdp->sd_log_head = sdp->sd_log_tail = value; sdp->sd_log_head = sdp->sd_log_tail = value;
} }
...@@ -54,10 +53,7 @@ void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks); ...@@ -54,10 +53,7 @@ void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks);
struct buffer_head *gfs2_log_get_buf(struct gfs2_sbd *sdp); struct buffer_head *gfs2_log_get_buf(struct gfs2_sbd *sdp);
struct buffer_head *gfs2_log_fake_buf(struct gfs2_sbd *sdp, struct buffer_head *gfs2_log_fake_buf(struct gfs2_sbd *sdp,
struct buffer_head *real); struct buffer_head *real);
void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl);
#define gfs2_log_flush(sdp) gfs2_log_flush_i((sdp), NULL)
#define gfs2_log_flush_glock(gl) gfs2_log_flush_i((gl)->gl_sbd, (gl))
void gfs2_log_flush_i(struct gfs2_sbd *sdp, struct gfs2_glock *gl);
void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *trans); void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *trans);
void gfs2_log_shutdown(struct gfs2_sbd *sdp); void gfs2_log_shutdown(struct gfs2_sbd *sdp);
......
...@@ -130,6 +130,7 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp) ...@@ -130,6 +130,7 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp)
if (total > limit) if (total > limit)
num = limit; num = limit;
bh = gfs2_log_get_buf(sdp); bh = gfs2_log_get_buf(sdp);
sdp->sd_log_num_hdrs++;
ld = (struct gfs2_log_descriptor *)bh->b_data; ld = (struct gfs2_log_descriptor *)bh->b_data;
ptr = (__be64 *)(bh->b_data + offset); ptr = (__be64 *)(bh->b_data + offset);
ld->ld_header.mh_magic = cpu_to_be32(GFS2_MAGIC); ld->ld_header.mh_magic = cpu_to_be32(GFS2_MAGIC);
...@@ -570,6 +571,7 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp) ...@@ -570,6 +571,7 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
gfs2_log_unlock(sdp); gfs2_log_unlock(sdp);
if (!bh) { if (!bh) {
bh = gfs2_log_get_buf(sdp); bh = gfs2_log_get_buf(sdp);
sdp->sd_log_num_hdrs++;
ld = (struct gfs2_log_descriptor *) ld = (struct gfs2_log_descriptor *)
bh->b_data; bh->b_data;
ptr = (__be64 *)(bh->b_data + offset); ptr = (__be64 *)(bh->b_data + offset);
...@@ -750,13 +752,13 @@ static void databuf_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai) ...@@ -750,13 +752,13 @@ static void databuf_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
} }
struct gfs2_log_operations gfs2_glock_lops = { const struct gfs2_log_operations gfs2_glock_lops = {
.lo_add = glock_lo_add, .lo_add = glock_lo_add,
.lo_after_commit = glock_lo_after_commit, .lo_after_commit = glock_lo_after_commit,
.lo_name = "glock" .lo_name = "glock"
}; };
struct gfs2_log_operations gfs2_buf_lops = { const struct gfs2_log_operations gfs2_buf_lops = {
.lo_add = buf_lo_add, .lo_add = buf_lo_add,
.lo_incore_commit = buf_lo_incore_commit, .lo_incore_commit = buf_lo_incore_commit,
.lo_before_commit = buf_lo_before_commit, .lo_before_commit = buf_lo_before_commit,
...@@ -767,7 +769,7 @@ struct gfs2_log_operations gfs2_buf_lops = { ...@@ -767,7 +769,7 @@ struct gfs2_log_operations gfs2_buf_lops = {
.lo_name = "buf" .lo_name = "buf"
}; };
struct gfs2_log_operations gfs2_revoke_lops = { const struct gfs2_log_operations gfs2_revoke_lops = {
.lo_add = revoke_lo_add, .lo_add = revoke_lo_add,
.lo_before_commit = revoke_lo_before_commit, .lo_before_commit = revoke_lo_before_commit,
.lo_before_scan = revoke_lo_before_scan, .lo_before_scan = revoke_lo_before_scan,
...@@ -776,13 +778,13 @@ struct gfs2_log_operations gfs2_revoke_lops = { ...@@ -776,13 +778,13 @@ struct gfs2_log_operations gfs2_revoke_lops = {
.lo_name = "revoke" .lo_name = "revoke"
}; };
struct gfs2_log_operations gfs2_rg_lops = { const struct gfs2_log_operations gfs2_rg_lops = {
.lo_add = rg_lo_add, .lo_add = rg_lo_add,
.lo_after_commit = rg_lo_after_commit, .lo_after_commit = rg_lo_after_commit,
.lo_name = "rg" .lo_name = "rg"
}; };
struct gfs2_log_operations gfs2_databuf_lops = { const struct gfs2_log_operations gfs2_databuf_lops = {
.lo_add = databuf_lo_add, .lo_add = databuf_lo_add,
.lo_incore_commit = buf_lo_incore_commit, .lo_incore_commit = buf_lo_incore_commit,
.lo_before_commit = databuf_lo_before_commit, .lo_before_commit = databuf_lo_before_commit,
...@@ -792,7 +794,7 @@ struct gfs2_log_operations gfs2_databuf_lops = { ...@@ -792,7 +794,7 @@ struct gfs2_log_operations gfs2_databuf_lops = {
.lo_name = "databuf" .lo_name = "databuf"
}; };
struct gfs2_log_operations *gfs2_log_ops[] = { const struct gfs2_log_operations *gfs2_log_ops[] = {
&gfs2_glock_lops, &gfs2_glock_lops,
&gfs2_buf_lops, &gfs2_buf_lops,
&gfs2_revoke_lops, &gfs2_revoke_lops,
......
...@@ -10,16 +10,16 @@ ...@@ -10,16 +10,16 @@
#ifndef __LOPS_DOT_H__ #ifndef __LOPS_DOT_H__
#define __LOPS_DOT_H__ #define __LOPS_DOT_H__
extern struct gfs2_log_operations gfs2_glock_lops; extern const struct gfs2_log_operations gfs2_glock_lops;
extern struct gfs2_log_operations gfs2_buf_lops; extern const struct gfs2_log_operations gfs2_buf_lops;
extern struct gfs2_log_operations gfs2_revoke_lops; extern const struct gfs2_log_operations gfs2_revoke_lops;
extern struct gfs2_log_operations gfs2_rg_lops; extern const struct gfs2_log_operations gfs2_rg_lops;
extern struct gfs2_log_operations gfs2_databuf_lops; extern const struct gfs2_log_operations gfs2_databuf_lops;
extern struct gfs2_log_operations *gfs2_log_ops[]; extern const struct gfs2_log_operations *gfs2_log_ops[];
static inline void lops_init_le(struct gfs2_log_element *le, static inline void lops_init_le(struct gfs2_log_element *le,
struct gfs2_log_operations *lops) const struct gfs2_log_operations *lops)
{ {
INIT_LIST_HEAD(&le->le_list); INIT_LIST_HEAD(&le->le_list);
le->le_ops = lops; le->le_ops = lops;
......
...@@ -59,11 +59,12 @@ static int gfs2_aspace_writepage(struct page *page, ...@@ -59,11 +59,12 @@ static int gfs2_aspace_writepage(struct page *page,
static void stuck_releasepage(struct buffer_head *bh) static void stuck_releasepage(struct buffer_head *bh)
{ {
struct gfs2_sbd *sdp = bh->b_page->mapping->host->i_sb->s_fs_info; struct inode *inode = bh->b_page->mapping->host;
struct gfs2_sbd *sdp = inode->i_sb->s_fs_info;
struct gfs2_bufdata *bd = bh->b_private; struct gfs2_bufdata *bd = bh->b_private;
struct gfs2_glock *gl; struct gfs2_glock *gl;
fs_warn(sdp, "stuck in gfs2_releasepage()\n"); fs_warn(sdp, "stuck in gfs2_releasepage() %p\n", inode);
fs_warn(sdp, "blkno = %llu, bh->b_count = %d\n", fs_warn(sdp, "blkno = %llu, bh->b_count = %d\n",
(uint64_t)bh->b_blocknr, atomic_read(&bh->b_count)); (uint64_t)bh->b_blocknr, atomic_read(&bh->b_count));
fs_warn(sdp, "pinned = %u\n", buffer_pinned(bh)); fs_warn(sdp, "pinned = %u\n", buffer_pinned(bh));
...@@ -191,7 +192,6 @@ struct inode *gfs2_aspace_get(struct gfs2_sbd *sdp) ...@@ -191,7 +192,6 @@ struct inode *gfs2_aspace_get(struct gfs2_sbd *sdp)
aspace->u.generic_ip = NULL; aspace->u.generic_ip = NULL;
insert_inode_hash(aspace); insert_inode_hash(aspace);
} }
return aspace; return aspace;
} }
...@@ -353,7 +353,7 @@ void gfs2_ail_empty_gl(struct gfs2_glock *gl) ...@@ -353,7 +353,7 @@ void gfs2_ail_empty_gl(struct gfs2_glock *gl)
gfs2_log_unlock(sdp); gfs2_log_unlock(sdp);
gfs2_trans_end(sdp); gfs2_trans_end(sdp);
gfs2_log_flush(sdp); gfs2_log_flush(sdp, NULL);
} }
/** /**
...@@ -876,7 +876,7 @@ void gfs2_meta_ra(struct gfs2_glock *gl, uint64_t dblock, uint32_t extlen) ...@@ -876,7 +876,7 @@ void gfs2_meta_ra(struct gfs2_glock *gl, uint64_t dblock, uint32_t extlen)
void gfs2_meta_syncfs(struct gfs2_sbd *sdp) void gfs2_meta_syncfs(struct gfs2_sbd *sdp)
{ {
gfs2_log_flush(sdp); gfs2_log_flush(sdp, NULL);
for (;;) { for (;;) {
gfs2_ail1_start(sdp, DIO_ALL); gfs2_ail1_start(sdp, DIO_ALL);
if (gfs2_ail1_empty(sdp, DIO_ALL)) if (gfs2_ail1_empty(sdp, DIO_ALL))
......
...@@ -561,8 +561,9 @@ static const u32 gfs2_to_iflags[32] = { ...@@ -561,8 +561,9 @@ static const u32 gfs2_to_iflags[32] = {
[gfs2fl_InheritJdata] = IFLAG_INHERITJDATA, [gfs2fl_InheritJdata] = IFLAG_INHERITJDATA,
}; };
static int gfs2_get_flags(struct inode *inode, u32 __user *ptr) static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
{ {
struct inode *inode = filp->f_dentry->d_inode;
struct gfs2_inode *ip = inode->u.generic_ip; struct gfs2_inode *ip = inode->u.generic_ip;
struct gfs2_holder gh; struct gfs2_holder gh;
int error; int error;
...@@ -600,8 +601,9 @@ static int gfs2_get_flags(struct inode *inode, u32 __user *ptr) ...@@ -600,8 +601,9 @@ static int gfs2_get_flags(struct inode *inode, u32 __user *ptr)
* @mask: Indicates which flags are valid * @mask: Indicates which flags are valid
* *
*/ */
static int do_gfs2_set_flags(struct inode *inode, u32 reqflags, u32 mask) static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask)
{ {
struct inode *inode = filp->f_dentry->d_inode;
struct gfs2_inode *ip = inode->u.generic_ip; struct gfs2_inode *ip = inode->u.generic_ip;
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = ip->i_sbd;
struct buffer_head *bh; struct buffer_head *bh;
...@@ -659,23 +661,22 @@ static int do_gfs2_set_flags(struct inode *inode, u32 reqflags, u32 mask) ...@@ -659,23 +661,22 @@ static int do_gfs2_set_flags(struct inode *inode, u32 reqflags, u32 mask)
return error; return error;
} }
static int gfs2_set_flags(struct inode *inode, u32 __user *ptr) static int gfs2_set_flags(struct file *filp, u32 __user *ptr)
{ {
u32 iflags, gfsflags; u32 iflags, gfsflags;
if (get_user(iflags, ptr)) if (get_user(iflags, ptr))
return -EFAULT; return -EFAULT;
gfsflags = iflags_cvt(iflags_to_gfs2, iflags); gfsflags = iflags_cvt(iflags_to_gfs2, iflags);
return do_gfs2_set_flags(inode, gfsflags, ~0); return do_gfs2_set_flags(filp, gfsflags, ~0);
} }
int gfs2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
unsigned long arg)
{ {
switch(cmd) { switch(cmd) {
case IFLAGS_GET_IOC: case IFLAGS_GET_IOC:
return gfs2_get_flags(inode, (u32 __user *)arg); return gfs2_get_flags(filp, (u32 __user *)arg);
case IFLAGS_SET_IOC: case IFLAGS_SET_IOC:
return gfs2_set_flags(inode, (u32 __user *)arg); return gfs2_set_flags(filp, (u32 __user *)arg);
} }
return -ENOTTY; return -ENOTTY;
} }
...@@ -808,7 +809,7 @@ static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync) ...@@ -808,7 +809,7 @@ static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync)
{ {
struct gfs2_inode *ip = dentry->d_inode->u.generic_ip; struct gfs2_inode *ip = dentry->d_inode->u.generic_ip;
gfs2_log_flush_glock(ip->i_gl); gfs2_log_flush(ip->i_gl->gl_sbd, ip->i_gl);
return 0; return 0;
} }
...@@ -974,7 +975,7 @@ struct file_operations gfs2_file_fops = { ...@@ -974,7 +975,7 @@ struct file_operations gfs2_file_fops = {
.write = generic_file_write, .write = generic_file_write,
.writev = generic_file_writev, .writev = generic_file_writev,
.aio_write = generic_file_aio_write, .aio_write = generic_file_aio_write,
.ioctl = gfs2_ioctl, .unlocked_ioctl = gfs2_ioctl,
.mmap = gfs2_mmap, .mmap = gfs2_mmap,
.open = gfs2_open, .open = gfs2_open,
.release = gfs2_close, .release = gfs2_close,
...@@ -988,7 +989,7 @@ struct file_operations gfs2_file_fops = { ...@@ -988,7 +989,7 @@ struct file_operations gfs2_file_fops = {
struct file_operations gfs2_dir_fops = { struct file_operations gfs2_dir_fops = {
.readdir = gfs2_readdir, .readdir = gfs2_readdir,
.ioctl = gfs2_ioctl, .unlocked_ioctl = gfs2_ioctl,
.open = gfs2_open, .open = gfs2_open,
.release = gfs2_close, .release = gfs2_close,
.fsync = gfs2_fsync, .fsync = gfs2_fsync,
......
...@@ -276,8 +276,8 @@ static struct inode *gfs2_lookup_root(struct gfs2_sbd *sdp, ...@@ -276,8 +276,8 @@ static struct inode *gfs2_lookup_root(struct gfs2_sbd *sdp,
struct gfs2_inode *ip; struct gfs2_inode *ip;
struct inode *inode; struct inode *inode;
error = gfs2_glock_get(sdp, inum->no_addr, error = gfs2_glock_get(sdp, inum->no_addr, &gfs2_inode_glops,
&gfs2_inode_glops, CREATE, &gl); CREATE, &gl);
if (!error) { if (!error) {
error = gfs2_inode_get(gl, inum, CREATE, &ip); error = gfs2_inode_get(gl, inum, CREATE, &ip);
if (!error) { if (!error) {
......
...@@ -53,7 +53,7 @@ static int gfs2_write_inode(struct inode *inode, int sync) ...@@ -53,7 +53,7 @@ static int gfs2_write_inode(struct inode *inode, int sync)
if (current->flags & PF_MEMALLOC) if (current->flags & PF_MEMALLOC)
return 0; return 0;
if (ip && sync) if (ip && sync)
gfs2_log_flush_glock(ip->i_gl); gfs2_log_flush(ip->i_gl->gl_sbd, ip->i_gl);
return 0; return 0;
} }
...@@ -121,10 +121,8 @@ static void gfs2_put_super(struct super_block *sb) ...@@ -121,10 +121,8 @@ static void gfs2_put_super(struct super_block *sb)
} }
gfs2_glock_dq_uninit(&sdp->sd_live_gh); gfs2_glock_dq_uninit(&sdp->sd_live_gh);
gfs2_clear_rgrpd(sdp); gfs2_clear_rgrpd(sdp);
gfs2_jindex_free(sdp); gfs2_jindex_free(sdp);
/* Take apart glock structures and buffer lists */ /* Take apart glock structures and buffer lists */
gfs2_gl_hash_clear(sdp, WAIT); gfs2_gl_hash_clear(sdp, WAIT);
...@@ -135,10 +133,6 @@ static void gfs2_put_super(struct super_block *sb) ...@@ -135,10 +133,6 @@ static void gfs2_put_super(struct super_block *sb)
gfs2_sys_fs_del(sdp); gfs2_sys_fs_del(sdp);
/* Get rid of any extra inodes */
while (invalidate_inodes(sb))
yield();
vfree(sdp); vfree(sdp);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
...@@ -149,13 +143,13 @@ static void gfs2_put_super(struct super_block *sb) ...@@ -149,13 +143,13 @@ static void gfs2_put_super(struct super_block *sb)
* @sb: the filesystem * @sb: the filesystem
* *
* This function is called every time sync(2) is called. * This function is called every time sync(2) is called.
* After this exits, all dirty buffers and synced. * After this exits, all dirty buffers are synced.
*/ */
static void gfs2_write_super(struct super_block *sb) static void gfs2_write_super(struct super_block *sb)
{ {
struct gfs2_sbd *sdp = sb->s_fs_info; struct gfs2_sbd *sdp = sb->s_fs_info;
gfs2_log_flush(sdp); gfs2_log_flush(sdp, NULL);
} }
/** /**
......
...@@ -749,7 +749,7 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda) ...@@ -749,7 +749,7 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
while (qx--) while (qx--)
gfs2_glock_dq_uninit(&ghs[qx]); gfs2_glock_dq_uninit(&ghs[qx]);
kfree(ghs); kfree(ghs);
gfs2_log_flush_glock(ip->i_gl); gfs2_log_flush(ip->i_gl->gl_sbd, ip->i_gl);
return error; return error;
} }
......
...@@ -120,7 +120,7 @@ void gfs2_trans_end(struct gfs2_sbd *sdp) ...@@ -120,7 +120,7 @@ void gfs2_trans_end(struct gfs2_sbd *sdp)
kfree(tr); kfree(tr);
if (sdp->sd_vfs->s_flags & MS_SYNCHRONOUS) if (sdp->sd_vfs->s_flags & MS_SYNCHRONOUS)
gfs2_log_flush(sdp); gfs2_log_flush(sdp, NULL);
} }
void gfs2_trans_add_gl(struct gfs2_glock *gl) void gfs2_trans_add_gl(struct gfs2_glock *gl)
......
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