Re: Current >32bit ext3 patches against 2.6.17-rc4

Avantika Mathur <[email protected]>
Newsgroups gmane.comp.file-systems.ext2.devel
Message-ID <[email protected]>
On Mon, 2006-05-22 at 11:31 -0700, Mingming Cao wrote: 
> Just for everyone's information, I have compiled the updated >32bit ext3
> patches posted to the list recently and put it under
> 
> http://ext2.sourceforge.net/48bitext3/patches/patches-2.6.17-
> rc4-05222006/
> 
> 
> series:
> 
> #sector_t overflow check for 32bit/48bit ext3 at mount/resize time
> ext3_check_sector_t_overflow.patch
> #sector_t type format string for all arch
> sector_fmt.patch
> #ext3 in-kernel fs/group blocks cleanup and fix for 32bit ext3
> ext3_blk_type_define.patch
> ext3_new_block_type_prepare.patch
> ext3_group_block_t.patch
> ext3_convert_int_blk_to_fsblk_t.patch
> ext3_blks_fixes_from_comments-1-4.patch
> ext3_convert_ul_to_fsblk_t.patch
> ext3_fsblk_RHS_assignment_convert.patch
> #support >32 bit fs block type in kernel (convert ext3_fsblk_t to sector_t)
> ext3_fsblk_sector_t.patch
> ext3_get_group_offset.patch
> #48 bit on-disk i_file_acl to support xttar for 48 bit ext3
> ext3_48bit_i_file_acl.patch
> #64bit JBD core
> 64bit_jbd_core.patch
> 
> Thanks,
> 
> Mingming

This is an incremental patch to the extents patches, changing physical
block variables to ext3_fsblk_t and ext3_grpblk_t types, instead of
using sector_t.  

The extents patches have been re-based on the ext3_fsblk_t patch series.
These patches will be added to the series.

Thanks,
Avantika Mathur

---
Avantika Mathur
IBM LTC-kernel team
[email protected]


-------------------------------------------------------------------


 linux-2.6.16-cmm/fs/ext3/extents.c               |   80 +++++++++++------------
 linux-2.6.16-cmm/include/linux/ext3_fs_extents.h |    2 
 linux-2.6.16-cmm/include/linux/ext3_fs_i.h       |    8 +-
 3 files changed, 46 insertions(+), 44 deletions(-)

diff -puN fs/ext3/extents.c~extents-ext3_fsblk_t fs/ext3/extents.c
--- linux-2.6.16/fs/ext3/extents.c~extents-ext3_fsblk_t 2006-05-23 17:11:32.000000000 -0700
+++ linux-2.6.16-cmm/fs/ext3/extents.c  2006-05-23 17:11:32.000000000 -0700
@@ -45,19 +45,19 @@
 
 
 /* this macro combines low and hi parts of phys. blocknr into sector_t */
-static inline sector_t ext_pblock(struct ext3_extent *ex)
+static inline ext3_fsblk_t ext_pblock(struct ext3_extent *ex)
 {
-       sector_t block;
+       ext3_fsblk_t block;
 
        block = le32_to_cpu(ex->ee_start);
 #ifdef CONFIG_LBD
-       block |= (sector_t) le16_to_cpu(ex->ee_start_hi) << 32;
+       block |= (ext3_fsblk_t) le16_to_cpu(ex->ee_start_hi) << 32;
 #endif
        return block;
 }
 
 /* the routine stores large phys. blocknr into extent breaking it into parts */
