aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dir2_leaf.c
diff options
context:
space:
mode:
authorNathan Scott <nathans@sgi.com>2006-03-13 21:32:24 -0500
committerNathan Scott <nathans@sgi.com>2006-03-13 21:32:24 -0500
commitf6d75cbed997dffb41e3d473bd4c0f899abc3776 (patch)
tree790e0ec4a6347876b7255eb5277b757a3cddc85d /fs/xfs/xfs_dir2_leaf.c
parent1f6553f9f9b6e41375c605769a75bd1646685a1b (diff)
[XFS] Dynamically allocate xfs_dir2_put_args_t structure to reduce stack
pressure in xfs_dir2_leaf_getdents routine. SGI-PV: 947312 SGI-Modid: xfs-linux-melb:xfs-kern:25359a Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_dir2_leaf.c')
-rw-r--r--fs/xfs/xfs_dir2_leaf.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
index d342b6b55239..e4e07c8f7a76 100644
--- a/fs/xfs/xfs_dir2_leaf.c
+++ b/fs/xfs/xfs_dir2_leaf.c
@@ -766,7 +766,7 @@ xfs_dir2_leaf_getdents(
766 xfs_dir2_data_entry_t *dep; /* data entry */ 766 xfs_dir2_data_entry_t *dep; /* data entry */
767 xfs_dir2_data_unused_t *dup; /* unused entry */ 767 xfs_dir2_data_unused_t *dup; /* unused entry */
768 int eof; /* reached end of directory */ 768 int eof; /* reached end of directory */
769 int error=0; /* error return value */ 769 int error = 0; /* error return value */
770 int i; /* temporary loop index */ 770 int i; /* temporary loop index */
771 int j; /* temporary loop index */ 771 int j; /* temporary loop index */
772 int length; /* temporary length value */ 772 int length; /* temporary length value */
@@ -778,8 +778,8 @@ xfs_dir2_leaf_getdents(
778 xfs_mount_t *mp; /* filesystem mount point */ 778 xfs_mount_t *mp; /* filesystem mount point */
779 xfs_dir2_off_t newoff; /* new curoff after new blk */ 779 xfs_dir2_off_t newoff; /* new curoff after new blk */
780 int nmap; /* mappings to ask xfs_bmapi */ 780 int nmap; /* mappings to ask xfs_bmapi */
781 xfs_dir2_put_args_t p; /* formatting arg bundle */ 781 xfs_dir2_put_args_t *p; /* formatting arg bundle */
782 char *ptr=NULL; /* pointer to current data */ 782 char *ptr = NULL; /* pointer to current data */
783 int ra_current; /* number of read-ahead blks */ 783 int ra_current; /* number of read-ahead blks */
784 int ra_index; /* *map index for read-ahead */ 784 int ra_index; /* *map index for read-ahead */
785 int ra_offset; /* map entry offset for ra */ 785 int ra_offset; /* map entry offset for ra */
@@ -797,9 +797,10 @@ xfs_dir2_leaf_getdents(
797 /* 797 /*
798 * Setup formatting arguments. 798 * Setup formatting arguments.
799 */ 799 */
800 p.dbp = dbp; 800 p = kmem_alloc(sizeof(*p), KM_SLEEP);
801 p.put = put; 801 p->dbp = dbp;
802 p.uio = uio; 802 p->put = put;
803 p->uio = uio;
803 /* 804 /*
804 * Set up to bmap a number of blocks based on the caller's 805 * Set up to bmap a number of blocks based on the caller's
805 * buffer size, the directory block size, and the filesystem 806 * buffer size, the directory block size, and the filesystem
@@ -1092,24 +1093,24 @@ xfs_dir2_leaf_getdents(
1092 */ 1093 */
1093 dep = (xfs_dir2_data_entry_t *)ptr; 1094 dep = (xfs_dir2_data_entry_t *)ptr;
1094 1095
1095 p.namelen = dep->namelen; 1096 p->namelen = dep->namelen;
1096 1097
1097 length = XFS_DIR2_DATA_ENTSIZE(p.namelen); 1098 length = XFS_DIR2_DATA_ENTSIZE(p->namelen);
1098 1099
1099 p.cook = XFS_DIR2_BYTE_TO_DATAPTR(mp, curoff + length); 1100 p->cook = XFS_DIR2_BYTE_TO_DATAPTR(mp, curoff + length);
1100 1101
1101 p.ino = INT_GET(dep->inumber, ARCH_CONVERT); 1102 p->ino = INT_GET(dep->inumber, ARCH_CONVERT);
1102#if XFS_BIG_INUMS 1103#if XFS_BIG_INUMS
1103 p.ino += mp->m_inoadd; 1104 p->ino += mp->m_inoadd;
1104#endif 1105#endif
1105 p.name = (char *)dep->name; 1106 p->name = (char *)dep->name;
1106 1107
1107 error = p.put(&p); 1108 error = p->put(p);
1108 1109
1109 /* 1110 /*
1110 * Won't fit. Return to caller. 1111 * Won't fit. Return to caller.
1111 */ 1112 */
1112 if (!p.done) { 1113 if (!p->done) {
1113 eof = 0; 1114 eof = 0;
1114 break; 1115 break;
1115 } 1116 }
@@ -1129,6 +1130,7 @@ xfs_dir2_leaf_getdents(
1129 else 1130 else
1130 uio->uio_offset = XFS_DIR2_BYTE_TO_DATAPTR(mp, curoff); 1131 uio->uio_offset = XFS_DIR2_BYTE_TO_DATAPTR(mp, curoff);
1131 kmem_free(map, map_size * sizeof(*map)); 1132 kmem_free(map, map_size * sizeof(*map));
1133 kmem_free(p, sizeof(*p));
1132 if (bp) 1134 if (bp)
1133 xfs_da_brelse(tp, bp); 1135 xfs_da_brelse(tp, bp);
1134 return error; 1136 return error;