Skip to content

Commit e07dd2a

Browse files
committed
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: (56 commits) [GFS2] Allow journal recovery on read-only mount [GFS2] Lockup on error [GFS2] Fix page_mkwrite truncation race path [GFS2] Fix typo [GFS2] Fix write alloc required shortcut calculation [GFS2] gfs2_alloc_required performance [GFS2] Remove unneeded i_spin [GFS2] Reduce inode size by moving i_alloc out of line [GFS2] Fix assert in log code [GFS2] Fix problems relating to execution of files on GFS2 [GFS2] Initialize extent_list earlier [GFS2] Allow page migration for writeback and ordered pages [GFS2] Remove unused variable [GFS2] Fix log block mapper [GFS2] Minor correction [GFS2] Eliminate the no longer needed sd_statfs_mutex [GFS2] Incremental patch to fix compiler warning [GFS2] Function meta_read optimization [GFS2] Only fetch the dinode once in block_map [GFS2] Reorganize function gfs2_glmutex_lock ...
2 parents eba0e31 + 7bc5c41 commit e07dd2a

40 files changed

+1092
-1109
lines changed

fs/gfs2/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ obj-$(CONFIG_GFS2_FS) += gfs2.o
22
gfs2-y := acl.o bmap.o daemon.o dir.o eaops.o eattr.o glock.o \
33
glops.o inode.o lm.o log.o lops.o locking.o main.o meta_io.o \
44
mount.o ops_address.o ops_dentry.o ops_export.o ops_file.o \
5-
ops_fstype.o ops_inode.o ops_super.o ops_vm.o quota.o \
5+
ops_fstype.o ops_inode.o ops_super.o quota.o \
66
recovery.o rgrp.o super.o sys.o trans.o util.o
77

88
obj-$(CONFIG_GFS2_FS_LOCKING_NOLOCK) += locking/nolock/

