Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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:
GFS2: Fix typo
GFS2: stuck in inode wait, no glocks stuck
GFS2: Eliminate useless err variable
GFS2: Fix writing to non-page aligned gfs2_quota structures
GFS2: Add some useful messages
GFS2: fix quota state reporting
GFS2: Various gfs2_logd improvements
GFS2: glock livelock
GFS2: Clean up stuffed file copying
GFS2: docs update
GFS2: Remove space from slab cache name

+369 -186
+6 -6
Documentation/filesystems/gfs2.txt
··· 1 1 Global File System 2 2 ------------------ 3 3 4 - http://sources.redhat.com/cluster/ 4 + http://sources.redhat.com/cluster/wiki/ 5 5 6 6 GFS is a cluster file system. It allows a cluster of computers to 7 7 simultaneously use a block device that is shared between them (with FC, ··· 36 36 is pretty close. 37 37 38 38 The following man pages can be found at the URL above: 39 - fsck.gfs2 to repair a filesystem 40 - gfs2_grow to expand a filesystem online 41 - gfs2_jadd to add journals to a filesystem online 42 - gfs2_tool to manipulate, examine and tune a filesystem 39 + fsck.gfs2 to repair a filesystem 40 + gfs2_grow to expand a filesystem online 41 + gfs2_jadd to add journals to a filesystem online 42 + gfs2_tool to manipulate, examine and tune a filesystem 43 43 gfs2_quota to examine and change quota values in a filesystem 44 44 gfs2_convert to convert a gfs filesystem to gfs2 in-place 45 45 mount.gfs2 to help mount(8) mount a filesystem 46 - mkfs.gfs2 to make a filesystem 46 + mkfs.gfs2 to make a filesystem
+5 -3
fs/gfs2/aops.c
··· 418 418 static int stuffed_readpage(struct gfs2_inode *ip, struct page *page) 419 419 { 420 420 struct buffer_head *dibh; 421 + u64 dsize = i_size_read(&ip->i_inode); 421 422 void *kaddr; 422 423 int error; 423 424 ··· 438 437 return error; 439 438 440 439 kaddr = kmap_atomic(page, KM_USER0); 441 - memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), 442 - ip->i_disksize); 443 - memset(kaddr + ip->i_disksize, 0, PAGE_CACHE_SIZE - ip->i_disksize); 440 + if (dsize > (dibh->b_size - sizeof(struct gfs2_dinode))) 441 + dsize = (dibh->b_size - sizeof(struct gfs2_dinode)); 442 + memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), dsize); 443 + memset(kaddr + dsize, 0, PAGE_CACHE_SIZE - dsize); 444 444 kunmap_atomic(kaddr, KM_USER0); 445 445 flush_dcache_page(page); 446 446 brelse(dibh);
+10 -7
fs/gfs2/bmap.c
··· 71 71 72 72 if (!PageUptodate(page)) { 73 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); 74 78 75 - memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), 76 - ip->i_disksize); 77 - memset(kaddr + ip->i_disksize, 0, 78 - PAGE_CACHE_SIZE - ip->i_disksize); 79 + memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), dsize); 80 + memset(kaddr + dsize, 0, PAGE_CACHE_SIZE - dsize); 79 81 kunmap(page); 80 82 81 83 SetPageUptodate(page); ··· 1040 1038 goto out; 1041 1039 1042 1040 if (gfs2_is_stuffed(ip)) { 1043 - ip->i_disksize = size; 1041 + u64 dsize = size + sizeof(struct gfs2_inode); 1044 1042 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; 1045 1043 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 1046 1044 gfs2_dinode_out(ip, dibh->b_data); 1047 - gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode) + size); 1045 + if (dsize > dibh->b_size) 1046 + dsize = dibh->b_size; 1047 + gfs2_buffer_clear_tail(dibh, dsize); 1048 1048 error = 1; 1049 - 1050 1049 } else { 1051 1050 if (size & (u64)(sdp->sd_sb.sb_bsize - 1)) 1052 1051 error = gfs2_block_truncate_page(ip->i_inode.i_mapping);
+1 -1
fs/gfs2/dir.c
··· 1475 1475 inode = gfs2_inode_lookup(dir->i_sb, 1476 1476 be16_to_cpu(dent->de_type), 1477 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 1479 brelse(bh); 1480 1480 return inode; 1481 1481 }
+1 -1
fs/gfs2/export.c
··· 168 168 if (error) 169 169 goto fail; 170 170 171 - inode = gfs2_inode_lookup(sb, DT_UNKNOWN, inum->no_addr, 0, 0); 171 + inode = gfs2_inode_lookup(sb, DT_UNKNOWN, inum->no_addr, 0); 172 172 if (IS_ERR(inode)) { 173 173 error = PTR_ERR(inode); 174 174 goto fail;
+3
fs/gfs2/glock.c
··· 855 855 gh->gh_flags = flags; 856 856 gh->gh_iflags = 0; 857 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 /**
+6 -5
fs/gfs2/incore.h
··· 439 439 struct gfs2_tune { 440 440 spinlock_t gt_spin; 441 441 442 - unsigned int gt_incore_log_blocks; 443 - unsigned int gt_log_flush_secs; 444 - 445 442 unsigned int gt_logd_secs; 446 443 447 444 unsigned int gt_quota_simul_sync; /* Max quotavals to sync at once */ ··· 459 462 SDF_SHUTDOWN = 2, 460 463 SDF_NOBARRIERS = 3, 461 464 SDF_NORECOVERY = 4, 465 + SDF_DEMOTE = 5, 462 466 }; 463 467 464 468 #define GFS2_FSNAME_LEN 256 ··· 616 618 unsigned int sd_log_commited_databuf; 617 619 int sd_log_commited_revoke; 618 620 621 + atomic_t sd_log_pinned; 619 622 unsigned int sd_log_num_buf; 620 623 unsigned int sd_log_num_revoke; 621 624 unsigned int sd_log_num_rg; ··· 628 629 struct list_head sd_log_le_databuf; 629 630 struct list_head sd_log_le_ordered; 630 631 632 + atomic_t sd_log_thresh1; 633 + atomic_t sd_log_thresh2; 631 634 atomic_t sd_log_blks_free; 632 - struct mutex sd_log_reserve_mutex; 635 + wait_queue_head_t sd_log_waitq; 636 + wait_queue_head_t sd_logd_waitq; 633 637 634 638 u64 sd_log_sequence; 635 639 unsigned int sd_log_head; 636 640 unsigned int sd_log_tail; 637 641 int sd_log_idle; 638 642 639 - unsigned long sd_log_flush_time; 640 643 struct rw_semaphore sd_log_flush_lock; 641 644 atomic_t sd_log_in_flight; 642 645 wait_queue_head_t sd_log_flush_wait;
+92 -9
fs/gfs2/inode.c
··· 158 158 * @sb: The super block 159 159 * @no_addr: The inode number 160 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 162 * Returns: A VFS inode, or an error 164 163 */ ··· 165 166 struct inode *gfs2_inode_lookup(struct super_block *sb, 166 167 unsigned int type, 167 168 u64 no_addr, 168 - u64 no_formal_ino, int skip_freeing) 169 + u64 no_formal_ino) 169 170 { 170 171 struct inode *inode; 171 172 struct gfs2_inode *ip; 172 173 struct gfs2_glock *io_gl; 173 174 int error; 174 175 175 - if (skip_freeing) 176 - inode = gfs2_iget_skip(sb, no_addr); 177 - else 178 - inode = gfs2_iget(sb, no_addr); 176 + inode = gfs2_iget(sb, no_addr); 179 177 ip = GFS2_I(inode); 180 178 181 179 if (!inode) ··· 230 234 fail_iopen: 231 235 gfs2_glock_put(io_gl); 232 236 fail_put: 237 + if (inode->i_state & I_NEW) 238 + ip->i_gl->gl_object = NULL; 239 + gfs2_glock_put(ip->i_gl); 240 + fail: 241 + if (inode->i_state & I_NEW) 242 + iget_failed(inode); 243 + else 244 + iput(inode); 245 + return ERR_PTR(error); 246 + } 247 + 248 + /** 249 + * gfs2_unlinked_inode_lookup - Lookup an unlinked inode for reclamation 250 + * @sb: The super block 251 + * no_addr: The inode number 252 + * @@inode: A pointer to the inode found, if any 253 + * 254 + * Returns: 0 and *inode if no errors occurred. If an error occurs, 255 + * the resulting *inode may or may not be NULL. 256 + */ 257 + 258 + int gfs2_unlinked_inode_lookup(struct super_block *sb, u64 no_addr, 259 + struct inode **inode) 260 + { 261 + struct gfs2_sbd *sdp; 262 + struct gfs2_inode *ip; 263 + struct gfs2_glock *io_gl; 264 + int error; 265 + struct gfs2_holder gh; 266 + 267 + *inode = gfs2_iget_skip(sb, no_addr); 268 + 269 + if (!(*inode)) 270 + return -ENOBUFS; 271 + 272 + if (!((*inode)->i_state & I_NEW)) 273 + return -ENOBUFS; 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 + if (error == GLR_TRYFAILED) 293 + error = 0; 294 + goto fail_iopen; 295 + } 296 + ip->i_iopen_gh.gh_gl->gl_object = ip; 297 + gfs2_glock_put(io_gl); 298 + 299 + (*inode)->i_mode = DT2IF(DT_UNKNOWN); 300 + 301 + /* 302 + * We must read the inode in order to work out its type in 303 + * this case. Note that this doesn't happen often as we normally 304 + * know the type beforehand. This code path only occurs during 305 + * unlinked inode recovery (where it is safe to do this glock, 306 + * which is not true in the general case). 307 + */ 308 + error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, LM_FLAG_TRY, 309 + &gh); 310 + if (unlikely(error)) { 311 + if (error == GLR_TRYFAILED) 312 + error = 0; 313 + goto fail_glock; 314 + } 315 + /* Inode is now uptodate */ 316 + gfs2_glock_dq_uninit(&gh); 317 + gfs2_set_iop(*inode); 318 + 319 + return 0; 320 + fail_glock: 321 + gfs2_glock_dq(&ip->i_iopen_gh); 322 + fail_iopen: 323 + gfs2_glock_put(io_gl); 324 + fail_put: 233 325 ip->i_gl->gl_object = NULL; 234 326 gfs2_glock_put(ip->i_gl); 235 327 fail: 236 - iget_failed(inode); 237 - return ERR_PTR(error); 328 + return error; 238 329 } 239 330 240 331 static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) ··· 945 862 goto fail_gunlock2; 946 863 947 864 inode = gfs2_inode_lookup(dir->i_sb, IF2DT(mode), inum.no_addr, 948 - inum.no_formal_ino, 0); 865 + inum.no_formal_ino); 949 866 if (IS_ERR(inode)) 950 867 goto fail_gunlock2; 951 868
+3 -2
fs/gfs2/inode.h
··· 83 83 84 84 extern void gfs2_set_iop(struct inode *inode); 85 85 extern struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned type, 86 - u64 no_addr, u64 no_formal_ino, 87 - int skip_freeing); 86 + u64 no_addr, u64 no_formal_ino); 87 + extern int gfs2_unlinked_inode_lookup(struct super_block *sb, u64 no_addr, 88 + struct inode **inode); 88 89 extern struct inode *gfs2_ilookup(struct super_block *sb, u64 no_addr); 89 90 90 91 extern int gfs2_inode_refresh(struct gfs2_inode *ip);
+89 -71
fs/gfs2/log.c
··· 168 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 173 struct list_head *head; 174 174 u64 sync_gen; 175 - struct list_head *first; 176 - struct gfs2_ail *first_ai, *ai, *tmp; 175 + struct gfs2_ail *ai; 177 176 int done = 0; 178 177 179 178 gfs2_log_lock(sdp); ··· 183 184 } 184 185 sync_gen = sdp->sd_ail_sync_gen++; 185 186 186 - first = head->prev; 187 - first_ai = list_entry(first, struct gfs2_ail, ai_list); 188 - first_ai->ai_sync_gen = sync_gen; 189 - gfs2_ail1_start_one(sdp, first_ai); /* This may drop log lock */ 190 - 191 - if (flags & DIO_ALL) 192 - first = NULL; 193 - 194 187 while(!done) { 195 - if (first && (head->prev != first || 196 - gfs2_ail1_empty_one(sdp, first_ai, 0))) 197 - break; 198 - 199 188 done = 1; 200 - list_for_each_entry_safe_reverse(ai, tmp, head, ai_list) { 189 + list_for_each_entry_reverse(ai, head, ai_list) { 201 190 if (ai->ai_sync_gen >= sync_gen) 202 191 continue; 203 192 ai->ai_sync_gen = sync_gen; ··· 277 290 * flush time, so we ensure that we have just enough free blocks at all 278 291 * times to avoid running out during a log flush. 279 292 * 293 + * We no longer flush the log here, instead we wake up logd to do that 294 + * for us. To avoid the thundering herd and to ensure that we deal fairly 295 + * with queued waiters, we use an exclusive wait. This means that when we 296 + * get woken with enough journal space to get our reservation, we need to 297 + * wake the next waiter on the list. 298 + * 280 299 * Returns: errno 281 300 */ 282 301 283 302 int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks) 284 303 { 285 - unsigned int try = 0; 286 304 unsigned reserved_blks = 6 * (4096 / sdp->sd_vfs->s_blocksize); 305 + unsigned wanted = blks + reserved_blks; 306 + DEFINE_WAIT(wait); 307 + int did_wait = 0; 308 + unsigned int free_blocks; 287 309 288 310 if (gfs2_assert_warn(sdp, blks) || 289 311 gfs2_assert_warn(sdp, blks <= sdp->sd_jdesc->jd_blocks)) 290 312 return -EINVAL; 291 - 292 - mutex_lock(&sdp->sd_log_reserve_mutex); 293 - gfs2_log_lock(sdp); 294 - while(atomic_read(&sdp->sd_log_blks_free) <= (blks + reserved_blks)) { 295 - gfs2_log_unlock(sdp); 296 - gfs2_ail1_empty(sdp, 0); 297 - gfs2_log_flush(sdp, NULL); 298 - 299 - if (try++) 300 - gfs2_ail1_start(sdp, 0); 301 - gfs2_log_lock(sdp); 313 + retry: 314 + free_blocks = atomic_read(&sdp->sd_log_blks_free); 315 + if (unlikely(free_blocks <= wanted)) { 316 + do { 317 + prepare_to_wait_exclusive(&sdp->sd_log_waitq, &wait, 318 + TASK_UNINTERRUPTIBLE); 319 + wake_up(&sdp->sd_logd_waitq); 320 + did_wait = 1; 321 + if (atomic_read(&sdp->sd_log_blks_free) <= wanted) 322 + io_schedule(); 323 + free_blocks = atomic_read(&sdp->sd_log_blks_free); 324 + } while(free_blocks <= wanted); 325 + finish_wait(&sdp->sd_log_waitq, &wait); 302 326 } 303 - atomic_sub(blks, &sdp->sd_log_blks_free); 327 + if (atomic_cmpxchg(&sdp->sd_log_blks_free, free_blocks, 328 + free_blocks - blks) != free_blocks) 329 + goto retry; 304 330 trace_gfs2_log_blocks(sdp, -blks); 305 - gfs2_log_unlock(sdp); 306 - mutex_unlock(&sdp->sd_log_reserve_mutex); 331 + 332 + /* 333 + * If we waited, then so might others, wake them up _after_ we get 334 + * our share of the log. 335 + */ 336 + if (unlikely(did_wait)) 337 + wake_up(&sdp->sd_log_waitq); 307 338 308 339 down_read(&sdp->sd_log_flush_lock); 309 340 310 341 return 0; 311 - } 312 - 313 - /** 314 - * gfs2_log_release - Release a given number of log blocks 315 - * @sdp: The GFS2 superblock 316 - * @blks: The number of blocks 317 - * 318 - */ 319 - 320 - void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks) 321 - { 322 - 323 - gfs2_log_lock(sdp); 324 - atomic_add(blks, &sdp->sd_log_blks_free); 325 - trace_gfs2_log_blocks(sdp, blks); 326 - gfs2_assert_withdraw(sdp, 327 - atomic_read(&sdp->sd_log_blks_free) <= sdp->sd_jdesc->jd_blocks); 328 - gfs2_log_unlock(sdp); 329 - up_read(&sdp->sd_log_flush_lock); 330 342 } 331 343 332 344 static u64 log_bmap(struct gfs2_sbd *sdp, unsigned int lbn) ··· 545 559 546 560 ail2_empty(sdp, new_tail); 547 561 548 - gfs2_log_lock(sdp); 549 562 atomic_add(dist, &sdp->sd_log_blks_free); 550 563 trace_gfs2_log_blocks(sdp, dist); 551 - gfs2_assert_withdraw(sdp, atomic_read(&sdp->sd_log_blks_free) <= sdp->sd_jdesc->jd_blocks); 552 - gfs2_log_unlock(sdp); 564 + gfs2_assert_withdraw(sdp, atomic_read(&sdp->sd_log_blks_free) <= 565 + sdp->sd_jdesc->jd_blocks); 553 566 554 567 sdp->sd_log_tail = new_tail; 555 568 } ··· 600 615 if (buffer_eopnotsupp(bh)) { 601 616 clear_buffer_eopnotsupp(bh); 602 617 set_buffer_uptodate(bh); 618 + fs_info(sdp, "barrier sync failed - disabling barriers\n"); 603 619 set_bit(SDF_NOBARRIERS, &sdp->sd_flags); 604 620 lock_buffer(bh); 605 621 skip_barrier: ··· 808 822 * @sdp: the filesystem 809 823 * @tr: the transaction 810 824 * 825 + * We wake up gfs2_logd if the number of pinned blocks exceed thresh1 826 + * or the total number of used blocks (pinned blocks plus AIL blocks) 827 + * is greater than thresh2. 828 + * 829 + * At mount time thresh1 is 1/3rd of journal size, thresh2 is 2/3rd of 830 + * journal size. 831 + * 811 832 * Returns: errno 812 833 */ 813 834 ··· 825 832 826 833 up_read(&sdp->sd_log_flush_lock); 827 834 828 - gfs2_log_lock(sdp); 829 - if (sdp->sd_log_num_buf > gfs2_tune_get(sdp, gt_incore_log_blocks)) 830 - wake_up_process(sdp->sd_logd_process); 831 - gfs2_log_unlock(sdp); 835 + if (atomic_read(&sdp->sd_log_pinned) > atomic_read(&sdp->sd_log_thresh1) || 836 + ((sdp->sd_jdesc->jd_blocks - atomic_read(&sdp->sd_log_blks_free)) > 837 + atomic_read(&sdp->sd_log_thresh2))) 838 + wake_up(&sdp->sd_logd_waitq); 832 839 } 833 840 834 841 /** ··· 875 882 { 876 883 gfs2_log_flush(sdp, NULL); 877 884 for (;;) { 878 - gfs2_ail1_start(sdp, DIO_ALL); 885 + gfs2_ail1_start(sdp); 879 886 if (gfs2_ail1_empty(sdp, DIO_ALL)) 880 887 break; 881 888 msleep(10); 882 889 } 883 890 } 884 891 892 + static inline int gfs2_jrnl_flush_reqd(struct gfs2_sbd *sdp) 893 + { 894 + return (atomic_read(&sdp->sd_log_pinned) >= atomic_read(&sdp->sd_log_thresh1)); 895 + } 896 + 897 + static inline int gfs2_ail_flush_reqd(struct gfs2_sbd *sdp) 898 + { 899 + unsigned int used_blocks = sdp->sd_jdesc->jd_blocks - atomic_read(&sdp->sd_log_blks_free); 900 + return used_blocks >= atomic_read(&sdp->sd_log_thresh2); 901 + } 885 902 886 903 /** 887 904 * gfs2_logd - Update log tail as Active Items get flushed to in-place blocks ··· 904 901 int gfs2_logd(void *data) 905 902 { 906 903 struct gfs2_sbd *sdp = data; 907 - unsigned long t; 908 - int need_flush; 904 + unsigned long t = 1; 905 + DEFINE_WAIT(wait); 906 + unsigned preflush; 909 907 910 908 while (!kthread_should_stop()) { 911 - /* Advance the log tail */ 912 909 913 - t = sdp->sd_log_flush_time + 914 - gfs2_tune_get(sdp, gt_log_flush_secs) * HZ; 915 - 916 - gfs2_ail1_empty(sdp, DIO_ALL); 917 - gfs2_log_lock(sdp); 918 - need_flush = sdp->sd_log_num_buf > gfs2_tune_get(sdp, gt_incore_log_blocks); 919 - gfs2_log_unlock(sdp); 920 - if (need_flush || time_after_eq(jiffies, t)) { 910 + preflush = atomic_read(&sdp->sd_log_pinned); 911 + if (gfs2_jrnl_flush_reqd(sdp) || t == 0) { 912 + gfs2_ail1_empty(sdp, DIO_ALL); 921 913 gfs2_log_flush(sdp, NULL); 922 - sdp->sd_log_flush_time = jiffies; 914 + gfs2_ail1_empty(sdp, DIO_ALL); 923 915 } 924 916 917 + if (gfs2_ail_flush_reqd(sdp)) { 918 + gfs2_ail1_start(sdp); 919 + io_schedule(); 920 + gfs2_ail1_empty(sdp, 0); 921 + gfs2_log_flush(sdp, NULL); 922 + gfs2_ail1_empty(sdp, DIO_ALL); 923 + } 924 + 925 + wake_up(&sdp->sd_log_waitq); 925 926 t = gfs2_tune_get(sdp, gt_logd_secs) * HZ; 926 927 if (freezing(current)) 927 928 refrigerator(); 928 - schedule_timeout_interruptible(t); 929 + 930 + do { 931 + prepare_to_wait(&sdp->sd_logd_waitq, &wait, 932 + TASK_UNINTERRUPTIBLE); 933 + if (!gfs2_ail_flush_reqd(sdp) && 934 + !gfs2_jrnl_flush_reqd(sdp) && 935 + !kthread_should_stop()) 936 + t = schedule_timeout(t); 937 + } while(t && !gfs2_ail_flush_reqd(sdp) && 938 + !gfs2_jrnl_flush_reqd(sdp) && 939 + !kthread_should_stop()); 940 + finish_wait(&sdp->sd_logd_waitq, &wait); 929 941 } 930 942 931 943 return 0;
-1
fs/gfs2/log.h
··· 51 51 unsigned int ssize); 52 52 53 53 int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks); 54 - void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks); 55 54 void gfs2_log_incr_head(struct gfs2_sbd *sdp); 56 55 57 56 struct buffer_head *gfs2_log_get_buf(struct gfs2_sbd *sdp);
+2
fs/gfs2/lops.c
··· 54 54 if (bd->bd_ail) 55 55 list_move(&bd->bd_ail_st_list, &bd->bd_ail->ai_ail2_list); 56 56 get_bh(bh); 57 + atomic_inc(&sdp->sd_log_pinned); 57 58 trace_gfs2_pin(bd, 1); 58 59 } 59 60 ··· 95 94 trace_gfs2_pin(bd, 0); 96 95 gfs2_log_unlock(sdp); 97 96 unlock_buffer(bh); 97 + atomic_dec(&sdp->sd_log_pinned); 98 98 } 99 99 100 100
+1 -1
fs/gfs2/main.c
··· 94 94 if (!gfs2_glock_cachep) 95 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 98 sizeof(struct gfs2_glock) + 99 99 sizeof(struct address_space), 100 100 0, 0, gfs2_init_gl_aspace_once);
+2 -3
fs/gfs2/meta_io.c
··· 34 34 35 35 static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wbc) 36 36 { 37 - int err; 38 37 struct buffer_head *bh, *head; 39 38 int nr_underway = 0; 40 39 int write_op = (1 << BIO_RW_META) | ((wbc->sync_mode == WB_SYNC_ALL ? ··· 85 86 } while (bh != head); 86 87 unlock_page(page); 87 88 88 - err = 0; 89 89 if (nr_underway == 0) 90 90 end_page_writeback(page); 91 91 92 - return err; 92 + return 0; 93 93 } 94 94 95 95 const struct address_space_operations gfs2_meta_aops = { ··· 311 313 struct gfs2_bufdata *bd = bh->b_private; 312 314 313 315 if (test_clear_buffer_pinned(bh)) { 316 + atomic_dec(&sdp->sd_log_pinned); 314 317 list_del_init(&bd->bd_le.le_list); 315 318 if (meta) { 316 319 gfs2_assert_warn(sdp, sdp->sd_log_num_buf);
+10 -9
fs/gfs2/ops_fstype.c
··· 57 57 { 58 58 spin_lock_init(&gt->gt_spin); 59 59 60 - gt->gt_incore_log_blocks = 1024; 61 - gt->gt_logd_secs = 1; 62 60 gt->gt_quota_simul_sync = 64; 63 61 gt->gt_quota_warn_period = 10; 64 62 gt->gt_quota_scale_num = 1; ··· 99 101 spin_lock_init(&sdp->sd_trunc_lock); 100 102 101 103 spin_lock_init(&sdp->sd_log_lock); 102 - 104 + atomic_set(&sdp->sd_log_pinned, 0); 103 105 INIT_LIST_HEAD(&sdp->sd_log_le_buf); 104 106 INIT_LIST_HEAD(&sdp->sd_log_le_revoke); 105 107 INIT_LIST_HEAD(&sdp->sd_log_le_rg); 106 108 INIT_LIST_HEAD(&sdp->sd_log_le_databuf); 107 109 INIT_LIST_HEAD(&sdp->sd_log_le_ordered); 108 110 109 - mutex_init(&sdp->sd_log_reserve_mutex); 111 + init_waitqueue_head(&sdp->sd_log_waitq); 112 + init_waitqueue_head(&sdp->sd_logd_waitq); 110 113 INIT_LIST_HEAD(&sdp->sd_ail1_list); 111 114 INIT_LIST_HEAD(&sdp->sd_ail2_list); 112 115 ··· 486 487 struct dentry *dentry; 487 488 struct inode *inode; 488 489 489 - inode = gfs2_inode_lookup(sb, DT_DIR, no_addr, 0, 0); 490 + inode = gfs2_inode_lookup(sb, DT_DIR, no_addr, 0); 490 491 if (IS_ERR(inode)) { 491 492 fs_err(sdp, "can't read in %s inode: %ld\n", name, PTR_ERR(inode)); 492 493 return PTR_ERR(inode); ··· 732 733 if (sdp->sd_args.ar_spectator) { 733 734 sdp->sd_jdesc = gfs2_jdesc_find(sdp, 0); 734 735 atomic_set(&sdp->sd_log_blks_free, sdp->sd_jdesc->jd_blocks); 736 + atomic_set(&sdp->sd_log_thresh1, 2*sdp->sd_jdesc->jd_blocks/5); 737 + atomic_set(&sdp->sd_log_thresh2, 4*sdp->sd_jdesc->jd_blocks/5); 735 738 } else { 736 739 if (sdp->sd_lockstruct.ls_jid >= gfs2_jindex_size(sdp)) { 737 740 fs_err(sdp, "can't mount journal #%u\n", ··· 771 770 goto fail_jinode_gh; 772 771 } 773 772 atomic_set(&sdp->sd_log_blks_free, sdp->sd_jdesc->jd_blocks); 773 + atomic_set(&sdp->sd_log_thresh1, 2*sdp->sd_jdesc->jd_blocks/5); 774 + atomic_set(&sdp->sd_log_thresh2, 4*sdp->sd_jdesc->jd_blocks/5); 774 775 775 776 /* Map the extents for this journal's blocks */ 776 777 map_journal_extents(sdp); ··· 953 950 954 951 if (undo) 955 952 goto fail_quotad; 956 - 957 - sdp->sd_log_flush_time = jiffies; 958 953 959 954 p = kthread_run(gfs2_logd, sdp, "gfs2_logd"); 960 955 error = IS_ERR(p); ··· 1161 1160 GFS2_BASIC_BLOCK_SHIFT; 1162 1161 sdp->sd_fsb2bb = 1 << sdp->sd_fsb2bb_shift; 1163 1162 1164 - sdp->sd_tune.gt_log_flush_secs = sdp->sd_args.ar_commit; 1163 + sdp->sd_tune.gt_logd_secs = sdp->sd_args.ar_commit; 1165 1164 sdp->sd_tune.gt_quota_quantum = sdp->sd_args.ar_quota_quantum; 1166 1165 if (sdp->sd_args.ar_statfs_quantum) { 1167 1166 sdp->sd_tune.gt_statfs_slow = 0; ··· 1324 1323 memset(&args, 0, sizeof(args)); 1325 1324 args.ar_quota = GFS2_QUOTA_DEFAULT; 1326 1325 args.ar_data = GFS2_DATA_DEFAULT; 1327 - args.ar_commit = 60; 1326 + args.ar_commit = 30; 1328 1327 args.ar_statfs_quantum = 30; 1329 1328 args.ar_quota_quantum = 60; 1330 1329 args.ar_errors = GFS2_ERRORS_DEFAULT;
+73 -29
fs/gfs2/quota.c
··· 637 637 unsigned blocksize, iblock, pos; 638 638 struct buffer_head *bh, *dibh; 639 639 struct page *page; 640 - void *kaddr; 641 - struct gfs2_quota *qp; 642 - s64 value; 643 - int err = -EIO; 640 + void *kaddr, *ptr; 641 + struct gfs2_quota q, *qp; 642 + int err, nbytes; 644 643 u64 size; 645 644 646 645 if (gfs2_is_stuffed(ip)) 647 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 674 page = grab_cache_page(mapping, index); 650 675 if (!page) 651 676 return -ENOMEM; ··· 692 667 if (!buffer_mapped(bh)) { 693 668 gfs2_block_map(inode, iblock, bh, 1); 694 669 if (!buffer_mapped(bh)) 695 - goto unlock; 670 + goto unlock_out; 671 + /* If it's a newly allocated disk block for quota, zero it */ 672 + if (buffer_new(bh)) { 673 + memset(bh->b_data, 0, bh->b_size); 674 + set_buffer_uptodate(bh); 675 + } 696 676 } 697 677 698 678 if (PageUptodate(page)) ··· 707 677 ll_rw_block(READ_META, 1, &bh); 708 678 wait_on_buffer(bh); 709 679 if (!buffer_uptodate(bh)) 710 - goto unlock; 680 + goto unlock_out; 711 681 } 712 682 713 683 gfs2_trans_add_bh(ip->i_gl, bh, 0); 714 684 715 685 kaddr = kmap_atomic(page, KM_USER0); 716 - qp = kaddr + offset; 717 - value = (s64)be64_to_cpu(qp->qu_value) + change; 718 - qp->qu_value = cpu_to_be64(value); 719 - qd->qd_qb.qb_value = qp->qu_value; 720 - if (fdq) { 721 - if (fdq->d_fieldmask & FS_DQ_BSOFT) { 722 - qp->qu_warn = cpu_to_be64(fdq->d_blk_softlimit); 723 - qd->qd_qb.qb_warn = qp->qu_warn; 724 - } 725 - if (fdq->d_fieldmask & FS_DQ_BHARD) { 726 - qp->qu_limit = cpu_to_be64(fdq->d_blk_hardlimit); 727 - qd->qd_qb.qb_limit = qp->qu_limit; 728 - } 729 - } 686 + if (offset + sizeof(struct gfs2_quota) > PAGE_CACHE_SIZE) 687 + nbytes = PAGE_CACHE_SIZE - offset; 688 + memcpy(kaddr + offset, ptr, nbytes); 730 689 flush_dcache_page(page); 731 690 kunmap_atomic(kaddr, KM_USER0); 691 + unlock_page(page); 692 + page_cache_release(page); 732 693 694 + /* If quota straddles page boundary, we need to update the rest of the 695 + * quota at the beginning of the next page */ 696 + if (offset != 0) { /* first page, offset is closer to PAGE_CACHE_SIZE */ 697 + ptr = ptr + nbytes; 698 + nbytes = sizeof(struct gfs2_quota) - nbytes; 699 + offset = 0; 700 + index++; 701 + goto get_a_page; 702 + } 703 + 704 + /* Update the disk inode timestamp and size (if extended) */ 733 705 err = gfs2_meta_inode_buffer(ip, &dibh); 734 706 if (err) 735 - goto unlock; 707 + goto out; 736 708 737 709 size = loc + sizeof(struct gfs2_quota); 738 710 if (size > inode->i_size) { ··· 747 715 brelse(dibh); 748 716 mark_inode_dirty(inode); 749 717 750 - unlock: 718 + out: 719 + return err; 720 + unlock_out: 751 721 unlock_page(page); 752 722 page_cache_release(page); 753 723 return err; ··· 813 779 * rgrp since it won't be allocated during the transaction 814 780 */ 815 781 al->al_requested = 1; 816 - /* +1 in the end for block requested above for unstuffing */ 817 - blocks = num_qd * data_blocks + RES_DINODE + num_qd + 1; 782 + /* +3 in the end for unstuffing block, inode size update block 783 + * and another block in case quota straddles page boundary and 784 + * two blocks need to be updated instead of 1 */ 785 + blocks = num_qd * data_blocks + RES_DINODE + num_qd + 3; 818 786 819 787 if (nalloc) 820 788 al->al_requested += nalloc * (data_blocks + ind_blocks); ··· 1454 1418 1455 1419 memset(fqs, 0, sizeof(struct fs_quota_stat)); 1456 1420 fqs->qs_version = FS_QSTAT_VERSION; 1457 - if (sdp->sd_args.ar_quota == GFS2_QUOTA_ON) 1458 - fqs->qs_flags = (XFS_QUOTA_UDQ_ENFD | XFS_QUOTA_GDQ_ENFD); 1459 - else if (sdp->sd_args.ar_quota == GFS2_QUOTA_ACCOUNT) 1460 - fqs->qs_flags = (XFS_QUOTA_UDQ_ACCT | XFS_QUOTA_GDQ_ACCT); 1421 + 1422 + switch (sdp->sd_args.ar_quota) { 1423 + case GFS2_QUOTA_ON: 1424 + fqs->qs_flags |= (XFS_QUOTA_UDQ_ENFD | XFS_QUOTA_GDQ_ENFD); 1425 + /*FALLTHRU*/ 1426 + case GFS2_QUOTA_ACCOUNT: 1427 + fqs->qs_flags |= (XFS_QUOTA_UDQ_ACCT | XFS_QUOTA_GDQ_ACCT); 1428 + break; 1429 + case GFS2_QUOTA_OFF: 1430 + break; 1431 + } 1432 + 1461 1433 if (sdp->sd_quota_inode) { 1462 1434 fqs->qs_uquota.qfs_ino = GFS2_I(sdp->sd_quota_inode)->i_no_addr; 1463 1435 fqs->qs_uquota.qfs_nblks = sdp->sd_quota_inode->i_blocks;
+39 -29
fs/gfs2/rgrp.c
··· 948 948 * try_rgrp_unlink - Look for any unlinked, allocated, but unused inodes 949 949 * @rgd: The rgrp 950 950 * 951 - * Returns: The inode, if one has been found 951 + * Returns: 0 if no error 952 + * The inode, if one has been found, in inode. 952 953 */ 953 954 954 - static struct inode *try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked, 955 - u64 skip) 955 + static u64 try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked, 956 + u64 skip) 956 957 { 957 - struct inode *inode; 958 958 u32 goal = 0, block; 959 959 u64 no_addr; 960 960 struct gfs2_sbd *sdp = rgd->rd_sbd; ··· 979 979 if (no_addr == skip) 980 980 continue; 981 981 *last_unlinked = no_addr; 982 - inode = gfs2_inode_lookup(rgd->rd_sbd->sd_vfs, DT_UNKNOWN, 983 - no_addr, -1, 1); 984 - if (!IS_ERR(inode)) 985 - return inode; 982 + return no_addr; 986 983 } 987 984 988 985 rgd->rd_flags &= ~GFS2_RDF_CHECK; 989 - return NULL; 986 + return 0; 990 987 } 991 988 992 989 /** ··· 1064 1067 * Try to acquire rgrp in way which avoids contending with others. 1065 1068 * 1066 1069 * Returns: errno 1070 + * unlinked: the block address of an unlinked block to be reclaimed 1067 1071 */ 1068 1072 1069 - static struct inode *get_local_rgrp(struct gfs2_inode *ip, u64 *last_unlinked) 1073 + static int get_local_rgrp(struct gfs2_inode *ip, u64 *unlinked, 1074 + u64 *last_unlinked) 1070 1075 { 1071 - struct inode *inode = NULL; 1072 1076 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); 1073 1077 struct gfs2_rgrpd *rgd, *begin = NULL; 1074 1078 struct gfs2_alloc *al = ip->i_alloc; ··· 1078 1080 int loops = 0; 1079 1081 int error, rg_locked; 1080 1082 1083 + *unlinked = 0; 1081 1084 rgd = gfs2_blk2rgrpd(sdp, ip->i_goal); 1082 1085 1083 1086 while (rgd) { ··· 1095 1096 case 0: 1096 1097 if (try_rgrp_fit(rgd, al)) 1097 1098 goto out; 1098 - if (rgd->rd_flags & GFS2_RDF_CHECK) 1099 - inode = try_rgrp_unlink(rgd, last_unlinked, ip->i_no_addr); 1099 + /* If the rg came in already locked, there's no 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); 1100 1106 if (!rg_locked) 1101 1107 gfs2_glock_dq_uninit(&al->al_rgd_gh); 1102 - if (inode) 1103 - return inode; 1108 + if (*unlinked) 1109 + return -EAGAIN; 1104 1110 /* fall through */ 1105 1111 case GLR_TRYFAILED: 1106 1112 rgd = recent_rgrp_next(rgd); 1107 1113 break; 1108 1114 1109 1115 default: 1110 - return ERR_PTR(error); 1116 + return error; 1111 1117 } 1112 1118 } 1113 1119 ··· 1134 1130 case 0: 1135 1131 if (try_rgrp_fit(rgd, al)) 1136 1132 goto out; 1137 - if (rgd->rd_flags & GFS2_RDF_CHECK) 1138 - inode = try_rgrp_unlink(rgd, last_unlinked, ip->i_no_addr); 1133 + if (!rg_locked && rgd->rd_flags & GFS2_RDF_CHECK) 1134 + *unlinked = try_rgrp_unlink(rgd, last_unlinked, 1135 + ip->i_no_addr); 1139 1136 if (!rg_locked) 1140 1137 gfs2_glock_dq_uninit(&al->al_rgd_gh); 1141 - if (inode) 1142 - return inode; 1138 + if (*unlinked) 1139 + return -EAGAIN; 1143 1140 break; 1144 1141 1145 1142 case GLR_TRYFAILED: ··· 1148 1143 break; 1149 1144 1150 1145 default: 1151 - return ERR_PTR(error); 1146 + return error; 1152 1147 } 1153 1148 1154 1149 rgd = gfs2_rgrpd_get_next(rgd); ··· 1157 1152 1158 1153 if (rgd == begin) { 1159 1154 if (++loops >= 3) 1160 - return ERR_PTR(-ENOSPC); 1155 + return -ENOSPC; 1161 1156 if (!skipped) 1162 1157 loops++; 1163 1158 flags = 0; ··· 1177 1172 forward_rgrp_set(sdp, rgd); 1178 1173 } 1179 1174 1180 - return NULL; 1175 + return 0; 1181 1176 } 1182 1177 1183 1178 /** ··· 1193 1188 struct gfs2_alloc *al = ip->i_alloc; 1194 1189 struct inode *inode; 1195 1190 int error = 0; 1196 - u64 last_unlinked = NO_BLOCK; 1191 + u64 last_unlinked = NO_BLOCK, unlinked; 1197 1192 1198 1193 if (gfs2_assert_warn(sdp, al->al_requested)) 1199 1194 return -EINVAL; ··· 1209 1204 if (error) 1210 1205 return error; 1211 1206 1212 - inode = get_local_rgrp(ip, &last_unlinked); 1213 - if (inode) { 1207 + error = get_local_rgrp(ip, &unlinked, &last_unlinked); 1208 + if (error) { 1214 1209 if (ip != GFS2_I(sdp->sd_rindex)) 1215 1210 gfs2_glock_dq_uninit(&al->al_ri_gh); 1216 - if (IS_ERR(inode)) 1217 - return PTR_ERR(inode); 1218 - iput(inode); 1211 + if (error != -EAGAIN) 1212 + return error; 1213 + error = gfs2_unlinked_inode_lookup(ip->i_inode.i_sb, 1214 + unlinked, &inode); 1215 + if (inode) 1216 + iput(inode); 1219 1217 gfs2_log_flush(sdp, NULL); 1218 + if (error == GLR_TRYFAILED) 1219 + error = 0; 1220 1220 goto try_again; 1221 1221 } 1222 1222
+6 -5
fs/gfs2/super.c
··· 1113 1113 int error; 1114 1114 1115 1115 spin_lock(&gt->gt_spin); 1116 - args.ar_commit = gt->gt_log_flush_secs; 1116 + args.ar_commit = gt->gt_logd_secs; 1117 1117 args.ar_quota_quantum = gt->gt_quota_quantum; 1118 1118 if (gt->gt_statfs_slow) 1119 1119 args.ar_statfs_quantum = 0; ··· 1160 1160 else 1161 1161 clear_bit(SDF_NOBARRIERS, &sdp->sd_flags); 1162 1162 spin_lock(&gt->gt_spin); 1163 - gt->gt_log_flush_secs = args.ar_commit; 1163 + gt->gt_logd_secs = args.ar_commit; 1164 1164 gt->gt_quota_quantum = args.ar_quota_quantum; 1165 1165 if (args.ar_statfs_quantum) { 1166 1166 gt->gt_statfs_slow = 0; ··· 1305 1305 } 1306 1306 if (args->ar_discard) 1307 1307 seq_printf(s, ",discard"); 1308 - val = sdp->sd_tune.gt_log_flush_secs; 1309 - if (val != 60) 1308 + val = sdp->sd_tune.gt_logd_secs; 1309 + if (val != 30) 1310 1310 seq_printf(s, ",commit=%d", val); 1311 1311 val = sdp->sd_tune.gt_statfs_quantum; 1312 1312 if (val != 30) ··· 1334 1334 } 1335 1335 if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags)) 1336 1336 seq_printf(s, ",nobarrier"); 1337 - 1337 + if (test_bit(SDF_DEMOTE, &sdp->sd_flags)) 1338 + seq_printf(s, ",demote_interface_used"); 1338 1339 return 0; 1339 1340 } 1340 1341
+2 -4
fs/gfs2/sys.c
··· 232 232 glops = gfs2_glops_list[gltype]; 233 233 if (glops == NULL) 234 234 return -EINVAL; 235 + if (!test_and_set_bit(SDF_DEMOTE, &sdp->sd_flags)) 236 + fs_info(sdp, "demote interface used\n"); 235 237 rv = gfs2_glock_get(sdp, glnum, glops, 0, &gl); 236 238 if (rv) 237 239 return rv; ··· 470 468 } \ 471 469 TUNE_ATTR_2(name, name##_store) 472 470 473 - TUNE_ATTR(incore_log_blocks, 0); 474 - TUNE_ATTR(log_flush_secs, 0); 475 471 TUNE_ATTR(quota_warn_period, 0); 476 472 TUNE_ATTR(quota_quantum, 0); 477 473 TUNE_ATTR(max_readahead, 0); ··· 481 481 TUNE_ATTR_3(quota_scale, quota_scale_show, quota_scale_store); 482 482 483 483 static struct attribute *tune_attrs[] = { 484 - &tune_attr_incore_log_blocks.attr, 485 - &tune_attr_log_flush_secs.attr, 486 484 &tune_attr_quota_warn_period.attr, 487 485 &tune_attr_quota_quantum.attr, 488 486 &tune_attr_max_readahead.attr,
+18
fs/gfs2/trans.c
··· 23 23 #include "meta_io.h" 24 24 #include "trans.h" 25 25 #include "util.h" 26 + #include "trace_gfs2.h" 26 27 27 28 int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks, 28 29 unsigned int revokes) ··· 74 73 kfree(tr); 75 74 76 75 return error; 76 + } 77 + 78 + /** 79 + * gfs2_log_release - Release a given number of log blocks 80 + * @sdp: The GFS2 superblock 81 + * @blks: The number of blocks 82 + * 83 + */ 84 + 85 + static void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks) 86 + { 87 + 88 + atomic_add(blks, &sdp->sd_log_blks_free); 89 + trace_gfs2_log_blocks(sdp, blks); 90 + gfs2_assert_withdraw(sdp, atomic_read(&sdp->sd_log_blks_free) <= 91 + sdp->sd_jdesc->jd_blocks); 92 + up_read(&sdp->sd_log_flush_lock); 77 93 } 78 94 79 95 void gfs2_trans_end(struct gfs2_sbd *sdp)