resize.c (970e4936d7d15f35d00fd15a14f5343ba78b2fc8) resize.c (13723d00e374c2a6d6ccb5af6de965e89c3e1b01)
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * resize.c
5 *
6 * volume resize.
7 * Inspired by ext3/resize.c.
8 *

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

101 struct ocfs2_group_desc *group;
102 u16 chain, num_bits, backups = 0;
103 u16 cl_bpc = le16_to_cpu(cl->cl_bpc);
104 u16 cl_cpg = le16_to_cpu(cl->cl_cpg);
105
106 mlog_entry("(new_clusters=%d, first_new_cluster = %u)\n",
107 new_clusters, first_new_cluster);
108
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * resize.c
5 *
6 * volume resize.
7 * Inspired by ext3/resize.c.
8 *

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

101 struct ocfs2_group_desc *group;
102 u16 chain, num_bits, backups = 0;
103 u16 cl_bpc = le16_to_cpu(cl->cl_bpc);
104 u16 cl_cpg = le16_to_cpu(cl->cl_cpg);
105
106 mlog_entry("(new_clusters=%d, first_new_cluster = %u)\n",
107 new_clusters, first_new_cluster);
108
109 ret = ocfs2_journal_access(handle, bm_inode, group_bh,
110 OCFS2_JOURNAL_ACCESS_WRITE);
109 ret = ocfs2_journal_access_gd(handle, bm_inode, group_bh,
110 OCFS2_JOURNAL_ACCESS_WRITE);
111 if (ret < 0) {
112 mlog_errno(ret);
113 goto out;
114 }
115
116 group = (struct ocfs2_group_desc *)group_bh->b_data;
117
118 /* update the group first. */

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

136
137 ret = ocfs2_journal_dirty(handle, group_bh);
138 if (ret < 0) {
139 mlog_errno(ret);
140 goto out_rollback;
141 }
142
143 /* update the inode accordingly. */
111 if (ret < 0) {
112 mlog_errno(ret);
113 goto out;
114 }
115
116 group = (struct ocfs2_group_desc *)group_bh->b_data;
117
118 /* update the group first. */

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

136
137 ret = ocfs2_journal_dirty(handle, group_bh);
138 if (ret < 0) {
139 mlog_errno(ret);
140 goto out_rollback;
141 }
142
143 /* update the inode accordingly. */
144 ret = ocfs2_journal_access(handle, bm_inode, bm_bh,
145 OCFS2_JOURNAL_ACCESS_WRITE);
144 ret = ocfs2_journal_access_di(handle, bm_inode, bm_bh,
145 OCFS2_JOURNAL_ACCESS_WRITE);
146 if (ret < 0) {
147 mlog_errno(ret);
148 goto out_rollback;
149 }
150
151 chain = le16_to_cpu(group->bg_chain);
152 cr = (&cl->cl_recs[chain]);
153 le32_add_cpu(&cr->c_total, num_bits);

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

531 ret = -EINVAL;
532 goto out_unlock;
533 }
534
535 cl_bpc = le16_to_cpu(fe->id2.i_chain.cl_bpc);
536 cl = &fe->id2.i_chain;
537 cr = &cl->cl_recs[input->chain];
538
146 if (ret < 0) {
147 mlog_errno(ret);
148 goto out_rollback;
149 }
150
151 chain = le16_to_cpu(group->bg_chain);
152 cr = (&cl->cl_recs[chain]);
153 le32_add_cpu(&cr->c_total, num_bits);

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

531 ret = -EINVAL;
532 goto out_unlock;
533 }
534
535 cl_bpc = le16_to_cpu(fe->id2.i_chain.cl_bpc);
536 cl = &fe->id2.i_chain;
537 cr = &cl->cl_recs[input->chain];
538
539 ret = ocfs2_journal_access(handle, main_bm_inode, group_bh,
540 OCFS2_JOURNAL_ACCESS_WRITE);
539 ret = ocfs2_journal_access_gd(handle, main_bm_inode, group_bh,
540 OCFS2_JOURNAL_ACCESS_WRITE);
541 if (ret < 0) {
542 mlog_errno(ret);
543 goto out_commit;
544 }
545
546 group = (struct ocfs2_group_desc *)group_bh->b_data;
547 group->bg_next_group = cr->c_blkno;
548
549 ret = ocfs2_journal_dirty(handle, group_bh);
550 if (ret < 0) {
551 mlog_errno(ret);
552 goto out_commit;
553 }
554
541 if (ret < 0) {
542 mlog_errno(ret);
543 goto out_commit;
544 }
545
546 group = (struct ocfs2_group_desc *)group_bh->b_data;
547 group->bg_next_group = cr->c_blkno;
548
549 ret = ocfs2_journal_dirty(handle, group_bh);
550 if (ret < 0) {
551 mlog_errno(ret);
552 goto out_commit;
553 }
554
555 ret = ocfs2_journal_access(handle, main_bm_inode, main_bm_bh,
556 OCFS2_JOURNAL_ACCESS_WRITE);
555 ret = ocfs2_journal_access_di(handle, main_bm_inode, main_bm_bh,
556 OCFS2_JOURNAL_ACCESS_WRITE);
557 if (ret < 0) {
558 mlog_errno(ret);
559 goto out_commit;
560 }
561
562 if (input->chain == le16_to_cpu(cl->cl_next_free_rec)) {
563 le16_add_cpu(&cl->cl_next_free_rec, 1);
564 memset(cr, 0, sizeof(struct ocfs2_chain_rec));

--- 37 unchanged lines hidden ---
557 if (ret < 0) {
558 mlog_errno(ret);
559 goto out_commit;
560 }
561
562 if (input->chain == le16_to_cpu(cl->cl_next_free_rec)) {
563 le16_add_cpu(&cl->cl_next_free_rec, 1);
564 memset(cr, 0, sizeof(struct ocfs2_chain_rec));

--- 37 unchanged lines hidden ---