-static inline void ext3_ext_store_pblock(struct ext3_extent *ex, sector_t pb)
+static inline void ext3_ext_store_pblock(struct ext3_extent *ex, ext3_fsblk_t pb)
 {
        ex->ee_start = cpu_to_le32((unsigned long) (pb & 0xffffffff));
 #ifdef CONFIG_LBD
@@ -135,13 +135,13 @@ static int ext3_ext_dirty(handle_t *hand
        return err;
 }
 
-static int ext3_ext_find_goal(struct inode *inode,
+static ext3_fsblk_t ext3_ext_find_goal(struct inode *inode,
                              struct ext3_ext_path *path,
-                             sector_t block)
+                             ext3_fsblk_t block)
 {
        struct ext3_inode_info *ei = EXT3_I(inode);
-       unsigned long bg_start;
-       unsigned long colour;
+       ext3_fsblk_t bg_start;
+       ext3_grpblk_t colour;
        int depth;
        
        if (path) {
@@ -166,12 +166,12 @@ static int ext3_ext_find_goal(struct ino
        return bg_start + colour + block;
 }
 
-static int
+static ext3_fsblk_t
 ext3_ext_new_block(handle_t *handle, struct inode *inode,
                        struct ext3_ext_path *path, 
                        struct ext3_extent *ex, int *err)
 {
-       int goal, newblock;
+       ext3_fsblk_t goal, newblock;
 
        goal = ext3_ext_find_goal(inode, path, le32_to_cpu(ex->ee_block));
        newblock = ext3_new_block(handle, inode, goal, err);
@@ -243,7 +243,7 @@ static void ext3_ext_show_path(struct in
                  ext_debug("  %d->%d", le32_to_cpu(path->p_idx->ei_block),
                            le32_to_cpu(path->p_idx->ei_leaf));
                } else if (path->p_ext) {
-                       ext_debug("  %d:%d:%lld",
+                       ext_debug("  %d:%d:"E3FSBLK" ",
                                  le32_to_cpu(path->p_ext->ee_block),
                                  le16_to_cpu(path->p_ext->ee_len),
                                  ext_pblock(path->p_ext));
@@ -267,7 +267,7 @@ static void ext3_ext_show_leaf(struct in
        ex = EXT_FIRST_EXTENT(eh);
 
        for (i = 0; i < le16_to_cpu(eh->eh_entries); i++, ex++) {
-               ext_debug("%d:%d:%lld ", le32_to_cpu(ex->ee_block),
+               ext_debug("%d:%d:"E3FSBLK" ", le32_to_cpu(ex->ee_block),
                          le16_to_cpu(ex->ee_len), ext_pblock(ex));
        }
        ext_debug("\n");
@@ -383,7 +383,7 @@ ext3_ext_binsearch(struct inode *inode, 
        }
 
        path->p_ext = l - 1;
-       ext_debug("  -> %d:%lld:%d ",
+       ext_debug("  -> %d:"E3FSBLK":%d ",
                        le32_to_cpu(path->p_ext->ee_block),
                        ext_pblock(path->p_ext),
                        le16_to_cpu(path->p_ext->ee_len));
@@ -497,7 +497,7 @@ err:
  */
 static int ext3_ext_insert_index(handle_t *handle, struct inode *inode,
                                struct ext3_ext_path *curp,
-                               int logical, int ptr)
+                               int logical, ext3_fsblk_t ptr)
 {
        struct ext3_extent_idx *ix;
        int len, err;
@@ -564,9 +564,9 @@ static int ext3_ext_split(handle_t *hand
        struct ext3_extent_idx *fidx;
        struct ext3_extent *ex;
        int i = at, k, m, a;
-       unsigned long newblock, oldblock;
+       ext3_fsblk_t newblock, oldblock;
        __le32 border;
-       int *ablocks = NULL; /* array of allocated blocks */
+       ext3_fsblk_t *ablocks = NULL; /* array of allocated blocks */
        int err = 0;
 
        /* make decision: where to split? */
@@ -599,10 +599,10 @@ static int ext3_ext_split(handle_t *hand
         * we need this to handle errors and free blocks
         * upon them
         */
-       ablocks = kmalloc(sizeof(unsigned long) * depth, GFP_NOFS);
+       ablocks = kmalloc(sizeof(ext3_fsblk_t) * depth, GFP_NOFS);
        if (!ablocks)
                return -ENOMEM;
-       memset(ablocks, 0, sizeof(unsigned long) * depth);
+       memset(ablocks, 0, sizeof(ext3_fsblk_t) * depth);
 
        /* allocate all needed blocks */
        ext_debug("allocate %d blocks for indexes/leaf\n", depth - at);
@@ -641,7 +641,7 @@ static int ext3_ext_split(handle_t *hand
        path[depth].p_ext++;
        while (path[depth].p_ext <=
                        EXT_MAX_EXTENT(path[depth].p_hdr)) {
-               ext_debug("move %d:%lld:%d in new leaf %lu\n",
+               ext_debug("move %d:"E3FSBLK":%d in new leaf "E3FSBLK"\n",
                                le32_to_cpu(path[depth].p_ext->ee_block),
                                ext_pblock(path[depth].p_ext),
                                le16_to_cpu(path[depth].p_ext->ee_len),
@@ -688,7 +688,7 @@ static int ext3_ext_split(handle_t *hand
        while (k--) {
                oldblock = newblock;
                newblock = ablocks[--a];
-               bh = sb_getblk(inode->i_sb, newblock);
+               bh = sb_getblk(inode->i_sb, (ext3_fsblk_t)newblock);
                if (!bh) {
                        err = -EIO;
                        goto cleanup;
@@ -707,7 +707,7 @@ static int ext3_ext_split(handle_t *hand
                fidx->ei_block = border;
                fidx->ei_leaf = cpu_to_le32(oldblock);
 
-               ext_debug("int.index at %d (block %lu): %lu -> %lu\n", i,
+               ext_debug("int.index at %d (block "E3FSBLK"): %lu -> "E3FSBLK"\n", i,
                                newblock, (unsigned long) le32_to_cpu(border),
                                oldblock);
                /* copy indexes */
@@ -719,7 +719,7 @@ static int ext3_ext_split(handle_t *hand
                BUG_ON(EXT_MAX_INDEX(path[i].p_hdr) !=
                                EXT_LAST_INDEX(path[i].p_hdr));
                while (path[i].p_idx <= EXT_MAX_INDEX(path[i].p_hdr)) {
-                       ext_debug("%d: move %d:%d in new index %lu\n", i,
+                       ext_debug("%d: move %d:%d in new index "E3FSBLK"\n", i,
                                        le32_to_cpu(path[i].p_idx->ei_block),
                                        le32_to_cpu(path[i].p_idx->ei_leaf),
                                        newblock);
@@ -798,7 +798,7 @@ static int ext3_ext_grow_indepth(handle_
        struct ext3_extent_header *neh;
        struct ext3_extent_idx *fidx;
        struct buffer_head *bh;
-       unsigned long newblock;
+       ext3_fsblk_t newblock;
        int err = 0;
 
        newblock = ext3_ext_new_block(handle, inode, path, newext, &err);
@@ -1085,7 +1085,7 @@ int ext3_ext_insert_extent(handle_t *han
 
        /* try to insert block into found extent and return */
        if (ex && ext3_can_extents_be_merged(inode, ex, newext)) {
-               ext_debug("append %d block to %d:%d (from %lld)\n",
+               ext_debug("append %d block to %d:%d (from "E3FSBLK")\n",
                                le16_to_cpu(newext->ee_len),
                                le32_to_cpu(ex->ee_block),
                                le16_to_cpu(ex->ee_len), ext_pblock(ex));
@@ -1144,7 +1144,7 @@ has_space:
 
        if (!nearex) {
                /* there is no extent in this leaf, create first one */
-               ext_debug("first extent in the leaf: %d:%lld:%d\n",
+               ext_debug("first extent in the leaf: %d:"E3FSBLK":%d\n",
                                le32_to_cpu(newext->ee_block),
                                ext_pblock(newext),
                                le16_to_cpu(newext->ee_len));
@@ -1156,7 +1156,7 @@ has_space:
                        len = EXT_MAX_EXTENT(eh) - nearex;
                        len = (len - 1) * sizeof(struct ext3_extent);
                        len = len < 0 ? 0 : len;
-                       ext_debug("insert %d:%lld:%d after: nearest 0x%p, "
+                       ext_debug("insert %d:"E3FSBLK":%d after: nearest 0x%p, "
                                        "move %d from 0x%p to 0x%p\n",
                                        le32_to_cpu(newext->ee_block),
                                        ext_pblock(newext),
@@ -1169,7 +1169,7 @@ has_space:
                BUG_ON(newext->ee_block == nearex->ee_block);
                len = (EXT_MAX_EXTENT(eh) - nearex) * sizeof(struct ext3_extent);
                len = len < 0 ? 0 : len;
-               ext_debug("insert %d:%lld:%d before: nearest 0x%p, "
+               ext_debug("insert %d:"E3FSBLK":%d before: nearest 0x%p, "
                                "move %d from 0x%p to 0x%p\n",
                                le32_to_cpu(newext->ee_block),
                                ext_pblock(newext),
@@ -1404,11 +1404,11 @@ ext3_ext_in_cache(struct inode *inode, u
                ex->ee_block = cpu_to_le32(cex->ec_block);
                ext3_ext_store_pblock(ex, cex->ec_start);
                ex->ee_len = cpu_to_le16(cex->ec_len);
-               ext_debug("%lu cached by %lu:%lu:%lu\n",
+               ext_debug("%lu cached by %lu:%lu:"E3FSBLK"\n",
                                (unsigned long) block,
                                (unsigned long) cex->ec_block,
                                (unsigned long) cex->ec_len,
-                               (unsigned long) cex->ec_start);
+                               cex->ec_start);
                return cex->ec_type;
        }
 
@@ -1426,7 +1426,7 @@ int ext3_ext_rm_idx(handle_t *handle, st
 {
        struct buffer_head *bh;
        int err;
-       unsigned long leaf;
+       ext3_fsblk_t leaf;
 
        /* free index block */
        path--;
@@ -1437,7 +1437,7 @@ int ext3_ext_rm_idx(handle_t *handle, st
        path->p_hdr->eh_entries = cpu_to_le16(le16_to_cpu(path->p_hdr->eh_entries)-1);
        if ((err = ext3_ext_dirty(handle, inode, path)))
                return err;
-       ext_debug("index is empty, remove it, free block %lu\n", leaf);
+       ext_debug("index is empty, remove it, free block "E3FSBLK"\n", leaf);
        bh = sb_find_get_block(inode->i_sb, leaf);
        ext3_forget(handle, 1, inode, bh, leaf);
        ext3_free_blocks(handle, inode, leaf, 1);
@@ -1521,10 +1521,11 @@ static int ext3_remove_blocks(handle_t *
        if (from >= le32_to_cpu(ex->ee_block)
            && to == le32_to_cpu(ex->ee_block) + le16_to_cpu(ex->ee_len) - 1) {
                /* tail removal */
-               unsigned long num, start;
+               unsigned long num;
+               ext3_fsblk_t start;
                num = le32_to_cpu(ex->ee_block) + le16_to_cpu(ex->ee_len) - from;
                start = ext_pblock(ex) + le16_to_cpu(ex->ee_len) - num;
-               ext_debug("free last %lu blocks starting %lu\n", num, start);
+               ext_debug("free last %lu blocks starting "E3FSBLK"\n", num, start);
                for (i = 0; i < num; i++) {
                        bh = sb_find_get_block(inode->i_sb, start + i);
                        ext3_forget(handle, 0, inode, bh, start + i);
@@ -1638,7 +1639,7 @@ ext3_ext_rm_leaf(handle_t *handle, struc
                if (err)
                        goto out;
 
-               ext_debug("new extent: %u:%u:%llu\n", block, num,
+               ext_debug("new extent: %u:%u:"E3FSBLK"\n", block, num,
                                ext_pblock(ex));
                ex--;
                ex_ee_block = le32_to_cpu(ex->ee_block);
@@ -1845,13 +1846,14 @@ void ext3_ext_release(struct super_block
 #endif
 }
 
-int ext3_ext_get_blocks(handle_t *handle, struct inode *inode, sector_t iblock,
+int ext3_ext_get_blocks(handle_t *handle, struct inode *inode, ext3_fsblk_t iblock,
                        unsigned long max_blocks, struct buffer_head *bh_result,
                        int create, int extend_disksize)
 {
        struct ext3_ext_path *path = NULL;
        struct ext3_extent newex, *ex;
-       int goal, newblock, err = 0, depth;
+       ext3_fsblk_t goal, newblock;
+       int err = 0, depth;
        unsigned long allocated = 0;
 
        __clear_bit(BH_New, &bh_result->b_state);
@@ -1901,14 +1903,14 @@ int ext3_ext_get_blocks(handle_t *handle
 
        if ((ex = path[depth].p_ext)) {
                unsigned long ee_block = le32_to_cpu(ex->ee_block);
-               unsigned long ee_start = ext_pblock(ex);
+               ext3_fsblk_t ee_start = ext_pblock(ex);
                unsigned short ee_len  = le16_to_cpu(ex->ee_len);
                /* if found exent covers block, simple return it */
                if (iblock >= ee_block && iblock < ee_block + ee_len) {
                        newblock = iblock - ee_block + ee_start;
                        /* number of remain blocks in the extent */
                        allocated = ee_len - (iblock - ee_block);
-                       ext_debug("%d fit into %lu:%d -> %d\n", (int) iblock,
+                       ext_debug("%d fit into %lu:%d -> "E3FSBLK"\n", (int) iblock,
                                        ee_block, ee_len, newblock);
                        ext3_ext_put_in_cache(inode, ee_block, ee_len,
                                                ee_start, EXT3_EXT_CACHE_EXTENT);
@@ -1932,7 +1934,7 @@ int ext3_ext_get_blocks(handle_t *handle
        newblock = ext3_new_blocks(handle, inode, goal, &allocated, &err);
        if (!newblock)
                goto out2;
-       ext_debug("allocate new block: goal %d, found %d/%lu\n",
+       ext_debug("allocate new block: goal "E3FSBLK", found "E3FSBLK"/%lu\n",
                        goal, newblock, allocated);
 
        /* try to insert new extent into found leaf and return */
diff -puN include/linux/ext3_fs_extents.h~extents-ext3_fsblk_t include/linux/ext3_fs_extents.h
--- linux-2.6.16/include/linux/ext3_fs_extents.h~extents-ext3_fsblk_t   2006-05-23 17:11:32.000000000 -0700
+++ linux-2.6.16-cmm/include/linux/ext3_fs_extents.h    2006-05-23 17:11:32.000000000 -0700
@@ -110,7 +110,7 @@ struct ext3_extent_header {
  * truncate uses it to simulate recursive walking
  */
 struct ext3_ext_path {
-       __u32                           p_block;
+       ext3_fsblk_t                    p_block;
        __u16                           p_depth;
        struct ext3_extent              *p_ext;
        struct ext3_extent_idx          *p_idx;
diff -puN include/linux/ext3_fs_i.h~extents-ext3_fsblk_t include/linux/ext3_fs_i.h
--- linux-2.6.16/include/linux/ext3_fs_i.h~extents-ext3_fsblk_t 2006-05-23 17:11:32.000000000 -0700
+++ linux-2.6.16-cmm/include/linux/ext3_fs_i.h  2006-05-23 17:11:32.000000000 -0700
@@ -68,10 +68,10 @@ struct ext3_block_alloc_info {
  * storage for cached extent
  */
 struct ext3_ext_cache {
-       sector_t ec_start;
-       __u32   ec_block;
-       __u32   ec_len; /* must be 32bit to return holes */
-       __u32   ec_type;
+       ext3_fsblk_t    ec_start;
+       __u32           ec_block;
+       __u32           ec_len; /* must be 32bit to return holes */
+       __u32           ec_type;
 };
 
 /*

_




-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.