move_extents.c (84a73014d86fd660822a20c032625e3afe99ca58) move_extents.c (5955102c9984fa081b2d570cfac75c97eecf8f3b)
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * move_extents.c
5 *
6 * Copyright (C) 2011 Oracle. All rights reserved.
7 *
8 * This program is free software; you can redistribute it and/or

--- 262 unchanged lines hidden (view full) ---

271
272 /*
273 * should be using allocation reservation strategy there?
274 *
275 * if (context->data_ac)
276 * context->data_ac->ac_resv = &OCFS2_I(inode)->ip_la_data_resv;
277 */
278
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * move_extents.c
5 *
6 * Copyright (C) 2011 Oracle. All rights reserved.
7 *
8 * This program is free software; you can redistribute it and/or

--- 262 unchanged lines hidden (view full) ---

271
272 /*
273 * should be using allocation reservation strategy there?
274 *
275 * if (context->data_ac)
276 * context->data_ac->ac_resv = &OCFS2_I(inode)->ip_la_data_resv;
277 */
278
279 mutex_lock(&tl_inode->i_mutex);
279 inode_lock(tl_inode);
280
281 if (ocfs2_truncate_log_needs_flush(osb)) {
282 ret = __ocfs2_flush_truncate_log(osb);
283 if (ret < 0) {
284 mlog_errno(ret);
285 goto out_unlock_mutex;
286 }
287 }

--- 45 unchanged lines hidden (view full) ---

333 ret = ocfs2_cow_sync_writeback(inode->i_sb, context->inode, cpos, *len);
334 if (ret)
335 mlog_errno(ret);
336
337out_commit:
338 ocfs2_commit_trans(osb, handle);
339
340out_unlock_mutex:
280
281 if (ocfs2_truncate_log_needs_flush(osb)) {
282 ret = __ocfs2_flush_truncate_log(osb);
283 if (ret < 0) {
284 mlog_errno(ret);
285 goto out_unlock_mutex;
286 }
287 }

--- 45 unchanged lines hidden (view full) ---

