diff options
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/acl.c | 6 | ||||
-rw-r--r-- | fs/gfs2/acl.h | 2 | ||||
-rw-r--r-- | fs/gfs2/aops.c | 16 | ||||
-rw-r--r-- | fs/gfs2/bmap.c | 18 | ||||
-rw-r--r-- | fs/gfs2/dentry.c | 1 | ||||
-rw-r--r-- | fs/gfs2/dir.c | 2 | ||||
-rw-r--r-- | fs/gfs2/export.c | 3 | ||||
-rw-r--r-- | fs/gfs2/file.c | 11 | ||||
-rw-r--r-- | fs/gfs2/glock.c | 3 | ||||
-rw-r--r-- | fs/gfs2/glops.c | 1 | ||||
-rw-r--r-- | fs/gfs2/incore.h | 11 | ||||
-rw-r--r-- | fs/gfs2/inode.c | 103 | ||||
-rw-r--r-- | fs/gfs2/inode.h | 4 | ||||
-rw-r--r-- | fs/gfs2/lock_dlm.c | 1 | ||||
-rw-r--r-- | fs/gfs2/log.c | 160 | ||||
-rw-r--r-- | fs/gfs2/log.h | 30 | ||||
-rw-r--r-- | fs/gfs2/lops.c | 2 | ||||
-rw-r--r-- | fs/gfs2/main.c | 2 | ||||
-rw-r--r-- | fs/gfs2/meta_io.c | 5 | ||||
-rw-r--r-- | fs/gfs2/ops_fstype.c | 19 | ||||
-rw-r--r-- | fs/gfs2/ops_inode.c | 5 | ||||
-rw-r--r-- | fs/gfs2/quota.c | 114 | ||||
-rw-r--r-- | fs/gfs2/rgrp.c | 81 | ||||
-rw-r--r-- | fs/gfs2/rgrp.h | 2 | ||||
-rw-r--r-- | fs/gfs2/super.c | 11 | ||||
-rw-r--r-- | fs/gfs2/super.h | 2 | ||||
-rw-r--r-- | fs/gfs2/sys.c | 7 | ||||
-rw-r--r-- | fs/gfs2/trans.c | 18 | ||||
-rw-r--r-- | fs/gfs2/util.c | 1 | ||||
-rw-r--r-- | fs/gfs2/xattr.c | 6 |
30 files changed, 424 insertions, 223 deletions
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c index 87ee309d4c24..48171f4c943d 100644 --- a/fs/gfs2/acl.c +++ b/fs/gfs2/acl.c | |||
@@ -236,10 +236,14 @@ static int gfs2_xattr_system_get(struct dentry *dentry, const char *name, | |||
236 | void *buffer, size_t size, int xtype) | 236 | void *buffer, size_t size, int xtype) |
237 | { | 237 | { |
238 | struct inode *inode = dentry->d_inode; | 238 | struct inode *inode = dentry->d_inode; |
239 | struct gfs2_sbd *sdp = GFS2_SB(inode); | ||
239 | struct posix_acl *acl; | 240 | struct posix_acl *acl; |
240 | int type; | 241 | int type; |
241 | int error; | 242 | int error; |
242 | 243 | ||
244 | if (!sdp->sd_args.ar_posix_acl) | ||
245 | return -EOPNOTSUPP; | ||
246 | |||
243 | type = gfs2_acl_type(name); | 247 | type = gfs2_acl_type(name); |
244 | if (type < 0) | 248 | if (type < 0) |
245 | return type; | 249 | return type; |
@@ -335,7 +339,7 @@ out: | |||
335 | return error; | 339 | return error; |
336 | } | 340 | } |
337 | 341 | ||
338 | struct xattr_handler gfs2_xattr_system_handler = { | 342 | const struct xattr_handler gfs2_xattr_system_handler = { |
339 | .prefix = XATTR_SYSTEM_PREFIX, | 343 | .prefix = XATTR_SYSTEM_PREFIX, |
340 | .flags = GFS2_EATYPE_SYS, | 344 | .flags = GFS2_EATYPE_SYS, |
341 | .get = gfs2_xattr_system_get, | 345 | .get = gfs2_xattr_system_get, |
diff --git a/fs/gfs2/acl.h b/fs/gfs2/acl.h index 9306a2e6620c..b522b0cb39ea 100644 --- a/fs/gfs2/acl.h +++ b/fs/gfs2/acl.h | |||
@@ -19,6 +19,6 @@ | |||
19 | extern int gfs2_check_acl(struct inode *inode, int mask); | 19 | extern int gfs2_check_acl(struct inode *inode, int mask); |
20 | extern int gfs2_acl_create(struct gfs2_inode *dip, struct inode *inode); | 20 | extern int gfs2_acl_create(struct gfs2_inode *dip, struct inode *inode); |
21 | extern int gfs2_acl_chmod(struct gfs2_inode *ip, struct iattr *attr); | 21 | extern int gfs2_acl_chmod(struct gfs2_inode *ip, struct iattr *attr); |
22 | extern struct xattr_handler gfs2_xattr_system_handler; | 22 | extern const struct xattr_handler gfs2_xattr_system_handler; |
23 | 23 | ||
24 | #endif /* __ACL_DOT_H__ */ | 24 | #endif /* __ACL_DOT_H__ */ |
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c index 0c1d0b82dcf1..9f8b52500d63 100644 --- a/fs/gfs2/aops.c +++ b/fs/gfs2/aops.c | |||
@@ -418,6 +418,7 @@ static int gfs2_jdata_writepages(struct address_space *mapping, | |||
418 | static int stuffed_readpage(struct gfs2_inode *ip, struct page *page) | 418 | static int stuffed_readpage(struct gfs2_inode *ip, struct page *page) |
419 | { | 419 | { |
420 | struct buffer_head *dibh; | 420 | struct buffer_head *dibh; |
421 | u64 dsize = i_size_read(&ip->i_inode); | ||
421 | void *kaddr; | 422 | void *kaddr; |
422 | int error; | 423 | int error; |
423 | 424 | ||
@@ -437,9 +438,10 @@ static int stuffed_readpage(struct gfs2_inode *ip, struct page *page) | |||
437 | return error; | 438 | return error; |
438 | 439 | ||
439 | kaddr = kmap_atomic(page, KM_USER0); | 440 | kaddr = kmap_atomic(page, KM_USER0); |
440 | memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), | 441 | if (dsize > (dibh->b_size - sizeof(struct gfs2_dinode))) |
441 | ip->i_disksize); | 442 | dsize = (dibh->b_size - sizeof(struct gfs2_dinode)); |
442 | memset(kaddr + ip->i_disksize, 0, PAGE_CACHE_SIZE - ip->i_disksize); | 443 | memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), dsize); |
444 | memset(kaddr + dsize, 0, PAGE_CACHE_SIZE - dsize); | ||
443 | kunmap_atomic(kaddr, KM_USER0); | 445 | kunmap_atomic(kaddr, KM_USER0); |
444 | flush_dcache_page(page); | 446 | flush_dcache_page(page); |
445 | brelse(dibh); | 447 | brelse(dibh); |
@@ -698,8 +700,14 @@ out: | |||
698 | return 0; | 700 | return 0; |
699 | 701 | ||
700 | page_cache_release(page); | 702 | page_cache_release(page); |
703 | |||
704 | /* | ||
705 | * XXX(hch): the call below should probably be replaced with | ||
706 | * a call to the gfs2-specific truncate blocks helper to actually | ||
707 | * release disk blocks.. | ||
708 | */ | ||
701 | if (pos + len > ip->i_inode.i_size) | 709 | if (pos + len > ip->i_inode.i_size) |
702 | vmtruncate(&ip->i_inode, ip->i_inode.i_size); | 710 | simple_setsize(&ip->i_inode, ip->i_inode.i_size); |
703 | out_endtrans: | 711 | out_endtrans: |
704 | gfs2_trans_end(sdp); | 712 | gfs2_trans_end(sdp); |
705 | out_trans_fail: | 713 | out_trans_fail: |
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 583e823307ae..4a48c0f4b402 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/slab.h> | ||
11 | #include <linux/spinlock.h> | 10 | #include <linux/spinlock.h> |
12 | #include <linux/completion.h> | 11 | #include <linux/completion.h> |
13 | #include <linux/buffer_head.h> | 12 | #include <linux/buffer_head.h> |
@@ -72,11 +71,13 @@ static int gfs2_unstuffer_page(struct gfs2_inode *ip, struct buffer_head *dibh, | |||
72 | 71 | ||
73 | if (!PageUptodate(page)) { | 72 | if (!PageUptodate(page)) { |
74 | void *kaddr = kmap(page); | 73 | void *kaddr = kmap(page); |
74 | u64 dsize = i_size_read(inode); | ||
75 | |||
76 | if (dsize > (dibh->b_size - sizeof(struct gfs2_dinode))) | ||
77 | dsize = dibh->b_size - sizeof(struct gfs2_dinode); | ||
75 | 78 | ||
76 | memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), | 79 | memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), dsize); |
77 | ip->i_disksize); | 80 | memset(kaddr + dsize, 0, PAGE_CACHE_SIZE - dsize); |
78 | memset(kaddr + ip->i_disksize, 0, | ||
79 | PAGE_CACHE_SIZE - ip->i_disksize); | ||
80 | kunmap(page); | 81 | kunmap(page); |
81 | 82 | ||
82 | SetPageUptodate(page); | 83 | SetPageUptodate(page); |
@@ -1039,13 +1040,14 @@ static int trunc_start(struct gfs2_inode *ip, u64 size) | |||
1039 | goto out; | 1040 | goto out; |
1040 | 1041 | ||
1041 | if (gfs2_is_stuffed(ip)) { | 1042 | if (gfs2_is_stuffed(ip)) { |
1042 | ip->i_disksize = size; | 1043 | u64 dsize = size + sizeof(struct gfs2_inode); |
1043 | ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; | 1044 | ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; |
1044 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); | 1045 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); |
1045 | gfs2_dinode_out(ip, dibh->b_data); | 1046 | gfs2_dinode_out(ip, dibh->b_data); |
1046 | gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode) + size); | 1047 | if (dsize > dibh->b_size) |
1048 | dsize = dibh->b_size; | ||
1049 | gfs2_buffer_clear_tail(dibh, dsize); | ||
1047 | error = 1; | 1050 | error = 1; |
1048 | |||
1049 | } else { | 1051 | } else { |
1050 | if (size & (u64)(sdp->sd_sb.sb_bsize - 1)) | 1052 | if (size & (u64)(sdp->sd_sb.sb_bsize - 1)) |
1051 | error = gfs2_block_truncate_page(ip->i_inode.i_mapping); | 1053 | error = gfs2_block_truncate_page(ip->i_inode.i_mapping); |
diff --git a/fs/gfs2/dentry.c b/fs/gfs2/dentry.c index 91beddadd388..bb7907bde3d8 100644 --- a/fs/gfs2/dentry.c +++ b/fs/gfs2/dentry.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/slab.h> | ||
11 | #include <linux/spinlock.h> | 10 | #include <linux/spinlock.h> |
12 | #include <linux/completion.h> | 11 | #include <linux/completion.h> |
13 | #include <linux/buffer_head.h> | 12 | #include <linux/buffer_head.h> |
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index 25fddc100f18..8295c5b5d4a9 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c | |||
@@ -1475,7 +1475,7 @@ struct inode *gfs2_dir_search(struct inode *dir, const struct qstr *name) | |||
1475 | inode = gfs2_inode_lookup(dir->i_sb, | 1475 | inode = gfs2_inode_lookup(dir->i_sb, |
1476 | be16_to_cpu(dent->de_type), | 1476 | be16_to_cpu(dent->de_type), |
1477 | be64_to_cpu(dent->de_inum.no_addr), | 1477 | be64_to_cpu(dent->de_inum.no_addr), |
1478 | be64_to_cpu(dent->de_inum.no_formal_ino), 0); | 1478 | be64_to_cpu(dent->de_inum.no_formal_ino)); |
1479 | brelse(bh); | 1479 | brelse(bh); |
1480 | return inode; | 1480 | return inode; |
1481 | } | 1481 | } |
diff --git a/fs/gfs2/export.c b/fs/gfs2/export.c index d15876e9aa26..dfe237a3f8ad 100644 --- a/fs/gfs2/export.c +++ b/fs/gfs2/export.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/slab.h> | ||
11 | #include <linux/spinlock.h> | 10 | #include <linux/spinlock.h> |
12 | #include <linux/completion.h> | 11 | #include <linux/completion.h> |
13 | #include <linux/buffer_head.h> | 12 | #include <linux/buffer_head.h> |
@@ -169,7 +168,7 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb, | |||
169 | if (error) | 168 | if (error) |
170 | goto fail; | 169 | goto fail; |
171 | 170 | ||
172 | inode = gfs2_inode_lookup(sb, DT_UNKNOWN, inum->no_addr, 0, 0); | 171 | inode = gfs2_inode_lookup(sb, DT_UNKNOWN, inum->no_addr, 0); |
173 | if (IS_ERR(inode)) { | 172 | if (IS_ERR(inode)) { |
174 | error = PTR_ERR(inode); | 173 | error = PTR_ERR(inode); |
175 | goto fail; | 174 | goto fail; |
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index e6dd2aec6f82..ed9a94f0ef15 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -218,6 +218,11 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask) | |||
218 | if (error) | 218 | if (error) |
219 | goto out_drop_write; | 219 | goto out_drop_write; |
220 | 220 | ||
221 | error = -EACCES; | ||
222 | if (!is_owner_or_cap(inode)) | ||
223 | goto out; | ||
224 | |||
225 | error = 0; | ||
221 | flags = ip->i_diskflags; | 226 | flags = ip->i_diskflags; |
222 | new_flags = (flags & ~mask) | (reqflags & mask); | 227 | new_flags = (flags & ~mask) | (reqflags & mask); |
223 | if ((new_flags ^ flags) == 0) | 228 | if ((new_flags ^ flags) == 0) |
@@ -275,8 +280,10 @@ static int gfs2_set_flags(struct file *filp, u32 __user *ptr) | |||
275 | { | 280 | { |
276 | struct inode *inode = filp->f_path.dentry->d_inode; | 281 | struct inode *inode = filp->f_path.dentry->d_inode; |
277 | u32 fsflags, gfsflags; | 282 | u32 fsflags, gfsflags; |
283 | |||
278 | if (get_user(fsflags, ptr)) | 284 | if (get_user(fsflags, ptr)) |
279 | return -EFAULT; | 285 | return -EFAULT; |
286 | |||
280 | gfsflags = fsflags_cvt(fsflags_to_gfs2, fsflags); | 287 | gfsflags = fsflags_cvt(fsflags_to_gfs2, fsflags); |
281 | if (!S_ISDIR(inode->i_mode)) { | 288 | if (!S_ISDIR(inode->i_mode)) { |
282 | if (gfsflags & GFS2_DIF_INHERIT_JDATA) | 289 | if (gfsflags & GFS2_DIF_INHERIT_JDATA) |
@@ -547,9 +554,9 @@ static int gfs2_close(struct inode *inode, struct file *file) | |||
547 | * Returns: errno | 554 | * Returns: errno |
548 | */ | 555 | */ |
549 | 556 | ||
550 | static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync) | 557 | static int gfs2_fsync(struct file *file, int datasync) |
551 | { | 558 | { |
552 | struct inode *inode = dentry->d_inode; | 559 | struct inode *inode = file->f_mapping->host; |
553 | int sync_state = inode->i_state & (I_DIRTY_SYNC|I_DIRTY_DATASYNC); | 560 | int sync_state = inode->i_state & (I_DIRTY_SYNC|I_DIRTY_DATASYNC); |
554 | int ret = 0; | 561 | int ret = 0; |
555 | 562 | ||
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 454d4b4eb36b..ddcdbf493536 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -855,6 +855,9 @@ void gfs2_holder_reinit(unsigned int state, unsigned flags, struct gfs2_holder * | |||
855 | gh->gh_flags = flags; | 855 | gh->gh_flags = flags; |
856 | gh->gh_iflags = 0; | 856 | gh->gh_iflags = 0; |
857 | gh->gh_ip = (unsigned long)__builtin_return_address(0); | 857 | gh->gh_ip = (unsigned long)__builtin_return_address(0); |
858 | if (gh->gh_owner_pid) | ||
859 | put_pid(gh->gh_owner_pid); | ||
860 | gh->gh_owner_pid = get_pid(task_pid(current)); | ||
858 | } | 861 | } |
859 | 862 | ||
860 | /** | 863 | /** |
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index 38e3749d476c..49f97d3bb690 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/slab.h> | ||
11 | #include <linux/spinlock.h> | 10 | #include <linux/spinlock.h> |
12 | #include <linux/completion.h> | 11 | #include <linux/completion.h> |
13 | #include <linux/buffer_head.h> | 12 | #include <linux/buffer_head.h> |
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 3aac46f6853e..b5d7363b22da 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -439,9 +439,6 @@ struct gfs2_args { | |||
439 | struct gfs2_tune { | 439 | struct gfs2_tune { |
440 | spinlock_t gt_spin; | 440 | spinlock_t gt_spin; |
441 | 441 | ||
442 | unsigned int gt_incore_log_blocks; | ||
443 | unsigned int gt_log_flush_secs; | ||
444 | |||
445 | unsigned int gt_logd_secs; | 442 | unsigned int gt_logd_secs; |
446 | 443 | ||
447 | unsigned int gt_quota_simul_sync; /* Max quotavals to sync at once */ | 444 | unsigned int gt_quota_simul_sync; /* Max quotavals to sync at once */ |
@@ -462,6 +459,7 @@ enum { | |||
462 | SDF_SHUTDOWN = 2, | 459 | SDF_SHUTDOWN = 2, |
463 | SDF_NOBARRIERS = 3, | 460 | SDF_NOBARRIERS = 3, |
464 | SDF_NORECOVERY = 4, | 461 | SDF_NORECOVERY = 4, |
462 | SDF_DEMOTE = 5, | ||
465 | }; | 463 | }; |
466 | 464 | ||
467 | #define GFS2_FSNAME_LEN 256 | 465 | #define GFS2_FSNAME_LEN 256 |
@@ -618,6 +616,7 @@ struct gfs2_sbd { | |||
618 | unsigned int sd_log_commited_databuf; | 616 | unsigned int sd_log_commited_databuf; |
619 | int sd_log_commited_revoke; | 617 | int sd_log_commited_revoke; |
620 | 618 | ||
619 | atomic_t sd_log_pinned; | ||
621 | unsigned int sd_log_num_buf; | 620 | unsigned int sd_log_num_buf; |
622 | unsigned int sd_log_num_revoke; | 621 | unsigned int sd_log_num_revoke; |
623 | unsigned int sd_log_num_rg; | 622 | unsigned int sd_log_num_rg; |
@@ -629,15 +628,17 @@ struct gfs2_sbd { | |||
629 | struct list_head sd_log_le_databuf; | 628 | struct list_head sd_log_le_databuf; |
630 | struct list_head sd_log_le_ordered; | 629 | struct list_head sd_log_le_ordered; |
631 | 630 | ||
631 | atomic_t sd_log_thresh1; | ||
632 | atomic_t sd_log_thresh2; | ||
632 | atomic_t sd_log_blks_free; | 633 | atomic_t sd_log_blks_free; |
633 | struct mutex sd_log_reserve_mutex; | 634 | wait_queue_head_t sd_log_waitq; |
635 | wait_queue_head_t sd_logd_waitq; | ||
634 | 636 | ||
635 | u64 sd_log_sequence; | 637 | u64 sd_log_sequence; |
636 | unsigned int sd_log_head; | 638 | unsigned int sd_log_head; |
637 | unsigned int sd_log_tail; | 639 | unsigned int sd_log_tail; |
638 | int sd_log_idle; | 640 | int sd_log_idle; |
639 | 641 | ||
640 | unsigned long sd_log_flush_time; | ||
641 | struct rw_semaphore sd_log_flush_lock; | 642 | struct rw_semaphore sd_log_flush_lock; |
642 | atomic_t sd_log_in_flight; | 643 | atomic_t sd_log_in_flight; |
643 | wait_queue_head_t sd_log_flush_wait; | 644 | wait_queue_head_t sd_log_flush_wait; |
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index b1bf2694fb2b..b5612cbb62a5 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -158,7 +158,6 @@ void gfs2_set_iop(struct inode *inode) | |||
158 | * @sb: The super block | 158 | * @sb: The super block |
159 | * @no_addr: The inode number | 159 | * @no_addr: The inode number |
160 | * @type: The type of the inode | 160 | * @type: The type of the inode |
161 | * @skip_freeing: set this not return an inode if it is currently being freed. | ||
162 | * | 161 | * |
163 | * Returns: A VFS inode, or an error | 162 | * Returns: A VFS inode, or an error |
164 | */ | 163 | */ |
@@ -166,17 +165,14 @@ void gfs2_set_iop(struct inode *inode) | |||
166 | struct inode *gfs2_inode_lookup(struct super_block *sb, | 165 | struct inode *gfs2_inode_lookup(struct super_block *sb, |
167 | unsigned int type, | 166 | unsigned int type, |
168 | u64 no_addr, | 167 | u64 no_addr, |
169 | u64 no_formal_ino, int skip_freeing) | 168 | u64 no_formal_ino) |
170 | { | 169 | { |
171 | struct inode *inode; | 170 | struct inode *inode; |
172 | struct gfs2_inode *ip; | 171 | struct gfs2_inode *ip; |
173 | struct gfs2_glock *io_gl; | 172 | struct gfs2_glock *io_gl; |
174 | int error; | 173 | int error; |
175 | 174 | ||
176 | if (skip_freeing) | 175 | inode = gfs2_iget(sb, no_addr); |
177 | inode = gfs2_iget_skip(sb, no_addr); | ||
178 | else | ||
179 | inode = gfs2_iget(sb, no_addr); | ||
180 | ip = GFS2_I(inode); | 176 | ip = GFS2_I(inode); |
181 | 177 | ||
182 | if (!inode) | 178 | if (!inode) |
@@ -234,11 +230,102 @@ fail_glock: | |||
234 | fail_iopen: | 230 | fail_iopen: |
235 | gfs2_glock_put(io_gl); | 231 | gfs2_glock_put(io_gl); |
236 | fail_put: | 232 | fail_put: |
233 | if (inode->i_state & I_NEW) | ||
234 | ip->i_gl->gl_object = NULL; | ||
235 | gfs2_glock_put(ip->i_gl); | ||
236 | fail: | ||
237 | if (inode->i_state & I_NEW) | ||
238 | iget_failed(inode); | ||
239 | else | ||
240 | iput(inode); | ||
241 | return ERR_PTR(error); | ||
242 | } | ||
243 | |||
244 | /** | ||
245 | * gfs2_process_unlinked_inode - Lookup an unlinked inode for reclamation | ||
246 | * and try to reclaim it by doing iput. | ||
247 | * | ||
248 | * This function assumes no rgrp locks are currently held. | ||
249 | * | ||
250 | * @sb: The super block | ||
251 | * no_addr: The inode number | ||
252 | * | ||
253 | */ | ||
254 | |||
255 | void gfs2_process_unlinked_inode(struct super_block *sb, u64 no_addr) | ||
256 | { | ||
257 | struct gfs2_sbd *sdp; | ||
258 | struct gfs2_inode *ip; | ||
259 | struct gfs2_glock *io_gl; | ||
260 | int error; | ||
261 | struct gfs2_holder gh; | ||
262 | struct inode *inode; | ||
263 | |||
264 | inode = gfs2_iget_skip(sb, no_addr); | ||
265 | |||
266 | if (!inode) | ||
267 | return; | ||
268 | |||
269 | /* If it's not a new inode, someone's using it, so leave it alone. */ | ||
270 | if (!(inode->i_state & I_NEW)) { | ||
271 | iput(inode); | ||
272 | return; | ||
273 | } | ||
274 | |||
275 | ip = GFS2_I(inode); | ||
276 | sdp = GFS2_SB(inode); | ||
277 | ip->i_no_formal_ino = -1; | ||
278 | |||
279 | error = gfs2_glock_get(sdp, no_addr, &gfs2_inode_glops, CREATE, &ip->i_gl); | ||
280 | if (unlikely(error)) | ||
281 | goto fail; | ||
282 | ip->i_gl->gl_object = ip; | ||
283 | |||
284 | error = gfs2_glock_get(sdp, no_addr, &gfs2_iopen_glops, CREATE, &io_gl); | ||
285 | if (unlikely(error)) | ||
286 | goto fail_put; | ||
287 | |||
288 | set_bit(GIF_INVALID, &ip->i_flags); | ||
289 | error = gfs2_glock_nq_init(io_gl, LM_ST_SHARED, LM_FLAG_TRY | GL_EXACT, | ||
290 | &ip->i_iopen_gh); | ||
291 | if (unlikely(error)) | ||
292 | goto fail_iopen; | ||
293 | |||
294 | ip->i_iopen_gh.gh_gl->gl_object = ip; | ||
295 | gfs2_glock_put(io_gl); | ||
296 | |||
297 | inode->i_mode = DT2IF(DT_UNKNOWN); | ||
298 | |||
299 | /* | ||
300 | * We must read the inode in order to work out its type in | ||
301 | * this case. Note that this doesn't happen often as we normally | ||
302 | * know the type beforehand. This code path only occurs during | ||
303 | * unlinked inode recovery (where it is safe to do this glock, | ||
304 | * which is not true in the general case). | ||
305 | */ | ||
306 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, LM_FLAG_TRY, | ||
307 | &gh); | ||
308 | if (unlikely(error)) | ||
309 | goto fail_glock; | ||
310 | |||
311 | /* Inode is now uptodate */ | ||
312 | gfs2_glock_dq_uninit(&gh); | ||
313 | gfs2_set_iop(inode); | ||
314 | |||
315 | /* The iput will cause it to be deleted. */ | ||
316 | iput(inode); | ||
317 | return; | ||
318 | |||
319 | fail_glock: | ||
320 | gfs2_glock_dq(&ip->i_iopen_gh); | ||
321 | fail_iopen: | ||
322 | gfs2_glock_put(io_gl); | ||
323 | fail_put: | ||
237 | ip->i_gl->gl_object = NULL; | 324 | ip->i_gl->gl_object = NULL; |
238 | gfs2_glock_put(ip->i_gl); | 325 | gfs2_glock_put(ip->i_gl); |
239 | fail: | 326 | fail: |
240 | iget_failed(inode); | 327 | iget_failed(inode); |
241 | return ERR_PTR(error); | 328 | return; |
242 | } | 329 | } |
243 | 330 | ||
244 | static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) | 331 | static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) |
@@ -862,7 +949,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, | |||
862 | goto fail_gunlock2; | 949 | goto fail_gunlock2; |
863 | 950 | ||
864 | inode = gfs2_inode_lookup(dir->i_sb, IF2DT(mode), inum.no_addr, | 951 | inode = gfs2_inode_lookup(dir->i_sb, IF2DT(mode), inum.no_addr, |
865 | inum.no_formal_ino, 0); | 952 | inum.no_formal_ino); |
866 | if (IS_ERR(inode)) | 953 | if (IS_ERR(inode)) |
867 | goto fail_gunlock2; | 954 | goto fail_gunlock2; |
868 | 955 | ||
diff --git a/fs/gfs2/inode.h b/fs/gfs2/inode.h index c341aaf67adb..300ada3f21de 100644 --- a/fs/gfs2/inode.h +++ b/fs/gfs2/inode.h | |||
@@ -83,8 +83,8 @@ static inline void gfs2_inum_out(const struct gfs2_inode *ip, | |||
83 | 83 | ||
84 | extern void gfs2_set_iop(struct inode *inode); | 84 | extern void gfs2_set_iop(struct inode *inode); |
85 | extern struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned type, | 85 | extern struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned type, |
86 | u64 no_addr, u64 no_formal_ino, | 86 | u64 no_addr, u64 no_formal_ino); |
87 | int skip_freeing); | 87 | extern void gfs2_process_unlinked_inode(struct super_block *sb, u64 no_addr); |
88 | extern struct inode *gfs2_ilookup(struct super_block *sb, u64 no_addr); | 88 | extern struct inode *gfs2_ilookup(struct super_block *sb, u64 no_addr); |
89 | 89 | ||
90 | extern int gfs2_inode_refresh(struct gfs2_inode *ip); | 90 | extern int gfs2_inode_refresh(struct gfs2_inode *ip); |
diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c index 569b46240f61..0e0470ed34c2 100644 --- a/fs/gfs2/lock_dlm.c +++ b/fs/gfs2/lock_dlm.c | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | #include <linux/fs.h> | 10 | #include <linux/fs.h> |
11 | #include <linux/dlm.h> | 11 | #include <linux/dlm.h> |
12 | #include <linux/slab.h> | ||
12 | #include <linux/types.h> | 13 | #include <linux/types.h> |
13 | #include <linux/gfs2_ondisk.h> | 14 | #include <linux/gfs2_ondisk.h> |
14 | 15 | ||
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index e5bf4b59d46e..6a857e24f947 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c | |||
@@ -168,12 +168,11 @@ static int gfs2_ail1_empty_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai, int fl | |||
168 | return list_empty(&ai->ai_ail1_list); | 168 | return list_empty(&ai->ai_ail1_list); |
169 | } | 169 | } |
170 | 170 | ||
171 | static void gfs2_ail1_start(struct gfs2_sbd *sdp, int flags) | 171 | static void gfs2_ail1_start(struct gfs2_sbd *sdp) |
172 | { | 172 | { |
173 | struct list_head *head; | 173 | struct list_head *head; |
174 | u64 sync_gen; | 174 | u64 sync_gen; |
175 | struct list_head *first; | 175 | struct gfs2_ail *ai; |
176 | struct gfs2_ail *first_ai, *ai, *tmp; | ||
177 | int done = 0; | 176 | int done = 0; |
178 | 177 | ||
179 | gfs2_log_lock(sdp); | 178 | gfs2_log_lock(sdp); |
@@ -184,21 +183,9 @@ static void gfs2_ail1_start(struct gfs2_sbd *sdp, int flags) | |||
184 | } | 183 | } |
185 | sync_gen = sdp->sd_ail_sync_gen++; | 184 | sync_gen = sdp->sd_ail_sync_gen++; |
186 | 185 | ||
187 | first = head->prev; | ||
188 | first_ai = list_entry(first, struct gfs2_ail, ai_list); | ||
189 | first_ai->ai_sync_gen = sync_gen; | ||
190 | gfs2_ail1_start_one(sdp, first_ai); /* This may drop log lock */ | ||
191 | |||
192 | if (flags & DIO_ALL) | ||
193 | first = NULL; | ||
194 | |||
195 | while(!done) { | 186 | while(!done) { |
196 | if (first && (head->prev != first || | ||
197 | gfs2_ail1_empty_one(sdp, first_ai, 0))) | ||
198 | break; | ||
199 | |||
200 | done = 1; | 187 | done = 1; |
201 | list_for_each_entry_safe_reverse(ai, tmp, head, ai_list) { | 188 | list_for_each_entry_reverse(ai, head, ai_list) { |
202 | if (ai->ai_sync_gen >= sync_gen) | 189 | if (ai->ai_sync_gen >= sync_gen) |
203 | continue; | 190 | continue; |
204 | ai->ai_sync_gen = sync_gen; | 191 | ai->ai_sync_gen = sync_gen; |
@@ -290,58 +277,57 @@ static void ail2_empty(struct gfs2_sbd *sdp, unsigned int new_tail) | |||
290 | * flush time, so we ensure that we have just enough free blocks at all | 277 | * flush time, so we ensure that we have just enough free blocks at all |
291 | * times to avoid running out during a log flush. | 278 | * times to avoid running out during a log flush. |
292 | * | 279 | * |
280 | * We no longer flush the log here, instead we wake up logd to do that | ||
281 | * for us. To avoid the thundering herd and to ensure that we deal fairly | ||
282 | * with queued waiters, we use an exclusive wait. This means that when we | ||
283 | * get woken with enough journal space to get our reservation, we need to | ||
284 | * wake the next waiter on the list. | ||
285 | * | ||
293 | * Returns: errno | 286 | * Returns: errno |
294 | */ | 287 | */ |
295 | 288 | ||
296 | int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks) | 289 | int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks) |
297 | { | 290 | { |
298 | unsigned int try = 0; | ||
299 | unsigned reserved_blks = 6 * (4096 / sdp->sd_vfs->s_blocksize); | 291 | unsigned reserved_blks = 6 * (4096 / sdp->sd_vfs->s_blocksize); |
292 | unsigned wanted = blks + reserved_blks; | ||
293 | DEFINE_WAIT(wait); | ||
294 | int did_wait = 0; | ||
295 | unsigned int free_blocks; | ||
300 | 296 | ||
301 | if (gfs2_assert_warn(sdp, blks) || | 297 | if (gfs2_assert_warn(sdp, blks) || |
302 | gfs2_assert_warn(sdp, blks <= sdp->sd_jdesc->jd_blocks)) | 298 | gfs2_assert_warn(sdp, blks <= sdp->sd_jdesc->jd_blocks)) |
303 | return -EINVAL; | 299 | return -EINVAL; |
304 | 300 | retry: | |
305 | mutex_lock(&sdp->sd_log_reserve_mutex); | 301 | free_blocks = atomic_read(&sdp->sd_log_blks_free); |
306 | gfs2_log_lock(sdp); | 302 | if (unlikely(free_blocks <= wanted)) { |
307 | while(atomic_read(&sdp->sd_log_blks_free) <= (blks + reserved_blks)) { | 303 | do { |
308 | gfs2_log_unlock(sdp); | 304 | prepare_to_wait_exclusive(&sdp->sd_log_waitq, &wait, |
309 | gfs2_ail1_empty(sdp, 0); | 305 | TASK_UNINTERRUPTIBLE); |
310 | gfs2_log_flush(sdp, NULL); | 306 | wake_up(&sdp->sd_logd_waitq); |
311 | 307 | did_wait = 1; | |
312 | if (try++) | 308 | if (atomic_read(&sdp->sd_log_blks_free) <= wanted) |
313 | gfs2_ail1_start(sdp, 0); | 309 | io_schedule(); |
314 | gfs2_log_lock(sdp); | 310 | free_blocks = atomic_read(&sdp->sd_log_blks_free); |
311 | } while(free_blocks <= wanted); | ||
312 | finish_wait(&sdp->sd_log_waitq, &wait); | ||
315 | } | 313 | } |
316 | atomic_sub(blks, &sdp->sd_log_blks_free); | 314 | if (atomic_cmpxchg(&sdp->sd_log_blks_free, free_blocks, |
315 | free_blocks - blks) != free_blocks) | ||
316 | goto retry; | ||
317 | trace_gfs2_log_blocks(sdp, -blks); | 317 | trace_gfs2_log_blocks(sdp, -blks); |
318 | gfs2_log_unlock(sdp); | 318 | |
319 | mutex_unlock(&sdp->sd_log_reserve_mutex); | 319 | /* |
320 | * If we waited, then so might others, wake them up _after_ we get | ||
321 | * our share of the log. | ||
322 | */ | ||
323 | if (unlikely(did_wait)) | ||
324 | wake_up(&sdp->sd_log_waitq); | ||
320 | 325 | ||
321 | down_read(&sdp->sd_log_flush_lock); | 326 | down_read(&sdp->sd_log_flush_lock); |
322 | 327 | ||
323 | return 0; | 328 | return 0; |
324 | } | 329 | } |
325 | 330 | ||
326 | /** | ||
327 | * gfs2_log_release - Release a given number of log blocks | ||
328 | * @sdp: The GFS2 superblock | ||
329 | * @blks: The number of blocks | ||
330 | * | ||
331 | */ | ||
332 | |||
333 | void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks) | ||
334 | { | ||
335 | |||
336 | gfs2_log_lock(sdp); | ||
337 | atomic_add(blks, &sdp->sd_log_blks_free); | ||
338 | trace_gfs2_log_blocks(sdp, blks); | ||
339 | gfs2_assert_withdraw(sdp, | ||
340 | atomic_read(&sdp->sd_log_blks_free) <= sdp->sd_jdesc->jd_blocks); | ||
341 | gfs2_log_unlock(sdp); | ||
342 | up_read(&sdp->sd_log_flush_lock); | ||
343 | } | ||
344 | |||
345 | static u64 log_bmap(struct gfs2_sbd *sdp, unsigned int lbn) | 331 | static u64 log_bmap(struct gfs2_sbd *sdp, unsigned int lbn) |
346 | { | 332 | { |
347 | struct gfs2_journal_extent *je; | 333 | struct gfs2_journal_extent *je; |
@@ -559,11 +545,10 @@ static void log_pull_tail(struct gfs2_sbd *sdp, unsigned int new_tail) | |||
559 | 545 | ||
560 | ail2_empty(sdp, new_tail); | 546 | ail2_empty(sdp, new_tail); |
561 | 547 | ||
562 | gfs2_log_lock(sdp); | ||
563 | atomic_add(dist, &sdp->sd_log_blks_free); | 548 | atomic_add(dist, &sdp->sd_log_blks_free); |
564 | trace_gfs2_log_blocks(sdp, dist); | 549 | trace_gfs2_log_blocks(sdp, dist); |
565 | gfs2_assert_withdraw(sdp, atomic_read(&sdp->sd_log_blks_free) <= sdp->sd_jdesc->jd_blocks); | 550 | gfs2_assert_withdraw(sdp, atomic_read(&sdp->sd_log_blks_free) <= |
566 | gfs2_log_unlock(sdp); | 551 | sdp->sd_jdesc->jd_blocks); |
567 | 552 | ||
568 | sdp->sd_log_tail = new_tail; | 553 | sdp->sd_log_tail = new_tail; |
569 | } | 554 | } |
@@ -615,6 +600,7 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags, int pull) | |||
615 | if (buffer_eopnotsupp(bh)) { | 600 | if (buffer_eopnotsupp(bh)) { |
616 | clear_buffer_eopnotsupp(bh); | 601 | clear_buffer_eopnotsupp(bh); |
617 | set_buffer_uptodate(bh); | 602 | set_buffer_uptodate(bh); |
603 | fs_info(sdp, "barrier sync failed - disabling barriers\n"); | ||
618 | set_bit(SDF_NOBARRIERS, &sdp->sd_flags); | 604 | set_bit(SDF_NOBARRIERS, &sdp->sd_flags); |
619 | lock_buffer(bh); | 605 | lock_buffer(bh); |
620 | skip_barrier: | 606 | skip_barrier: |
@@ -710,7 +696,7 @@ static void gfs2_ordered_wait(struct gfs2_sbd *sdp) | |||
710 | * | 696 | * |
711 | */ | 697 | */ |
712 | 698 | ||
713 | void __gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl) | 699 | void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl) |
714 | { | 700 | { |
715 | struct gfs2_ail *ai; | 701 | struct gfs2_ail *ai; |
716 | 702 | ||
@@ -822,6 +808,13 @@ static void buf_lo_incore_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr) | |||
822 | * @sdp: the filesystem | 808 | * @sdp: the filesystem |
823 | * @tr: the transaction | 809 | * @tr: the transaction |
824 | * | 810 | * |
811 | * We wake up gfs2_logd if the number of pinned blocks exceed thresh1 | ||
812 | * or the total number of used blocks (pinned blocks plus AIL blocks) | ||
813 | * is greater than thresh2. | ||
814 | * | ||
815 | * At mount time thresh1 is 1/3rd of journal size, thresh2 is 2/3rd of | ||
816 | * journal size. | ||
817 | * | ||
825 | * Returns: errno | 818 | * Returns: errno |
826 | */ | 819 | */ |
827 | 820 | ||
@@ -832,10 +825,10 @@ void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr) | |||
832 | 825 | ||
833 | up_read(&sdp->sd_log_flush_lock); | 826 | up_read(&sdp->sd_log_flush_lock); |
834 | 827 | ||
835 | gfs2_log_lock(sdp); | 828 | if (atomic_read(&sdp->sd_log_pinned) > atomic_read(&sdp->sd_log_thresh1) || |
836 | if (sdp->sd_log_num_buf > gfs2_tune_get(sdp, gt_incore_log_blocks)) | 829 | ((sdp->sd_jdesc->jd_blocks - atomic_read(&sdp->sd_log_blks_free)) > |
837 | wake_up_process(sdp->sd_logd_process); | 830 | atomic_read(&sdp->sd_log_thresh2))) |
838 | gfs2_log_unlock(sdp); | 831 | wake_up(&sdp->sd_logd_waitq); |
839 | } | 832 | } |
840 | 833 | ||
841 | /** | 834 | /** |
@@ -882,13 +875,23 @@ void gfs2_meta_syncfs(struct gfs2_sbd *sdp) | |||
882 | { | 875 | { |
883 | gfs2_log_flush(sdp, NULL); | 876 | gfs2_log_flush(sdp, NULL); |
884 | for (;;) { | 877 | for (;;) { |
885 | gfs2_ail1_start(sdp, DIO_ALL); | 878 | gfs2_ail1_start(sdp); |
886 | if (gfs2_ail1_empty(sdp, DIO_ALL)) | 879 | if (gfs2_ail1_empty(sdp, DIO_ALL)) |
887 | break; | 880 | break; |
888 | msleep(10); | 881 | msleep(10); |
889 | } | 882 | } |
890 | } | 883 | } |
891 | 884 | ||
885 | static inline int gfs2_jrnl_flush_reqd(struct gfs2_sbd *sdp) | ||
886 | { | ||
887 | return (atomic_read(&sdp->sd_log_pinned) >= atomic_read(&sdp->sd_log_thresh1)); | ||
888 | } | ||
889 | |||
890 | static inline int gfs2_ail_flush_reqd(struct gfs2_sbd *sdp) | ||
891 | { | ||
892 | unsigned int used_blocks = sdp->sd_jdesc->jd_blocks - atomic_read(&sdp->sd_log_blks_free); | ||
893 | return used_blocks >= atomic_read(&sdp->sd_log_thresh2); | ||
894 | } | ||
892 | 895 | ||
893 | /** | 896 | /** |
894 | * gfs2_logd - Update log tail as Active Items get flushed to in-place blocks | 897 | * gfs2_logd - Update log tail as Active Items get flushed to in-place blocks |
@@ -901,28 +904,43 @@ void gfs2_meta_syncfs(struct gfs2_sbd *sdp) | |||
901 | int gfs2_logd(void *data) | 904 | int gfs2_logd(void *data) |
902 | { | 905 | { |
903 | struct gfs2_sbd *sdp = data; | 906 | struct gfs2_sbd *sdp = data; |
904 | unsigned long t; | 907 | unsigned long t = 1; |
905 | int need_flush; | 908 | DEFINE_WAIT(wait); |
909 | unsigned preflush; | ||
906 | 910 | ||
907 | while (!kthread_should_stop()) { | 911 | while (!kthread_should_stop()) { |
908 | /* Advance the log tail */ | ||
909 | 912 | ||
910 | t = sdp->sd_log_flush_time + | 913 | preflush = atomic_read(&sdp->sd_log_pinned); |
911 | gfs2_tune_get(sdp, gt_log_flush_secs) * HZ; | 914 | if (gfs2_jrnl_flush_reqd(sdp) || t == 0) { |
915 | gfs2_ail1_empty(sdp, DIO_ALL); | ||
916 | gfs2_log_flush(sdp, NULL); | ||
917 | gfs2_ail1_empty(sdp, DIO_ALL); | ||
918 | } | ||
912 | 919 | ||
913 | gfs2_ail1_empty(sdp, DIO_ALL); | 920 | if (gfs2_ail_flush_reqd(sdp)) { |
914 | gfs2_log_lock(sdp); | 921 | gfs2_ail1_start(sdp); |
915 | need_flush = sdp->sd_log_num_buf > gfs2_tune_get(sdp, gt_incore_log_blocks); | 922 | io_schedule(); |
916 | gfs2_log_unlock(sdp); | 923 | gfs2_ail1_empty(sdp, 0); |
917 | if (need_flush || time_after_eq(jiffies, t)) { | ||
918 | gfs2_log_flush(sdp, NULL); | 924 | gfs2_log_flush(sdp, NULL); |
919 | sdp->sd_log_flush_time = jiffies; | 925 | gfs2_ail1_empty(sdp, DIO_ALL); |
920 | } | 926 | } |
921 | 927 | ||
928 | wake_up(&sdp->sd_log_waitq); | ||
922 | t = gfs2_tune_get(sdp, gt_logd_secs) * HZ; | 929 | t = gfs2_tune_get(sdp, gt_logd_secs) * HZ; |
923 | if (freezing(current)) | 930 | if (freezing(current)) |
924 | refrigerator(); | 931 | refrigerator(); |
925 | schedule_timeout_interruptible(t); | 932 | |
933 | do { | ||
934 | prepare_to_wait(&sdp->sd_logd_waitq, &wait, | ||
935 | TASK_UNINTERRUPTIBLE); | ||
936 | if (!gfs2_ail_flush_reqd(sdp) && | ||
937 | !gfs2_jrnl_flush_reqd(sdp) && | ||
938 | !kthread_should_stop()) | ||
939 | t = schedule_timeout(t); | ||
940 | } while(t && !gfs2_ail_flush_reqd(sdp) && | ||
941 | !gfs2_jrnl_flush_reqd(sdp) && | ||
942 | !kthread_should_stop()); | ||
943 | finish_wait(&sdp->sd_logd_waitq, &wait); | ||
926 | } | 944 | } |
927 | 945 | ||
928 | return 0; | 946 | return 0; |
diff --git a/fs/gfs2/log.h b/fs/gfs2/log.h index 7c64510ccfd2..0d007f920234 100644 --- a/fs/gfs2/log.h +++ b/fs/gfs2/log.h | |||
@@ -47,29 +47,21 @@ static inline void gfs2_log_pointers_init(struct gfs2_sbd *sdp, | |||
47 | sdp->sd_log_head = sdp->sd_log_tail = value; | 47 | sdp->sd_log_head = sdp->sd_log_tail = value; |
48 | } | 48 | } |
49 | 49 | ||
50 | unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct, | 50 | extern unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct, |
51 | unsigned int ssize); | 51 | unsigned int ssize); |
52 | 52 | ||
53 | int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks); | 53 | extern int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks); |
54 | void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks); | 54 | extern void gfs2_log_incr_head(struct gfs2_sbd *sdp); |
55 | void gfs2_log_incr_head(struct gfs2_sbd *sdp); | ||
56 | 55 | ||
57 | struct buffer_head *gfs2_log_get_buf(struct gfs2_sbd *sdp); | 56 | extern struct buffer_head *gfs2_log_get_buf(struct gfs2_sbd *sdp); |
58 | struct buffer_head *gfs2_log_fake_buf(struct gfs2_sbd *sdp, | 57 | extern struct buffer_head *gfs2_log_fake_buf(struct gfs2_sbd *sdp, |
59 | struct buffer_head *real); | 58 | struct buffer_head *real); |
60 | void __gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl); | 59 | extern void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl); |
60 | extern void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *trans); | ||
61 | extern void gfs2_remove_from_ail(struct gfs2_bufdata *bd); | ||
61 | 62 | ||
62 | static inline void gfs2_log_flush(struct gfs2_sbd *sbd, struct gfs2_glock *gl) | 63 | extern void gfs2_log_shutdown(struct gfs2_sbd *sdp); |
63 | { | 64 | extern void gfs2_meta_syncfs(struct gfs2_sbd *sdp); |
64 | if (!gl || test_bit(GLF_LFLUSH, &gl->gl_flags)) | 65 | extern int gfs2_logd(void *data); |
65 | __gfs2_log_flush(sbd, gl); | ||
66 | } | ||
67 | |||
68 | void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *trans); | ||
69 | void gfs2_remove_from_ail(struct gfs2_bufdata *bd); | ||
70 | |||
71 | void gfs2_log_shutdown(struct gfs2_sbd *sdp); | ||
72 | void gfs2_meta_syncfs(struct gfs2_sbd *sdp); | ||
73 | int gfs2_logd(void *data); | ||
74 | 66 | ||
75 | #endif /* __LOG_DOT_H__ */ | 67 | #endif /* __LOG_DOT_H__ */ |
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index adc260fbea90..bf33f822058d 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c | |||
@@ -54,6 +54,7 @@ static void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh) | |||
54 | if (bd->bd_ail) | 54 | if (bd->bd_ail) |
55 | list_move(&bd->bd_ail_st_list, &bd->bd_ail->ai_ail2_list); | 55 | list_move(&bd->bd_ail_st_list, &bd->bd_ail->ai_ail2_list); |
56 | get_bh(bh); | 56 | get_bh(bh); |
57 | atomic_inc(&sdp->sd_log_pinned); | ||
57 | trace_gfs2_pin(bd, 1); | 58 | trace_gfs2_pin(bd, 1); |
58 | } | 59 | } |
59 | 60 | ||
@@ -94,6 +95,7 @@ static void gfs2_unpin(struct gfs2_sbd *sdp, struct buffer_head *bh, | |||
94 | trace_gfs2_pin(bd, 0); | 95 | trace_gfs2_pin(bd, 0); |
95 | gfs2_log_unlock(sdp); | 96 | gfs2_log_unlock(sdp); |
96 | unlock_buffer(bh); | 97 | unlock_buffer(bh); |
98 | atomic_dec(&sdp->sd_log_pinned); | ||
97 | } | 99 | } |
98 | 100 | ||
99 | 101 | ||
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c index a88fadc704bb..fb2a5f93b7c3 100644 --- a/fs/gfs2/main.c +++ b/fs/gfs2/main.c | |||
@@ -94,7 +94,7 @@ static int __init init_gfs2_fs(void) | |||
94 | if (!gfs2_glock_cachep) | 94 | if (!gfs2_glock_cachep) |
95 | goto fail; | 95 | goto fail; |
96 | 96 | ||
97 | gfs2_glock_aspace_cachep = kmem_cache_create("gfs2_glock (aspace)", | 97 | gfs2_glock_aspace_cachep = kmem_cache_create("gfs2_glock(aspace)", |
98 | sizeof(struct gfs2_glock) + | 98 | sizeof(struct gfs2_glock) + |
99 | sizeof(struct address_space), | 99 | sizeof(struct address_space), |
100 | 0, 0, gfs2_init_gl_aspace_once); | 100 | 0, 0, gfs2_init_gl_aspace_once); |
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c index 0bb12c80937a..18176d0b75d7 100644 --- a/fs/gfs2/meta_io.c +++ b/fs/gfs2/meta_io.c | |||
@@ -34,7 +34,6 @@ | |||
34 | 34 | ||
35 | static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wbc) | 35 | static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wbc) |
36 | { | 36 | { |
37 | int err; | ||
38 | struct buffer_head *bh, *head; | 37 | struct buffer_head *bh, *head; |
39 | int nr_underway = 0; | 38 | int nr_underway = 0; |
40 | int write_op = (1 << BIO_RW_META) | ((wbc->sync_mode == WB_SYNC_ALL ? | 39 | int write_op = (1 << BIO_RW_META) | ((wbc->sync_mode == WB_SYNC_ALL ? |
@@ -86,11 +85,10 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb | |||
86 | } while (bh != head); | 85 | } while (bh != head); |
87 | unlock_page(page); | 86 | unlock_page(page); |
88 | 87 | ||
89 | err = 0; | ||
90 | if (nr_underway == 0) | 88 | if (nr_underway == 0) |
91 | end_page_writeback(page); | 89 | end_page_writeback(page); |
92 | 90 | ||
93 | return err; | 91 | return 0; |
94 | } | 92 | } |
95 | 93 | ||
96 | const struct address_space_operations gfs2_meta_aops = { | 94 | const struct address_space_operations gfs2_meta_aops = { |
@@ -313,6 +311,7 @@ void gfs2_remove_from_journal(struct buffer_head *bh, struct gfs2_trans *tr, int | |||
313 | struct gfs2_bufdata *bd = bh->b_private; | 311 | struct gfs2_bufdata *bd = bh->b_private; |
314 | 312 | ||
315 | if (test_clear_buffer_pinned(bh)) { | 313 | if (test_clear_buffer_pinned(bh)) { |
314 | atomic_dec(&sdp->sd_log_pinned); | ||
316 | list_del_init(&bd->bd_le.le_list); | 315 | list_del_init(&bd->bd_le.le_list); |
317 | if (meta) { | 316 | if (meta) { |
318 | gfs2_assert_warn(sdp, sdp->sd_log_num_buf); | 317 | gfs2_assert_warn(sdp, sdp->sd_log_num_buf); |
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index c1309ed1c496..3593b3a7290e 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -57,8 +57,6 @@ static void gfs2_tune_init(struct gfs2_tune *gt) | |||
57 | { | 57 | { |
58 | spin_lock_init(>->gt_spin); | 58 | spin_lock_init(>->gt_spin); |
59 | 59 | ||
60 | gt->gt_incore_log_blocks = 1024; | ||
61 | gt->gt_logd_secs = 1; | ||
62 | gt->gt_quota_simul_sync = 64; | 60 | gt->gt_quota_simul_sync = 64; |
63 | gt->gt_quota_warn_period = 10; | 61 | gt->gt_quota_warn_period = 10; |
64 | gt->gt_quota_scale_num = 1; | 62 | gt->gt_quota_scale_num = 1; |
@@ -101,14 +99,15 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb) | |||
101 | spin_lock_init(&sdp->sd_trunc_lock); | 99 | spin_lock_init(&sdp->sd_trunc_lock); |
102 | 100 | ||
103 | spin_lock_init(&sdp->sd_log_lock); | 101 | spin_lock_init(&sdp->sd_log_lock); |
104 | 102 | atomic_set(&sdp->sd_log_pinned, 0); | |
105 | INIT_LIST_HEAD(&sdp->sd_log_le_buf); | 103 | INIT_LIST_HEAD(&sdp->sd_log_le_buf); |
106 | INIT_LIST_HEAD(&sdp->sd_log_le_revoke); | 104 | INIT_LIST_HEAD(&sdp->sd_log_le_revoke); |
107 | INIT_LIST_HEAD(&sdp->sd_log_le_rg); | 105 | INIT_LIST_HEAD(&sdp->sd_log_le_rg); |
108 | INIT_LIST_HEAD(&sdp->sd_log_le_databuf); | 106 | INIT_LIST_HEAD(&sdp->sd_log_le_databuf); |
109 | INIT_LIST_HEAD(&sdp->sd_log_le_ordered); | 107 | INIT_LIST_HEAD(&sdp->sd_log_le_ordered); |
110 | 108 | ||
111 | mutex_init(&sdp->sd_log_reserve_mutex); | 109 | init_waitqueue_head(&sdp->sd_log_waitq); |
110 | init_waitqueue_head(&sdp->sd_logd_waitq); | ||
112 | INIT_LIST_HEAD(&sdp->sd_ail1_list); | 111 | INIT_LIST_HEAD(&sdp->sd_ail1_list); |
113 | INIT_LIST_HEAD(&sdp->sd_ail2_list); | 112 | INIT_LIST_HEAD(&sdp->sd_ail2_list); |
114 | 113 | ||
@@ -487,7 +486,7 @@ static int gfs2_lookup_root(struct super_block *sb, struct dentry **dptr, | |||
487 | struct dentry *dentry; | 486 | struct dentry *dentry; |
488 | struct inode *inode; | 487 | struct inode *inode; |
489 | 488 | ||
490 | inode = gfs2_inode_lookup(sb, DT_DIR, no_addr, 0, 0); | 489 | inode = gfs2_inode_lookup(sb, DT_DIR, no_addr, 0); |
491 | if (IS_ERR(inode)) { | 490 | if (IS_ERR(inode)) { |
492 | fs_err(sdp, "can't read in %s inode: %ld\n", name, PTR_ERR(inode)); | 491 | fs_err(sdp, "can't read in %s inode: %ld\n", name, PTR_ERR(inode)); |
493 | return PTR_ERR(inode); | 492 | return PTR_ERR(inode); |
@@ -733,6 +732,8 @@ static int init_journal(struct gfs2_sbd *sdp, int undo) | |||
733 | if (sdp->sd_args.ar_spectator) { | 732 | if (sdp->sd_args.ar_spectator) { |
734 | sdp->sd_jdesc = gfs2_jdesc_find(sdp, 0); | 733 | sdp->sd_jdesc = gfs2_jdesc_find(sdp, 0); |
735 | atomic_set(&sdp->sd_log_blks_free, sdp->sd_jdesc->jd_blocks); | 734 | atomic_set(&sdp->sd_log_blks_free, sdp->sd_jdesc->jd_blocks); |
735 | atomic_set(&sdp->sd_log_thresh1, 2*sdp->sd_jdesc->jd_blocks/5); | ||
736 | atomic_set(&sdp->sd_log_thresh2, 4*sdp->sd_jdesc->jd_blocks/5); | ||
736 | } else { | 737 | } else { |
737 | if (sdp->sd_lockstruct.ls_jid >= gfs2_jindex_size(sdp)) { | 738 | if (sdp->sd_lockstruct.ls_jid >= gfs2_jindex_size(sdp)) { |
738 | fs_err(sdp, "can't mount journal #%u\n", | 739 | fs_err(sdp, "can't mount journal #%u\n", |
@@ -770,6 +771,8 @@ static int init_journal(struct gfs2_sbd *sdp, int undo) | |||
770 | goto fail_jinode_gh; | 771 | goto fail_jinode_gh; |
771 | } | 772 | } |
772 | atomic_set(&sdp->sd_log_blks_free, sdp->sd_jdesc->jd_blocks); | 773 | atomic_set(&sdp->sd_log_blks_free, sdp->sd_jdesc->jd_blocks); |
774 | atomic_set(&sdp->sd_log_thresh1, 2*sdp->sd_jdesc->jd_blocks/5); | ||
775 | atomic_set(&sdp->sd_log_thresh2, 4*sdp->sd_jdesc->jd_blocks/5); | ||
773 | 776 | ||
774 | /* Map the extents for this journal's blocks */ | 777 | /* Map the extents for this journal's blocks */ |
775 | map_journal_extents(sdp); | 778 | map_journal_extents(sdp); |
@@ -951,8 +954,6 @@ static int init_threads(struct gfs2_sbd *sdp, int undo) | |||
951 | if (undo) | 954 | if (undo) |
952 | goto fail_quotad; | 955 | goto fail_quotad; |
953 | 956 | ||
954 | sdp->sd_log_flush_time = jiffies; | ||
955 | |||
956 | p = kthread_run(gfs2_logd, sdp, "gfs2_logd"); | 957 | p = kthread_run(gfs2_logd, sdp, "gfs2_logd"); |
957 | error = IS_ERR(p); | 958 | error = IS_ERR(p); |
958 | if (error) { | 959 | if (error) { |
@@ -1160,7 +1161,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent | |||
1160 | GFS2_BASIC_BLOCK_SHIFT; | 1161 | GFS2_BASIC_BLOCK_SHIFT; |
1161 | sdp->sd_fsb2bb = 1 << sdp->sd_fsb2bb_shift; | 1162 | sdp->sd_fsb2bb = 1 << sdp->sd_fsb2bb_shift; |
1162 | 1163 | ||
1163 | sdp->sd_tune.gt_log_flush_secs = sdp->sd_args.ar_commit; | 1164 | sdp->sd_tune.gt_logd_secs = sdp->sd_args.ar_commit; |
1164 | sdp->sd_tune.gt_quota_quantum = sdp->sd_args.ar_quota_quantum; | 1165 | sdp->sd_tune.gt_quota_quantum = sdp->sd_args.ar_quota_quantum; |
1165 | if (sdp->sd_args.ar_statfs_quantum) { | 1166 | if (sdp->sd_args.ar_statfs_quantum) { |
1166 | sdp->sd_tune.gt_statfs_slow = 0; | 1167 | sdp->sd_tune.gt_statfs_slow = 0; |
@@ -1323,7 +1324,7 @@ static int gfs2_get_sb(struct file_system_type *fs_type, int flags, | |||
1323 | memset(&args, 0, sizeof(args)); | 1324 | memset(&args, 0, sizeof(args)); |
1324 | args.ar_quota = GFS2_QUOTA_DEFAULT; | 1325 | args.ar_quota = GFS2_QUOTA_DEFAULT; |
1325 | args.ar_data = GFS2_DATA_DEFAULT; | 1326 | args.ar_data = GFS2_DATA_DEFAULT; |
1326 | args.ar_commit = 60; | 1327 | args.ar_commit = 30; |
1327 | args.ar_statfs_quantum = 30; | 1328 | args.ar_statfs_quantum = 30; |
1328 | args.ar_quota_quantum = 60; | 1329 | args.ar_quota_quantum = 60; |
1329 | args.ar_errors = GFS2_ERRORS_DEFAULT; | 1330 | args.ar_errors = GFS2_ERRORS_DEFAULT; |
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c index 4e64352d49de..98cdd05f3316 100644 --- a/fs/gfs2/ops_inode.c +++ b/fs/gfs2/ops_inode.c | |||
@@ -1071,6 +1071,9 @@ int gfs2_permission(struct inode *inode, int mask) | |||
1071 | return error; | 1071 | return error; |
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | /* | ||
1075 | * XXX: should be changed to have proper ordering by opencoding simple_setsize | ||
1076 | */ | ||
1074 | static int setattr_size(struct inode *inode, struct iattr *attr) | 1077 | static int setattr_size(struct inode *inode, struct iattr *attr) |
1075 | { | 1078 | { |
1076 | struct gfs2_inode *ip = GFS2_I(inode); | 1079 | struct gfs2_inode *ip = GFS2_I(inode); |
@@ -1081,7 +1084,7 @@ static int setattr_size(struct inode *inode, struct iattr *attr) | |||
1081 | error = gfs2_trans_begin(sdp, 0, sdp->sd_jdesc->jd_blocks); | 1084 | error = gfs2_trans_begin(sdp, 0, sdp->sd_jdesc->jd_blocks); |
1082 | if (error) | 1085 | if (error) |
1083 | return error; | 1086 | return error; |
1084 | error = vmtruncate(inode, attr->ia_size); | 1087 | error = simple_setsize(inode, attr->ia_size); |
1085 | gfs2_trans_end(sdp); | 1088 | gfs2_trans_end(sdp); |
1086 | if (error) | 1089 | if (error) |
1087 | return error; | 1090 | return error; |
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 6dbcbad6ab17..49667d68769e 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c | |||
@@ -637,15 +637,40 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc, | |||
637 | unsigned blocksize, iblock, pos; | 637 | unsigned blocksize, iblock, pos; |
638 | struct buffer_head *bh, *dibh; | 638 | struct buffer_head *bh, *dibh; |
639 | struct page *page; | 639 | struct page *page; |
640 | void *kaddr; | 640 | void *kaddr, *ptr; |
641 | struct gfs2_quota *qp; | 641 | struct gfs2_quota q, *qp; |
642 | s64 value; | 642 | int err, nbytes; |
643 | int err = -EIO; | ||
644 | u64 size; | 643 | u64 size; |
645 | 644 | ||
646 | if (gfs2_is_stuffed(ip)) | 645 | if (gfs2_is_stuffed(ip)) |
647 | gfs2_unstuff_dinode(ip, NULL); | 646 | gfs2_unstuff_dinode(ip, NULL); |
648 | 647 | ||
648 | memset(&q, 0, sizeof(struct gfs2_quota)); | ||
649 | err = gfs2_internal_read(ip, NULL, (char *)&q, &loc, sizeof(q)); | ||
650 | if (err < 0) | ||
651 | return err; | ||
652 | |||
653 | err = -EIO; | ||
654 | qp = &q; | ||
655 | qp->qu_value = be64_to_cpu(qp->qu_value); | ||
656 | qp->qu_value += change; | ||
657 | qp->qu_value = cpu_to_be64(qp->qu_value); | ||
658 | qd->qd_qb.qb_value = qp->qu_value; | ||
659 | if (fdq) { | ||
660 | if (fdq->d_fieldmask & FS_DQ_BSOFT) { | ||
661 | qp->qu_warn = cpu_to_be64(fdq->d_blk_softlimit); | ||
662 | qd->qd_qb.qb_warn = qp->qu_warn; | ||
663 | } | ||
664 | if (fdq->d_fieldmask & FS_DQ_BHARD) { | ||
665 | qp->qu_limit = cpu_to_be64(fdq->d_blk_hardlimit); | ||
666 | qd->qd_qb.qb_limit = qp->qu_limit; | ||
667 | } | ||
668 | } | ||
669 | |||
670 | /* Write the quota into the quota file on disk */ | ||
671 | ptr = qp; | ||
672 | nbytes = sizeof(struct gfs2_quota); | ||
673 | get_a_page: | ||
649 | page = grab_cache_page(mapping, index); | 674 | page = grab_cache_page(mapping, index); |
650 | if (!page) | 675 | if (!page) |
651 | return -ENOMEM; | 676 | return -ENOMEM; |
@@ -667,7 +692,12 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc, | |||
667 | if (!buffer_mapped(bh)) { | 692 | if (!buffer_mapped(bh)) { |
668 | gfs2_block_map(inode, iblock, bh, 1); | 693 | gfs2_block_map(inode, iblock, bh, 1); |
669 | if (!buffer_mapped(bh)) | 694 | if (!buffer_mapped(bh)) |
670 | goto unlock; | 695 | goto unlock_out; |
696 | /* If it's a newly allocated disk block for quota, zero it */ | ||
697 | if (buffer_new(bh)) { | ||
698 | memset(bh->b_data, 0, bh->b_size); | ||
699 | set_buffer_uptodate(bh); | ||
700 | } | ||
671 | } | 701 | } |
672 | 702 | ||
673 | if (PageUptodate(page)) | 703 | if (PageUptodate(page)) |
@@ -677,32 +707,34 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc, | |||
677 | ll_rw_block(READ_META, 1, &bh); | 707 | ll_rw_block(READ_META, 1, &bh); |
678 | wait_on_buffer(bh); | 708 | wait_on_buffer(bh); |
679 | if (!buffer_uptodate(bh)) | 709 | if (!buffer_uptodate(bh)) |
680 | goto unlock; | 710 | goto unlock_out; |
681 | } | 711 | } |
682 | 712 | ||
683 | gfs2_trans_add_bh(ip->i_gl, bh, 0); | 713 | gfs2_trans_add_bh(ip->i_gl, bh, 0); |
684 | 714 | ||
685 | kaddr = kmap_atomic(page, KM_USER0); | 715 | kaddr = kmap_atomic(page, KM_USER0); |
686 | qp = kaddr + offset; | 716 | if (offset + sizeof(struct gfs2_quota) > PAGE_CACHE_SIZE) |
687 | value = (s64)be64_to_cpu(qp->qu_value) + change; | 717 | nbytes = PAGE_CACHE_SIZE - offset; |
688 | qp->qu_value = cpu_to_be64(value); | 718 | memcpy(kaddr + offset, ptr, nbytes); |
689 | qd->qd_qb.qb_value = qp->qu_value; | ||
690 | if (fdq) { | ||
691 | if (fdq->d_fieldmask & FS_DQ_BSOFT) { | ||
692 | qp->qu_warn = cpu_to_be64(fdq->d_blk_softlimit); | ||
693 | qd->qd_qb.qb_warn = qp->qu_warn; | ||
694 | } | ||
695 | if (fdq->d_fieldmask & FS_DQ_BHARD) { | ||
696 | qp->qu_limit = cpu_to_be64(fdq->d_blk_hardlimit); | ||
697 | qd->qd_qb.qb_limit = qp->qu_limit; | ||
698 | } | ||
699 | } | ||
700 | flush_dcache_page(page); | 719 | flush_dcache_page(page); |
701 | kunmap_atomic(kaddr, KM_USER0); | 720 | kunmap_atomic(kaddr, KM_USER0); |
721 | unlock_page(page); | ||
722 | page_cache_release(page); | ||
702 | 723 | ||
724 | /* If quota straddles page boundary, we need to update the rest of the | ||
725 | * quota at the beginning of the next page */ | ||
726 | if (offset != 0) { /* first page, offset is closer to PAGE_CACHE_SIZE */ | ||
727 | ptr = ptr + nbytes; | ||
728 | nbytes = sizeof(struct gfs2_quota) - nbytes; | ||
729 | offset = 0; | ||
730 | index++; | ||
731 | goto get_a_page; | ||
732 | } | ||
733 | |||
734 | /* Update the disk inode timestamp and size (if extended) */ | ||
703 | err = gfs2_meta_inode_buffer(ip, &dibh); | 735 | err = gfs2_meta_inode_buffer(ip, &dibh); |
704 | if (err) | 736 | if (err) |
705 | goto unlock; | 737 | goto out; |
706 | 738 | ||
707 | size = loc + sizeof(struct gfs2_quota); | 739 | size = loc + sizeof(struct gfs2_quota); |
708 | if (size > inode->i_size) { | 740 | if (size > inode->i_size) { |
@@ -715,7 +747,9 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc, | |||
715 | brelse(dibh); | 747 | brelse(dibh); |
716 | mark_inode_dirty(inode); | 748 | mark_inode_dirty(inode); |
717 | 749 | ||
718 | unlock: | 750 | out: |
751 | return err; | ||
752 | unlock_out: | ||
719 | unlock_page(page); | 753 | unlock_page(page); |
720 | page_cache_release(page); | 754 | page_cache_release(page); |
721 | return err; | 755 | return err; |
@@ -779,8 +813,10 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda) | |||
779 | * rgrp since it won't be allocated during the transaction | 813 | * rgrp since it won't be allocated during the transaction |
780 | */ | 814 | */ |
781 | al->al_requested = 1; | 815 | al->al_requested = 1; |
782 | /* +1 in the end for block requested above for unstuffing */ | 816 | /* +3 in the end for unstuffing block, inode size update block |
783 | blocks = num_qd * data_blocks + RES_DINODE + num_qd + 1; | 817 | * and another block in case quota straddles page boundary and |
818 | * two blocks need to be updated instead of 1 */ | ||
819 | blocks = num_qd * data_blocks + RES_DINODE + num_qd + 3; | ||
784 | 820 | ||
785 | if (nalloc) | 821 | if (nalloc) |
786 | al->al_requested += nalloc * (data_blocks + ind_blocks); | 822 | al->al_requested += nalloc * (data_blocks + ind_blocks); |
@@ -1418,10 +1454,18 @@ static int gfs2_quota_get_xstate(struct super_block *sb, | |||
1418 | 1454 | ||
1419 | memset(fqs, 0, sizeof(struct fs_quota_stat)); | 1455 | memset(fqs, 0, sizeof(struct fs_quota_stat)); |
1420 | fqs->qs_version = FS_QSTAT_VERSION; | 1456 | fqs->qs_version = FS_QSTAT_VERSION; |
1421 | if (sdp->sd_args.ar_quota == GFS2_QUOTA_ON) | 1457 | |
1422 | fqs->qs_flags = (XFS_QUOTA_UDQ_ENFD | XFS_QUOTA_GDQ_ENFD); | 1458 | switch (sdp->sd_args.ar_quota) { |
1423 | else if (sdp->sd_args.ar_quota == GFS2_QUOTA_ACCOUNT) | 1459 | case GFS2_QUOTA_ON: |
1424 | fqs->qs_flags = (XFS_QUOTA_UDQ_ACCT | XFS_QUOTA_GDQ_ACCT); | 1460 | fqs->qs_flags |= (XFS_QUOTA_UDQ_ENFD | XFS_QUOTA_GDQ_ENFD); |
1461 | /*FALLTHRU*/ | ||
1462 | case GFS2_QUOTA_ACCOUNT: | ||
1463 | fqs->qs_flags |= (XFS_QUOTA_UDQ_ACCT | XFS_QUOTA_GDQ_ACCT); | ||
1464 | break; | ||
1465 | case GFS2_QUOTA_OFF: | ||
1466 | break; | ||
1467 | } | ||
1468 | |||
1425 | if (sdp->sd_quota_inode) { | 1469 | if (sdp->sd_quota_inode) { |
1426 | fqs->qs_uquota.qfs_ino = GFS2_I(sdp->sd_quota_inode)->i_no_addr; | 1470 | fqs->qs_uquota.qfs_ino = GFS2_I(sdp->sd_quota_inode)->i_no_addr; |
1427 | fqs->qs_uquota.qfs_nblks = sdp->sd_quota_inode->i_blocks; | 1471 | fqs->qs_uquota.qfs_nblks = sdp->sd_quota_inode->i_blocks; |
@@ -1432,8 +1476,8 @@ static int gfs2_quota_get_xstate(struct super_block *sb, | |||
1432 | return 0; | 1476 | return 0; |
1433 | } | 1477 | } |
1434 | 1478 | ||
1435 | static int gfs2_xquota_get(struct super_block *sb, int type, qid_t id, | 1479 | static int gfs2_get_dqblk(struct super_block *sb, int type, qid_t id, |
1436 | struct fs_disk_quota *fdq) | 1480 | struct fs_disk_quota *fdq) |
1437 | { | 1481 | { |
1438 | struct gfs2_sbd *sdp = sb->s_fs_info; | 1482 | struct gfs2_sbd *sdp = sb->s_fs_info; |
1439 | struct gfs2_quota_lvb *qlvb; | 1483 | struct gfs2_quota_lvb *qlvb; |
@@ -1477,8 +1521,8 @@ out: | |||
1477 | /* GFS2 only supports a subset of the XFS fields */ | 1521 | /* GFS2 only supports a subset of the XFS fields */ |
1478 | #define GFS2_FIELDMASK (FS_DQ_BSOFT|FS_DQ_BHARD) | 1522 | #define GFS2_FIELDMASK (FS_DQ_BSOFT|FS_DQ_BHARD) |
1479 | 1523 | ||
1480 | static int gfs2_xquota_set(struct super_block *sb, int type, qid_t id, | 1524 | static int gfs2_set_dqblk(struct super_block *sb, int type, qid_t id, |
1481 | struct fs_disk_quota *fdq) | 1525 | struct fs_disk_quota *fdq) |
1482 | { | 1526 | { |
1483 | struct gfs2_sbd *sdp = sb->s_fs_info; | 1527 | struct gfs2_sbd *sdp = sb->s_fs_info; |
1484 | struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode); | 1528 | struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode); |
@@ -1585,7 +1629,7 @@ out_put: | |||
1585 | const struct quotactl_ops gfs2_quotactl_ops = { | 1629 | const struct quotactl_ops gfs2_quotactl_ops = { |
1586 | .quota_sync = gfs2_quota_sync, | 1630 | .quota_sync = gfs2_quota_sync, |
1587 | .get_xstate = gfs2_quota_get_xstate, | 1631 | .get_xstate = gfs2_quota_get_xstate, |
1588 | .get_xquota = gfs2_xquota_get, | 1632 | .get_dqblk = gfs2_get_dqblk, |
1589 | .set_xquota = gfs2_xquota_set, | 1633 | .set_dqblk = gfs2_set_dqblk, |
1590 | }; | 1634 | }; |
1591 | 1635 | ||
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 503b842f3ba2..171a744f8e45 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -854,7 +854,8 @@ static void gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset, | |||
854 | if ((start + nr_sects) != blk) { | 854 | if ((start + nr_sects) != blk) { |
855 | rv = blkdev_issue_discard(bdev, start, | 855 | rv = blkdev_issue_discard(bdev, start, |
856 | nr_sects, GFP_NOFS, | 856 | nr_sects, GFP_NOFS, |
857 | DISCARD_FL_BARRIER); | 857 | BLKDEV_IFL_WAIT | |
858 | BLKDEV_IFL_BARRIER); | ||
858 | if (rv) | 859 | if (rv) |
859 | goto fail; | 860 | goto fail; |
860 | nr_sects = 0; | 861 | nr_sects = 0; |
@@ -869,7 +870,7 @@ start_new_extent: | |||
869 | } | 870 | } |
870 | if (nr_sects) { | 871 | if (nr_sects) { |
871 | rv = blkdev_issue_discard(bdev, start, nr_sects, GFP_NOFS, | 872 | rv = blkdev_issue_discard(bdev, start, nr_sects, GFP_NOFS, |
872 | DISCARD_FL_BARRIER); | 873 | BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER); |
873 | if (rv) | 874 | if (rv) |
874 | goto fail; | 875 | goto fail; |
875 | } | 876 | } |
@@ -948,13 +949,13 @@ static int try_rgrp_fit(struct gfs2_rgrpd *rgd, struct gfs2_alloc *al) | |||
948 | * try_rgrp_unlink - Look for any unlinked, allocated, but unused inodes | 949 | * try_rgrp_unlink - Look for any unlinked, allocated, but unused inodes |
949 | * @rgd: The rgrp | 950 | * @rgd: The rgrp |
950 | * | 951 | * |
951 | * Returns: The inode, if one has been found | 952 | * Returns: 0 if no error |
953 | * The inode, if one has been found, in inode. | ||
952 | */ | 954 | */ |
953 | 955 | ||
954 | static struct inode *try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked, | 956 | static u64 try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked, |
955 | u64 skip) | 957 | u64 skip) |
956 | { | 958 | { |
957 | struct inode *inode; | ||
958 | u32 goal = 0, block; | 959 | u32 goal = 0, block; |
959 | u64 no_addr; | 960 | u64 no_addr; |
960 | struct gfs2_sbd *sdp = rgd->rd_sbd; | 961 | struct gfs2_sbd *sdp = rgd->rd_sbd; |
@@ -979,14 +980,11 @@ static struct inode *try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked, | |||
979 | if (no_addr == skip) | 980 | if (no_addr == skip) |
980 | continue; | 981 | continue; |
981 | *last_unlinked = no_addr; | 982 | *last_unlinked = no_addr; |
982 | inode = gfs2_inode_lookup(rgd->rd_sbd->sd_vfs, DT_UNKNOWN, | 983 | return no_addr; |
983 | no_addr, -1, 1); | ||
984 | if (!IS_ERR(inode)) | ||
985 | return inode; | ||
986 | } | 984 | } |
987 | 985 | ||
988 | rgd->rd_flags &= ~GFS2_RDF_CHECK; | 986 | rgd->rd_flags &= ~GFS2_RDF_CHECK; |
989 | return NULL; | 987 | return 0; |
990 | } | 988 | } |
991 | 989 | ||
992 | /** | 990 | /** |
@@ -1067,11 +1065,12 @@ static void forward_rgrp_set(struct gfs2_sbd *sdp, struct gfs2_rgrpd *rgd) | |||
1067 | * Try to acquire rgrp in way which avoids contending with others. | 1065 | * Try to acquire rgrp in way which avoids contending with others. |
1068 | * | 1066 | * |
1069 | * Returns: errno | 1067 | * Returns: errno |
1068 | * unlinked: the block address of an unlinked block to be reclaimed | ||
1070 | */ | 1069 | */ |
1071 | 1070 | ||
1072 | static struct inode *get_local_rgrp(struct gfs2_inode *ip, u64 *last_unlinked) | 1071 | static int get_local_rgrp(struct gfs2_inode *ip, u64 *unlinked, |
1072 | u64 *last_unlinked) | ||
1073 | { | 1073 | { |
1074 | struct inode *inode = NULL; | ||
1075 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1074 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1076 | struct gfs2_rgrpd *rgd, *begin = NULL; | 1075 | struct gfs2_rgrpd *rgd, *begin = NULL; |
1077 | struct gfs2_alloc *al = ip->i_alloc; | 1076 | struct gfs2_alloc *al = ip->i_alloc; |
@@ -1080,6 +1079,7 @@ static struct inode *get_local_rgrp(struct gfs2_inode *ip, u64 *last_unlinked) | |||
1080 | int loops = 0; | 1079 | int loops = 0; |
1081 | int error, rg_locked; | 1080 | int error, rg_locked; |
1082 | 1081 | ||
1082 | *unlinked = 0; | ||
1083 | rgd = gfs2_blk2rgrpd(sdp, ip->i_goal); | 1083 | rgd = gfs2_blk2rgrpd(sdp, ip->i_goal); |
1084 | 1084 | ||
1085 | while (rgd) { | 1085 | while (rgd) { |
@@ -1096,19 +1096,24 @@ static struct inode *get_local_rgrp(struct gfs2_inode *ip, u64 *last_unlinked) | |||
1096 | case 0: | 1096 | case 0: |
1097 | if (try_rgrp_fit(rgd, al)) | 1097 | if (try_rgrp_fit(rgd, al)) |
1098 | goto out; | 1098 | goto out; |
1099 | if (rgd->rd_flags & GFS2_RDF_CHECK) | 1099 | /* If the rg came in already locked, there's no |
1100 | inode = try_rgrp_unlink(rgd, last_unlinked, ip->i_no_addr); | 1100 | way we can recover from a failed try_rgrp_unlink |
1101 | because that would require an iput which can only | ||
1102 | happen after the rgrp is unlocked. */ | ||
1103 | if (!rg_locked && rgd->rd_flags & GFS2_RDF_CHECK) | ||
1104 | *unlinked = try_rgrp_unlink(rgd, last_unlinked, | ||
1105 | ip->i_no_addr); | ||
1101 | if (!rg_locked) | 1106 | if (!rg_locked) |
1102 | gfs2_glock_dq_uninit(&al->al_rgd_gh); | 1107 | gfs2_glock_dq_uninit(&al->al_rgd_gh); |
1103 | if (inode) | 1108 | if (*unlinked) |
1104 | return inode; | 1109 | return -EAGAIN; |
1105 | /* fall through */ | 1110 | /* fall through */ |
1106 | case GLR_TRYFAILED: | 1111 | case GLR_TRYFAILED: |
1107 | rgd = recent_rgrp_next(rgd); | 1112 | rgd = recent_rgrp_next(rgd); |
1108 | break; | 1113 | break; |
1109 | 1114 | ||
1110 | default: | 1115 | default: |
1111 | return ERR_PTR(error); | 1116 | return error; |
1112 | } | 1117 | } |
1113 | } | 1118 | } |
1114 | 1119 | ||
@@ -1130,12 +1135,13 @@ static struct inode *get_local_rgrp(struct gfs2_inode *ip, u64 *last_unlinked) | |||
1130 | case 0: | 1135 | case 0: |
1131 | if (try_rgrp_fit(rgd, al)) | 1136 | if (try_rgrp_fit(rgd, al)) |
1132 | goto out; | 1137 | goto out; |
1133 | if (rgd->rd_flags & GFS2_RDF_CHECK) | 1138 | if (!rg_locked && rgd->rd_flags & GFS2_RDF_CHECK) |
1134 | inode = try_rgrp_unlink(rgd, last_unlinked, ip->i_no_addr); | 1139 | *unlinked = try_rgrp_unlink(rgd, last_unlinked, |
1140 | ip->i_no_addr); | ||
1135 | if (!rg_locked) | 1141 | if (!rg_locked) |
1136 | gfs2_glock_dq_uninit(&al->al_rgd_gh); | 1142 | gfs2_glock_dq_uninit(&al->al_rgd_gh); |
1137 | if (inode) | 1143 | if (*unlinked) |
1138 | return inode; | 1144 | return -EAGAIN; |
1139 | break; | 1145 | break; |
1140 | 1146 | ||
1141 | case GLR_TRYFAILED: | 1147 | case GLR_TRYFAILED: |
@@ -1143,7 +1149,7 @@ static struct inode *get_local_rgrp(struct gfs2_inode *ip, u64 *last_unlinked) | |||
1143 | break; | 1149 | break; |
1144 | 1150 | ||
1145 | default: | 1151 | default: |
1146 | return ERR_PTR(error); | 1152 | return error; |
1147 | } | 1153 | } |
1148 | 1154 | ||
1149 | rgd = gfs2_rgrpd_get_next(rgd); | 1155 | rgd = gfs2_rgrpd_get_next(rgd); |
@@ -1152,7 +1158,7 @@ static struct inode *get_local_rgrp(struct gfs2_inode *ip, u64 *last_unlinked) | |||
1152 | 1158 | ||
1153 | if (rgd == begin) { | 1159 | if (rgd == begin) { |
1154 | if (++loops >= 3) | 1160 | if (++loops >= 3) |
1155 | return ERR_PTR(-ENOSPC); | 1161 | return -ENOSPC; |
1156 | if (!skipped) | 1162 | if (!skipped) |
1157 | loops++; | 1163 | loops++; |
1158 | flags = 0; | 1164 | flags = 0; |
@@ -1172,7 +1178,7 @@ out: | |||
1172 | forward_rgrp_set(sdp, rgd); | 1178 | forward_rgrp_set(sdp, rgd); |
1173 | } | 1179 | } |
1174 | 1180 | ||
1175 | return NULL; | 1181 | return 0; |
1176 | } | 1182 | } |
1177 | 1183 | ||
1178 | /** | 1184 | /** |
@@ -1186,9 +1192,8 @@ int gfs2_inplace_reserve_i(struct gfs2_inode *ip, char *file, unsigned int line) | |||
1186 | { | 1192 | { |
1187 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1193 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1188 | struct gfs2_alloc *al = ip->i_alloc; | 1194 | struct gfs2_alloc *al = ip->i_alloc; |
1189 | struct inode *inode; | ||
1190 | int error = 0; | 1195 | int error = 0; |
1191 | u64 last_unlinked = NO_BLOCK; | 1196 | u64 last_unlinked = NO_BLOCK, unlinked; |
1192 | 1197 | ||
1193 | if (gfs2_assert_warn(sdp, al->al_requested)) | 1198 | if (gfs2_assert_warn(sdp, al->al_requested)) |
1194 | return -EINVAL; | 1199 | return -EINVAL; |
@@ -1204,17 +1209,27 @@ try_again: | |||
1204 | if (error) | 1209 | if (error) |
1205 | return error; | 1210 | return error; |
1206 | 1211 | ||
1207 | inode = get_local_rgrp(ip, &last_unlinked); | 1212 | /* Find an rgrp suitable for allocation. If it encounters any unlinked |
1208 | if (inode) { | 1213 | dinodes along the way, error will equal -EAGAIN and unlinked will |
1214 | contains it block address. We then need to look up that inode and | ||
1215 | try to free it, and try the allocation again. */ | ||
1216 | error = get_local_rgrp(ip, &unlinked, &last_unlinked); | ||
1217 | if (error) { | ||
1209 | if (ip != GFS2_I(sdp->sd_rindex)) | 1218 | if (ip != GFS2_I(sdp->sd_rindex)) |
1210 | gfs2_glock_dq_uninit(&al->al_ri_gh); | 1219 | gfs2_glock_dq_uninit(&al->al_ri_gh); |
1211 | if (IS_ERR(inode)) | 1220 | if (error != -EAGAIN) |
1212 | return PTR_ERR(inode); | 1221 | return error; |
1213 | iput(inode); | 1222 | |
1223 | gfs2_process_unlinked_inode(ip->i_inode.i_sb, unlinked); | ||
1224 | /* regardless of whether or not gfs2_process_unlinked_inode | ||
1225 | was successful, we don't want to repeat it again. */ | ||
1226 | last_unlinked = unlinked; | ||
1214 | gfs2_log_flush(sdp, NULL); | 1227 | gfs2_log_flush(sdp, NULL); |
1228 | error = 0; | ||
1229 | |||
1215 | goto try_again; | 1230 | goto try_again; |
1216 | } | 1231 | } |
1217 | 1232 | /* no error, so we have the rgrp set in the inode's allocation. */ | |
1218 | al->al_file = file; | 1233 | al->al_file = file; |
1219 | al->al_line = line; | 1234 | al->al_line = line; |
1220 | 1235 | ||
diff --git a/fs/gfs2/rgrp.h b/fs/gfs2/rgrp.h index b4106ddaaa98..f07119d89557 100644 --- a/fs/gfs2/rgrp.h +++ b/fs/gfs2/rgrp.h | |||
@@ -10,6 +10,8 @@ | |||
10 | #ifndef __RGRP_DOT_H__ | 10 | #ifndef __RGRP_DOT_H__ |
11 | #define __RGRP_DOT_H__ | 11 | #define __RGRP_DOT_H__ |
12 | 12 | ||
13 | #include <linux/slab.h> | ||
14 | |||
13 | struct gfs2_rgrpd; | 15 | struct gfs2_rgrpd; |
14 | struct gfs2_sbd; | 16 | struct gfs2_sbd; |
15 | struct gfs2_holder; | 17 | struct gfs2_holder; |
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index 50aac606b990..4d1aad38f1b1 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -1113,7 +1113,7 @@ static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data) | |||
1113 | int error; | 1113 | int error; |
1114 | 1114 | ||
1115 | spin_lock(>->gt_spin); | 1115 | spin_lock(>->gt_spin); |
1116 | args.ar_commit = gt->gt_log_flush_secs; | 1116 | args.ar_commit = gt->gt_logd_secs; |
1117 | args.ar_quota_quantum = gt->gt_quota_quantum; | 1117 | args.ar_quota_quantum = gt->gt_quota_quantum; |
1118 | if (gt->gt_statfs_slow) | 1118 | if (gt->gt_statfs_slow) |
1119 | args.ar_statfs_quantum = 0; | 1119 | args.ar_statfs_quantum = 0; |
@@ -1160,7 +1160,7 @@ static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data) | |||
1160 | else | 1160 | else |
1161 | clear_bit(SDF_NOBARRIERS, &sdp->sd_flags); | 1161 | clear_bit(SDF_NOBARRIERS, &sdp->sd_flags); |
1162 | spin_lock(>->gt_spin); | 1162 | spin_lock(>->gt_spin); |
1163 | gt->gt_log_flush_secs = args.ar_commit; | 1163 | gt->gt_logd_secs = args.ar_commit; |
1164 | gt->gt_quota_quantum = args.ar_quota_quantum; | 1164 | gt->gt_quota_quantum = args.ar_quota_quantum; |
1165 | if (args.ar_statfs_quantum) { | 1165 | if (args.ar_statfs_quantum) { |
1166 | gt->gt_statfs_slow = 0; | 1166 | gt->gt_statfs_slow = 0; |
@@ -1305,8 +1305,8 @@ static int gfs2_show_options(struct seq_file *s, struct vfsmount *mnt) | |||
1305 | } | 1305 | } |
1306 | if (args->ar_discard) | 1306 | if (args->ar_discard) |
1307 | seq_printf(s, ",discard"); | 1307 | seq_printf(s, ",discard"); |
1308 | val = sdp->sd_tune.gt_log_flush_secs; | 1308 | val = sdp->sd_tune.gt_logd_secs; |
1309 | if (val != 60) | 1309 | if (val != 30) |
1310 | seq_printf(s, ",commit=%d", val); | 1310 | seq_printf(s, ",commit=%d", val); |
1311 | val = sdp->sd_tune.gt_statfs_quantum; | 1311 | val = sdp->sd_tune.gt_statfs_quantum; |
1312 | if (val != 30) | 1312 | if (val != 30) |
@@ -1334,7 +1334,8 @@ static int gfs2_show_options(struct seq_file *s, struct vfsmount *mnt) | |||
1334 | } | 1334 | } |
1335 | if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags)) | 1335 | if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags)) |
1336 | seq_printf(s, ",nobarrier"); | 1336 | seq_printf(s, ",nobarrier"); |
1337 | 1337 | if (test_bit(SDF_DEMOTE, &sdp->sd_flags)) | |
1338 | seq_printf(s, ",demote_interface_used"); | ||
1338 | return 0; | 1339 | return 0; |
1339 | } | 1340 | } |
1340 | 1341 | ||
diff --git a/fs/gfs2/super.h b/fs/gfs2/super.h index 3df60f2d84e3..a0464680af0b 100644 --- a/fs/gfs2/super.h +++ b/fs/gfs2/super.h | |||
@@ -54,7 +54,7 @@ extern struct file_system_type gfs2meta_fs_type; | |||
54 | extern const struct export_operations gfs2_export_ops; | 54 | extern const struct export_operations gfs2_export_ops; |
55 | extern const struct super_operations gfs2_super_ops; | 55 | extern const struct super_operations gfs2_super_ops; |
56 | extern const struct dentry_operations gfs2_dops; | 56 | extern const struct dentry_operations gfs2_dops; |
57 | extern struct xattr_handler *gfs2_xattr_handlers[]; | 57 | extern const struct xattr_handler *gfs2_xattr_handlers[]; |
58 | 58 | ||
59 | #endif /* __SUPER_DOT_H__ */ | 59 | #endif /* __SUPER_DOT_H__ */ |
60 | 60 | ||
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index 419042f7f0b6..37f5393e68e6 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c | |||
@@ -8,7 +8,6 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/sched.h> | 10 | #include <linux/sched.h> |
11 | #include <linux/slab.h> | ||
12 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
14 | #include <linux/buffer_head.h> | 13 | #include <linux/buffer_head.h> |
@@ -233,6 +232,8 @@ static ssize_t demote_rq_store(struct gfs2_sbd *sdp, const char *buf, size_t len | |||
233 | glops = gfs2_glops_list[gltype]; | 232 | glops = gfs2_glops_list[gltype]; |
234 | if (glops == NULL) | 233 | if (glops == NULL) |
235 | return -EINVAL; | 234 | return -EINVAL; |
235 | if (!test_and_set_bit(SDF_DEMOTE, &sdp->sd_flags)) | ||
236 | fs_info(sdp, "demote interface used\n"); | ||
236 | rv = gfs2_glock_get(sdp, glnum, glops, 0, &gl); | 237 | rv = gfs2_glock_get(sdp, glnum, glops, 0, &gl); |
237 | if (rv) | 238 | if (rv) |
238 | return rv; | 239 | return rv; |
@@ -469,8 +470,6 @@ static ssize_t name##_store(struct gfs2_sbd *sdp, const char *buf, size_t len)\ | |||
469 | } \ | 470 | } \ |
470 | TUNE_ATTR_2(name, name##_store) | 471 | TUNE_ATTR_2(name, name##_store) |
471 | 472 | ||
472 | TUNE_ATTR(incore_log_blocks, 0); | ||
473 | TUNE_ATTR(log_flush_secs, 0); | ||
474 | TUNE_ATTR(quota_warn_period, 0); | 473 | TUNE_ATTR(quota_warn_period, 0); |
475 | TUNE_ATTR(quota_quantum, 0); | 474 | TUNE_ATTR(quota_quantum, 0); |
476 | TUNE_ATTR(max_readahead, 0); | 475 | TUNE_ATTR(max_readahead, 0); |
@@ -482,8 +481,6 @@ TUNE_ATTR(statfs_quantum, 1); | |||
482 | TUNE_ATTR_3(quota_scale, quota_scale_show, quota_scale_store); | 481 | TUNE_ATTR_3(quota_scale, quota_scale_show, quota_scale_store); |
483 | 482 | ||
484 | static struct attribute *tune_attrs[] = { | 483 | static struct attribute *tune_attrs[] = { |
485 | &tune_attr_incore_log_blocks.attr, | ||
486 | &tune_attr_log_flush_secs.attr, | ||
487 | &tune_attr_quota_warn_period.attr, | 484 | &tune_attr_quota_warn_period.attr, |
488 | &tune_attr_quota_quantum.attr, | 485 | &tune_attr_quota_quantum.attr, |
489 | &tune_attr_max_readahead.attr, | 486 | &tune_attr_max_readahead.attr, |
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c index 4ef0e9fa3549..9ec73a854111 100644 --- a/fs/gfs2/trans.c +++ b/fs/gfs2/trans.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "meta_io.h" | 23 | #include "meta_io.h" |
24 | #include "trans.h" | 24 | #include "trans.h" |
25 | #include "util.h" | 25 | #include "util.h" |
26 | #include "trace_gfs2.h" | ||
26 | 27 | ||
27 | int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks, | 28 | int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks, |
28 | unsigned int revokes) | 29 | unsigned int revokes) |
@@ -75,6 +76,23 @@ fail_holder_uninit: | |||
75 | return error; | 76 | return error; |
76 | } | 77 | } |
77 | 78 | ||
79 | /** | ||
80 | * gfs2_log_release - Release a given number of log blocks | ||
81 | * @sdp: The GFS2 superblock | ||
82 | * @blks: The number of blocks | ||
83 | * | ||
84 | */ | ||
85 | |||
86 | static void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks) | ||
87 | { | ||
88 | |||
89 | atomic_add(blks, &sdp->sd_log_blks_free); | ||
90 | trace_gfs2_log_blocks(sdp, blks); | ||
91 | gfs2_assert_withdraw(sdp, atomic_read(&sdp->sd_log_blks_free) <= | ||
92 | sdp->sd_jdesc->jd_blocks); | ||
93 | up_read(&sdp->sd_log_flush_lock); | ||
94 | } | ||
95 | |||
78 | void gfs2_trans_end(struct gfs2_sbd *sdp) | 96 | void gfs2_trans_end(struct gfs2_sbd *sdp) |
79 | { | 97 | { |
80 | struct gfs2_trans *tr = current->journal_info; | 98 | struct gfs2_trans *tr = current->journal_info; |
diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c index 226f2bfbf16a..53511291fe36 100644 --- a/fs/gfs2/util.c +++ b/fs/gfs2/util.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/slab.h> | ||
11 | #include <linux/spinlock.h> | 10 | #include <linux/spinlock.h> |
12 | #include <linux/completion.h> | 11 | #include <linux/completion.h> |
13 | #include <linux/buffer_head.h> | 12 | #include <linux/buffer_head.h> |
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c index c2ebdf2c01d4..82f93da00d1b 100644 --- a/fs/gfs2/xattr.c +++ b/fs/gfs2/xattr.c | |||
@@ -1535,21 +1535,21 @@ out_alloc: | |||
1535 | return error; | 1535 | return error; |
1536 | } | 1536 | } |
1537 | 1537 | ||
1538 | static struct xattr_handler gfs2_xattr_user_handler = { | 1538 | static const struct xattr_handler gfs2_xattr_user_handler = { |
1539 | .prefix = XATTR_USER_PREFIX, | 1539 | .prefix = XATTR_USER_PREFIX, |
1540 | .flags = GFS2_EATYPE_USR, | 1540 | .flags = GFS2_EATYPE_USR, |
1541 | .get = gfs2_xattr_get, | 1541 | .get = gfs2_xattr_get, |
1542 | .set = gfs2_xattr_set, | 1542 | .set = gfs2_xattr_set, |
1543 | }; | 1543 | }; |
1544 | 1544 | ||
1545 | static struct xattr_handler gfs2_xattr_security_handler = { | 1545 | static const struct xattr_handler gfs2_xattr_security_handler = { |
1546 | .prefix = XATTR_SECURITY_PREFIX, | 1546 | .prefix = XATTR_SECURITY_PREFIX, |
1547 | .flags = GFS2_EATYPE_SECURITY, | 1547 | .flags = GFS2_EATYPE_SECURITY, |
1548 | .get = gfs2_xattr_get, | 1548 | .get = gfs2_xattr_get, |
1549 | .set = gfs2_xattr_set, | 1549 | .set = gfs2_xattr_set, |
1550 | }; | 1550 | }; |
1551 | 1551 | ||
1552 | struct xattr_handler *gfs2_xattr_handlers[] = { | 1552 | const struct xattr_handler *gfs2_xattr_handlers[] = { |
1553 | &gfs2_xattr_user_handler, | 1553 | &gfs2_xattr_user_handler, |
1554 | &gfs2_xattr_security_handler, | 1554 | &gfs2_xattr_security_handler, |
1555 | &gfs2_xattr_system_handler, | 1555 | &gfs2_xattr_system_handler, |