fs/gfs2/bmap.c

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ struct strip_mine {
5959
static int gfs2_unstuffer_page(struct gfs2_inode *ip, struct buffer_head *dibh,
6060
u64 block, struct page *page)
6161
{
62-
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
6362
struct inode *inode = &ip->i_inode;
6463
struct buffer_head *bh;
6564
int release = 0;
@@ -95,7 +94,7 @@ static int gfs2_unstuffer_page(struct gfs2_inode *ip, struct buffer_head *dibh,
9594
set_buffer_uptodate(bh);
9695
if (!gfs2_is_jdata(ip))
9796
mark_buffer_dirty(bh);
98-
if (sdp->sd_args.ar_data == GFS2_DATA_ORDERED || gfs2_is_jdata(ip))
97+
if (!gfs2_is_writeback(ip))
9998
gfs2_trans_add_bh(ip->i_gl, bh, 0);
10099

101100
if (release) {
@@ -453,8 +452,8 @@ static inline void bmap_unlock(struct inode *inode, int create)
453452
* Returns: errno
454453
*/
455454

456-
int gfs2_block_map(struct inode *inode, u64 lblock, int create,
457-
struct buffer_head *bh_map)
455+
int gfs2_block_map(struct inode *inode, sector_t lblock,
456+
struct buffer_head *bh_map, int create)
458457
{
459458
struct gfs2_inode *ip = GFS2_I(inode);
460459
struct gfs2_sbd *sdp = GFS2_SB(inode);
@@ -470,6 +469,7 @@ int gfs2_block_map(struct inode *inode, u64 lblock, int create,
470469
unsigned int maxlen = bh_map->b_size >> inode->i_blkbits;
471470
struct metapath mp;
472471
u64 size;
472+
struct buffer_head *dibh = NULL;
473473

474474
BUG_ON(maxlen == 0);
475475

@@ -500,6 +500,8 @@ int gfs2_block_map(struct inode *inode, u64 lblock, int create,
500500
error = gfs2_meta_inode_buffer(ip, &bh);
501501
if (error)
502502
goto out_fail;
503+
dibh = bh;
504+
get_bh(dibh);
503505

504506
for (x = 0; x < end_of_metadata; x++) {
505507
lookup_block(ip, bh, x, &mp, create, &new, &dblock);
@@ -518,13 +520,8 @@ int gfs2_block_map(struct inode *inode, u64 lblock, int create,
518520
if (boundary)
519521
set_buffer_boundary(bh_map);
520522
if (new) {
521-
struct buffer_head *dibh;
522-
error = gfs2_meta_inode_buffer(ip, &dibh);
523-
if (!error) {
524-
gfs2_trans_add_bh(ip->i_gl, dibh, 1);
525-
gfs2_dinode_out(ip, dibh->b_data);
526-
brelse(dibh);
527-
}
523+
gfs2_trans_add_bh(ip->i_gl, dibh, 1);
524+
gfs2_dinode_out(ip, dibh->b_data);
528525
set_buffer_new(bh_map);
529526
goto out_brelse;
530527
}
@@ -545,6 +542,8 @@ int gfs2_block_map(struct inode *inode, u64 lblock, int create,
545542
out_ok:
546543
error = 0;
547544
out_fail:
545+
if (dibh)
546+
brelse(dibh);
548547
bmap_unlock(inode, create);
549548
return error;
550549
}
@@ -560,7 +559,7 @@ int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsi
560559
BUG_ON(!new);
561560

562561
bh.b_size = 1 << (inode->i_blkbits + 5);
563-
ret = gfs2_block_map(inode, lblock, create, &bh);
562+
ret = gfs2_block_map(inode, lblock, &bh, create);
564563
*extlen = bh.b_size >> inode->i_blkbits;
565564
*dblock = bh.b_blocknr;
566565
if (buffer_new(&bh))
@@ -684,7 +683,7 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh,
684683
if (metadata)
685684
revokes = (height) ? sdp->sd_inptrs : sdp->sd_diptrs;
686685

687-
error = gfs2_rindex_hold(sdp, &ip->i_alloc.al_ri_gh);
686+
error = gfs2_rindex_hold(sdp, &ip->i_alloc->al_ri_gh);
688687
if (error)
689688
return error;
690689

@@ -786,7 +785,7 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh,
786785
out_rlist:
787786
gfs2_rlist_free(&rlist);
788787
out:
789-
gfs2_glock_dq_uninit(&ip->i_alloc.al_ri_gh);
788+
gfs2_glock_dq_uninit(&ip->i_alloc->al_ri_gh);
790789
return error;
791790
}
792791

@@ -879,7 +878,6 @@ static int gfs2_block_truncate_page(struct address_space *mapping)
879878
{
880879
struct inode *inode = mapping->host;
881880
struct gfs2_inode *ip = GFS2_I(inode);
882-
struct gfs2_sbd *sdp = GFS2_SB(inode);
883881
loff_t from = inode->i_size;
884882
unsigned long index = from >> PAGE_CACHE_SHIFT;
885883
unsigned offset = from & (PAGE_CACHE_SIZE-1);
@@ -911,7 +909,7 @@ static int gfs2_block_truncate_page(struct address_space *mapping)
911909
err = 0;
912910

913911
if (!buffer_mapped(bh)) {
914-
gfs2_get_block(inode, iblock, bh, 0);
912+
gfs2_block_map(inode, iblock, bh, 0);
915913
/* unmapped? It's a hole - nothing to do */
916914
if (!buffer_mapped(bh))
917915
goto unlock;
@@ -931,7 +929,7 @@ static int gfs2_block_truncate_page(struct address_space *mapping)
931929
err = 0;
932930
}
933931

934-
if (sdp->sd_args.ar_data == GFS2_DATA_ORDERED || gfs2_is_jdata(ip))
932+
if (!gfs2_is_writeback(ip))
935933
gfs2_trans_add_bh(ip->i_gl, bh, 0);
936934

937935
zero_user_page(page, offset, length, KM_USER0);
@@ -1224,8 +1222,13 @@ int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset,
12241222
do_div(lblock_stop, bsize);
12251223
} else {
12261224
unsigned int shift = sdp->sd_sb.sb_bsize_shift;
1225+
u64 end_of_file = (ip->i_di.di_size + sdp->sd_sb.sb_bsize - 1) >> shift;
12271226
lblock = offset >> shift;
12281227
lblock_stop = (offset + len + sdp->sd_sb.sb_bsize - 1) >> shift;
1228+
if (lblock_stop > end_of_file) {
1229+
*alloc_required = 1;
1230+
return 0;
1231+
}
12291232
}
12301233

12311234
for (; lblock < lblock_stop; lblock += extlen) {

fs/gfs2/bmap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct gfs2_inode;
1515
struct page;
1616

1717
int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page);
18-
int gfs2_block_map(struct inode *inode, u64 lblock, int create, struct buffer_head *bh);
18+
int gfs2_block_map(struct inode *inode, sector_t lblock, struct buffer_head *bh, int create);
1919
int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsigned *extlen);
2020

2121
int gfs2_truncatei(struct gfs2_inode *ip, u64 size);

fs/gfs2/daemon.c

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -82,56 +82,6 @@ int gfs2_recoverd(void *data)
8282
return 0;
8383
}
8484

85-
/**
86-
* gfs2_logd - Update log tail as Active Items get flushed to in-place blocks
87-
* @sdp: Pointer to GFS2 superblock
88-
*
89-
* Also, periodically check to make sure that we're using the most recent
90-
* journal index.
91-
*/
92-
93-
int gfs2_logd(void *data)
94-
{
95-
struct gfs2_sbd *sdp = data;
96-
struct gfs2_holder ji_gh;
97-
unsigned long t;
98-
int need_flush;
99-
100-
while (!kthread_should_stop()) {
101-
/* Advance the log tail */
102-
103-
t = sdp->sd_log_flush_time +
104-
gfs2_tune_get(sdp, gt_log_flush_secs) * HZ;
105-
106-
gfs2_ail1_empty(sdp, DIO_ALL);
107-
gfs2_log_lock(sdp);
108-
need_flush = sdp->sd_log_num_buf > gfs2_tune_get(sdp, gt_incore_log_blocks);
109-
gfs2_log_unlock(sdp);
110-
if (need_flush || time_after_eq(jiffies, t)) {
111-
gfs2_log_flush(sdp, NULL);
112-
sdp->sd_log_flush_time = jiffies;
113-
}
114-
115-
/* Check for latest journal index */
116-
117-
t = sdp->sd_jindex_refresh_time +
118-
gfs2_tune_get(sdp, gt_jindex_refresh_secs) * HZ;
119-
120-
if (time_after_eq(jiffies, t)) {
121-
if (!gfs2_jindex_hold(sdp, &ji_gh))
122-
gfs2_glock_dq_uninit(&ji_gh);
123-
sdp->sd_jindex_refresh_time = jiffies;
124-
}
125-
126-
t = gfs2_tune_get(sdp, gt_logd_secs) * HZ;
127-
if (freezing(current))
128-
refrigerator();
129-
schedule_timeout_interruptible(t);
130-
}
131-
132-
return 0;
133-
}
134-
13585
/**
13686
* gfs2_quotad - Write cached quota changes into the quota file
13787
* @sdp: Pointer to GFS2 superblock

fs/gfs2/daemon.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
int gfs2_glockd(void *data);
1414
int gfs2_recoverd(void *data);
15-
int gfs2_logd(void *data);
1615
int gfs2_quotad(void *data);
1716

1817
#endif /* __DAEMON_DOT_H__ */

fs/gfs2/dir.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,7 +1876,7 @@ static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len,
18761876
if (error)
18771877
goto out;
18781878

1879-
error = gfs2_rindex_hold(sdp, &dip->i_alloc.al_ri_gh);
1879+
error = gfs2_rindex_hold(sdp, &dip->i_alloc->al_ri_gh);
18801880
if (error)
18811881
goto out_qs;
18821882

@@ -1949,7 +1949,7 @@ static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len,
19491949
gfs2_glock_dq_m(rlist.rl_rgrps, rlist.rl_ghs);
19501950
out_rlist:
19511951
gfs2_rlist_free(&rlist);
1952-
gfs2_glock_dq_uninit(&dip->i_alloc.al_ri_gh);
1952+
gfs2_glock_dq_uninit(&dip->i_alloc->al_ri_gh);
19531953
out_qs:
19541954
gfs2_quota_unhold(dip);
19551955
out:

fs/gfs2/eaops.c

Lines changed: 6 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -56,46 +56,6 @@ unsigned int gfs2_ea_name2type(const char *name, const char **truncated_name)
5656
return type;
5757
}
5858

59-
static int user_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er)
60-
{
61-
struct inode *inode = &ip->i_inode;
62-
int error = permission(inode, MAY_READ, NULL);
63-
if (error)
64-
return error;
65-
66-
return gfs2_ea_get_i(ip, er);
67-
}
68-
69-
static int user_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er)
70-
{
71-
struct inode *inode = &ip->i_inode;
72-
73-
if (S_ISREG(inode->i_mode) ||
74-
(S_ISDIR(inode->i_mode) && !(inode->i_mode & S_ISVTX))) {
75-
int error = permission(inode, MAY_WRITE, NULL);
76-
if (error)
77-
return error;
78-
} else
79-
return -EPERM;
80-
81-
return gfs2_ea_set_i(ip, er);
82-
}
83-
84-
static int user_eo_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er)
85-
{
86-
struct inode *inode = &ip->i_inode;
87-
88-
if (S_ISREG(inode->i_mode) ||
89-
(S_ISDIR(inode->i_mode) && !(inode->i_mode & S_ISVTX))) {
90-
int error = permission(inode, MAY_WRITE, NULL);
91-
if (error)
92-
return error;
93-
} else
94-
return -EPERM;
95-
96-
return gfs2_ea_remove_i(ip, er);
97-
}
98-
9959
static int system_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er)
10060
{
10161
if (!GFS2_ACL_IS_ACCESS(er->er_name, er->er_name_len) &&
@@ -108,8 +68,6 @@ static int system_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er)
10868
GFS2_ACL_IS_DEFAULT(er->er_name, er->er_name_len)))
10969
return -EOPNOTSUPP;
11070