333 ret = ocfs2_cow_sync_writeback(inode->i_sb, context->inode, cpos, *len);
334 if (ret)
335 mlog_errno(ret);
336
337out_commit:
338 ocfs2_commit_trans(osb, handle);
339
340out_unlock_mutex:
341 mutex_unlock(&tl_inode->i_mutex);
341 inode_unlock(tl_inode);
342
343 if (context->data_ac) {
344 ocfs2_free_alloc_context(context->data_ac);
345 context->data_ac = NULL;
346 }
347
348 if (context->meta_ac) {
349 ocfs2_free_alloc_context(context->meta_ac);

--- 277 unchanged lines hidden (view full) ---

627 gb_inode = ocfs2_get_system_file_inode(osb, GLOBAL_BITMAP_SYSTEM_INODE,
628 OCFS2_INVALID_SLOT);
629 if (!gb_inode) {
630 mlog(ML_ERROR, "unable to get global_bitmap inode\n");
631 ret = -EIO;
632 goto out;
633 }
634
342
343 if (context->data_ac) {
344 ocfs2_free_alloc_context(context->data_ac);
345 context->data_ac = NULL;
346 }
347
348 if (context->meta_ac) {
349 ocfs2_free_alloc_context(context->meta_ac);

--- 277 unchanged lines hidden (view full) ---

627 gb_inode = ocfs2_get_system_file_inode(osb, GLOBAL_BITMAP_SYSTEM_INODE,
628 OCFS2_INVALID_SLOT);
629 if (!gb_inode) {
630 mlog(ML_ERROR, "unable to get global_bitmap inode\n");
631 ret = -EIO;
632 goto out;
633 }
634
635 mutex_lock(&gb_inode->i_mutex);
635 inode_lock(gb_inode);
636
637 ret = ocfs2_inode_lock(gb_inode, &gb_bh, 1);
638 if (ret) {
639 mlog_errno(ret);
640 goto out_unlock_gb_mutex;
641 }
642
636
637 ret = ocfs2_inode_lock(gb_inode, &gb_bh, 1);
638 if (ret) {
639 mlog_errno(ret);
640 goto out_unlock_gb_mutex;
641 }
642
643 mutex_lock(&tl_inode->i_mutex);
643 inode_lock(tl_inode);
644
645 handle = ocfs2_start_trans(osb, credits);
646 if (IS_ERR(handle)) {
647 ret = PTR_ERR(handle);
648 mlog_errno(ret);
649 goto out_unlock_tl_inode;
650 }
651

--- 51 unchanged lines hidden (view full) ---

703 if (ret)
704 mlog_errno(ret);
705
706out_commit:
707 ocfs2_commit_trans(osb, handle);
708 brelse(gd_bh);
709
710out_unlock_tl_inode:
644
645 handle = ocfs2_start_trans(osb, credits);
646 if (IS_ERR(handle)) {
647 ret = PTR_ERR(handle);
648 mlog_errno(ret);
649 goto out_unlock_tl_inode;
650 }
651

--- 51 unchanged lines hidden (view full) ---

703 if (ret)
704 mlog_errno(ret);
705
706out_commit:
707 ocfs2_commit_trans(osb, handle);
708 brelse(gd_bh);
709
710out_unlock_tl_inode:
711 mutex_unlock(&tl_inode->i_mutex);
711 inode_unlock(tl_inode);
712
713 ocfs2_inode_unlock(gb_inode, 1);
714out_unlock_gb_mutex:
712
713 ocfs2_inode_unlock(gb_inode, 1);
714out_unlock_gb_mutex:
715 mutex_unlock(&gb_inode->i_mutex);
715 inode_unlock(gb_inode);
716 brelse(gb_bh);
717 iput(gb_inode);
718
719out:
720 if (context->meta_ac) {
721 ocfs2_free_alloc_context(context->meta_ac);
722 context->meta_ac = NULL;
723 }

--- 176 unchanged lines hidden (view full) ---

900 struct inode *inode = context->inode;
901 struct ocfs2_dinode *di;
902 struct buffer_head *di_bh = NULL;
903 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
904
905 if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb))
906 return -EROFS;
907
716 brelse(gb_bh);
717 iput(gb_inode);
718
719out:
720 if (context->meta_ac) {
721 ocfs2_free_alloc_context(context->meta_ac);
722 context->meta_ac = NULL;
723 }

--- 176 unchanged lines hidden (view full) ---

900 struct inode *inode = context->inode;
901 struct ocfs2_dinode *di;
902 struct buffer_head *di_bh = NULL;
903 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
904
905 if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb))
906 return -EROFS;
907
908 mutex_lock(&inode->i_mutex);
908 inode_lock(inode);
909
910 /*
911 * This prevents concurrent writes from other nodes
912 */
913 status = ocfs2_rw_lock(inode, 1);
914 if (status) {
915 mlog_errno(status);
916 goto out;

--- 47 unchanged lines hidden (view full) ---

964 ocfs2_commit_trans(osb, handle);
965
966out_inode_unlock:
967 brelse(di_bh);
968 ocfs2_inode_unlock(inode, 1);
969out_rw_unlock:
970 ocfs2_rw_unlock(inode, 1);
971out:
909
910 /*
911 * This prevents concurrent writes from other nodes
912 */
913 status = ocfs2_rw_lock(inode, 1);
914 if (status) {
915 mlog_errno(status);
916 goto out;

--- 47 unchanged lines hidden (view full) ---

964 ocfs2_commit_trans(osb, handle);
965
966out_inode_unlock:
967 brelse(di_bh);
968 ocfs2_inode_unlock(inode, 1);
969out_rw_unlock:
970 ocfs2_rw_unlock(inode, 1);
971out:
972 mutex_unlock(&inode->i_mutex);
972 inode_unlock(inode);
973
974 return status;
975}
976
977int ocfs2_ioctl_move_extents(struct file *filp, void __user *argp)
978{
979 int status;
980

--- 93 unchanged lines hidden ---
973
974 return status;
975}
976
977int ocfs2_ioctl_move_extents(struct file *filp, void __user *argp)
978{
979 int status;
980

--- 93 unchanged lines hidden ---