resize.c (2f919710143cb2025157c3c193ee22de86f3ed73) | resize.c (668f4dc5593327fadc95b33189c375f7178ef88e) |
---|---|
1/* 2 * linux/fs/ext4/resize.c 3 * 4 * Support for resizing an ext4 filesystem while it is mounted. 5 * 6 * Copyright (C) 2001, 2002 Andreas Dilger <adilger@clusterfs.com> 7 * 8 * This could probably be made into a module, because it is not often in use. --- 532 unchanged lines hidden (view full) --- 541 * Each reserved backup GDT block will go into a different indirect block. 542 * The indirect blocks are actually the primary reserved GDT blocks, 543 * so we know in advance what their block numbers are. We only get the 544 * double-indirect block to verify it is pointing to the primary reserved 545 * GDT blocks so we don't overwrite a data block by accident. The reserved 546 * backup GDT blocks are stored in their reserved primary GDT block. 547 */ 548static int reserve_backup_gdb(handle_t *handle, struct inode *inode, | 1/* 2 * linux/fs/ext4/resize.c 3 * 4 * Support for resizing an ext4 filesystem while it is mounted. 5 * 6 * Copyright (C) 2001, 2002 Andreas Dilger <adilger@clusterfs.com> 7 * 8 * This could probably be made into a module, because it is not often in use. --- 532 unchanged lines hidden (view full) --- 541 * Each reserved backup GDT block will go into a different indirect block. 542 * The indirect blocks are actually the primary reserved GDT blocks, 543 * so we know in advance what their block numbers are. We only get the 544 * double-indirect block to verify it is pointing to the primary reserved 545 * GDT blocks so we don't overwrite a data block by accident. The reserved 546 * backup GDT blocks are stored in their reserved primary GDT block. 547 */ 548static int reserve_backup_gdb(handle_t *handle, struct inode *inode, |
549 struct ext4_new_group_data *input) | 549 ext4_group_t group) |
550{ 551 struct super_block *sb = inode->i_sb; 552 int reserved_gdb =le16_to_cpu(EXT4_SB(sb)->s_es->s_reserved_gdt_blocks); 553 struct buffer_head **primary; 554 struct buffer_head *dind; 555 struct ext4_iloc iloc; 556 ext4_fsblk_t blk; 557 __le32 *data, *end; --- 54 unchanged lines hidden (view full) --- 612 613 if ((err = ext4_reserve_inode_write(handle, inode, &iloc))) 614 goto exit_bh; 615 616 /* 617 * Finally we can add each of the reserved backup GDT blocks from 618 * the new group to its reserved primary GDT block. 619 */ | 550{ 551 struct super_block *sb = inode->i_sb; 552 int reserved_gdb =le16_to_cpu(EXT4_SB(sb)->s_es->s_reserved_gdt_blocks); 553 struct buffer_head **primary; 554 struct buffer_head *dind; 555 struct ext4_iloc iloc; 556 ext4_fsblk_t blk; 557 __le32 *data, *end; --- 54 unchanged lines hidden (view full) --- 612 613 if ((err = ext4_reserve_inode_write(handle, inode, &iloc))) 614 goto exit_bh; 615 616 /* 617 * Finally we can add each of the reserved backup GDT blocks from 618 * the new group to its reserved primary GDT block. 619 */ |
620 blk = input->group * EXT4_BLOCKS_PER_GROUP(sb); | 620 blk = group * EXT4_BLOCKS_PER_GROUP(sb); |
621 for (i = 0; i < reserved_gdb; i++) { 622 int err2; 623 data = (__le32 *)primary[i]->b_data; 624 /* printk("reserving backup %lu[%u] = %lu\n", 625 primary[i]->b_blocknr, gdbackups, 626 blk + primary[i]->b_blocknr); */ 627 data[gdbackups] = cpu_to_le32(blk + primary[i]->b_blocknr); 628 err2 = ext4_handle_dirty_metadata(handle, NULL, primary[i]); --- 197 unchanged lines hidden (view full) --- 826 * Doing both would be mean more complex code, and sane people don't 827 * use non-sparse filesystems anymore. This is already checked above. 828 */ 829 if (gdb_off) { 830 primary = sbi->s_group_desc[gdb_num]; 831 if ((err = ext4_journal_get_write_access(handle, primary))) 832 goto exit_journal; 833 | 621 for (i = 0; i < reserved_gdb; i++) { 622 int err2; 623 data = (__le32 *)primary[i]->b_data; 624 /* printk("reserving backup %lu[%u] = %lu\n", 625 primary[i]->b_blocknr, gdbackups, 626 blk + primary[i]->b_blocknr); */ 627 data[gdbackups] = cpu_to_le32(blk + primary[i]->b_blocknr); 628 err2 = ext4_handle_dirty_metadata(handle, NULL, primary[i]); --- 197 unchanged lines hidden (view full) --- 826 * Doing both would be mean more complex code, and sane people don't 827 * use non-sparse filesystems anymore. This is already checked above. 828 */ 829 if (gdb_off) { 830 primary = sbi->s_group_desc[gdb_num]; 831 if ((err = ext4_journal_get_write_access(handle, primary))) 832 goto exit_journal; 833 |
834 if (reserved_gdb && ext4_bg_num_gdb(sb, input->group) && 835 (err = reserve_backup_gdb(handle, inode, input))) 836 goto exit_journal; | 834 if (reserved_gdb && ext4_bg_num_gdb(sb, input->group)) { 835 err = reserve_backup_gdb(handle, inode, input->group); 836 if (err) 837 goto exit_journal; 838 } |
837 } else { 838 /* 839 * Note that we can access new group descriptor block safely 840 * only if add_new_gdb() succeeds. 841 */ 842 err = add_new_gdb(handle, inode, input->group); 843 if (err) 844 goto exit_journal; --- 235 unchanged lines hidden --- | 839 } else { 840 /* 841 * Note that we can access new group descriptor block safely 842 * only if add_new_gdb() succeeds. 843 */ 844 err = add_new_gdb(handle, inode, input->group); 845 if (err) 846 goto exit_journal; --- 235 unchanged lines hidden --- |