111-
112-
11371
return gfs2_ea_get_i(ip, er);
11472
}
11573

@@ -170,40 +128,10 @@ static int system_eo_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er)
170128
return gfs2_ea_remove_i(ip, er);
171129
}
172130

173-
static int security_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er)
174-
{
175-
struct inode *inode = &ip->i_inode;
176-
int error = permission(inode, MAY_READ, NULL);
177-
if (error)
178-
return error;
179-
180-
return gfs2_ea_get_i(ip, er);
181-
}
182-
183-
static int security_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er)
184-
{
185-
struct inode *inode = &ip->i_inode;
186-
int error = permission(inode, MAY_WRITE, NULL);
187-
if (error)
188-
return error;
189-
190-
return gfs2_ea_set_i(ip, er);
191-
}
192-
193-
static int security_eo_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er)
194-
{
195-
struct inode *inode = &ip->i_inode;
196-
int error = permission(inode, MAY_WRITE, NULL);
197-
if (error)
198-
return error;
199-
200-
return gfs2_ea_remove_i(ip, er);
201-
}
202-
203131
static const struct gfs2_eattr_operations gfs2_user_eaops = {
204-
.eo_get = user_eo_get,
205-
.eo_set = user_eo_set,
206-
.eo_remove = user_eo_remove,
132+
.eo_get = gfs2_ea_get_i,
133+
.eo_set = gfs2_ea_set_i,
134+
.eo_remove = gfs2_ea_remove_i,
207135
.eo_name = "user",
208136
};
209137

@@ -215,9 +143,9 @@ const struct gfs2_eattr_operations gfs2_system_eaops = {
215143
};
216144

217145
static const struct gfs2_eattr_operations gfs2_security_eaops = {
218-
.eo_get = security_eo_get,
219-
.eo_set = security_eo_set,
220-
.eo_remove = security_eo_remove,
146+
.eo_get = gfs2_ea_get_i,
147+
.eo_set = gfs2_ea_set_i,
148+
.eo_remove = gfs2_ea_remove_i,
221149
.eo_name = "security",
222150
};
223151

fs/gfs2/eattr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
14181418
static int ea_dealloc_block(struct gfs2_inode *ip)
14191419
{
14201420
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
1421-
struct gfs2_alloc *al = &ip->i_alloc;
1421+
struct gfs2_alloc *al = ip->i_alloc;
14221422
struct gfs2_rgrpd *rgd;
14231423
struct buffer_head *dibh;
14241424
int error;

0 commit comments

Comments
 (0)