Index: cpukit/libblock/include/rtems/bdbuf.h
===================================================================
--- cpukit/libblock/include/rtems/bdbuf.h	(revision 13d3a37d3870e129b9856638ac9a1ead7acdde98)
+++ cpukit/libblock/include/rtems/bdbuf.h	(revision b6911069d42381b89505803e2c699b4271c25e96)
@@ -364,12 +364,14 @@
   rtems_task_priority swapout_priority;        /**< Priority of the swap out
                                                 * task. */
-  uint32_t            swapout_period;          /**< Period swapout checks buf
+  uint32_t            swapout_period;          /**< Period swap-out checks buf
                                                 * timers. */
   uint32_t            swap_block_hold;         /**< Period a buffer is held. */
   size_t              swapout_workers;         /**< The number of worker
-                                                * threads for the swapout
+                                                * threads for the swap-out
                                                 * task. */
   rtems_task_priority swapout_worker_priority; /**< Priority of the swap out
                                                 * task. */
+  size_t              task_stack_size;         /**< Task stack size for swap-out
+                                                * task and worker threads. */
   size_t              size;                    /**< Size of memory in the
                                                 * cache */
@@ -419,8 +421,13 @@
 
 /**
- * Default swap-out worker task priority. The same as the swapout task.
+ * Default swap-out worker task priority. The same as the swap-out task.
  */
 #define RTEMS_BDBUF_SWAPOUT_WORKER_TASK_PRIORITY_DEFAULT \
                              RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT
+
+/**
+ * Default task stack size for swap-out and worker tasks.
+ */
+#define RTEMS_BDBUF_TASK_STACK_SIZE_DEFAULT RTEMS_MINIMUM_STACK_SIZE
 
 /**
Index: cpukit/libblock/src/bdbuf.c
===================================================================
--- cpukit/libblock/src/bdbuf.c	(revision 13d3a37d3870e129b9856638ac9a1ead7acdde98)
+++ cpukit/libblock/src/bdbuf.c	(revision b6911069d42381b89505803e2c699b4271c25e96)
@@ -174,5 +174,4 @@
 #define RTEMS_BLKDEV_FATAL_BDBUF_SO_NOMEM      RTEMS_BLKDEV_FATAL_ERROR(21)
 #define RTEMS_BLKDEV_FATAL_BDBUF_SO_WK_CREATE  RTEMS_BLKDEV_FATAL_ERROR(22)
-#define RTEMS_BLKDEV_FATAL_BDBUF_SO_WK_START   RTEMS_BLKDEV_FATAL_ERROR(23)
 #define BLKDEV_FATAL_BDBUF_SWAPOUT_RE          RTEMS_BLKDEV_FATAL_ERROR(24)
 #define BLKDEV_FATAL_BDBUF_SWAPOUT_TS          RTEMS_BLKDEV_FATAL_ERROR(25)
@@ -189,10 +188,4 @@
 #define RTEMS_BDBUF_TRANSFER_SYNC  RTEMS_EVENT_1
 #define RTEMS_BDBUF_SWAPOUT_SYNC   RTEMS_EVENT_2
-
-/**
- * The swap out task size. Should be more than enough for most drivers with
- * tracing turned on.
- */
-#define SWAPOUT_TASK_STACK_SIZE (8 * 1024)
 
 /**
@@ -1288,4 +1281,33 @@
 }
 
+static rtems_status_code
+rtems_bdbuf_create_task(
+  rtems_name name,
+  rtems_task_priority priority,
+  rtems_task_priority default_priority,
+  rtems_task_entry entry,
+  rtems_task_argument arg,
+  rtems_id *id
+)
+{
+  rtems_status_code sc;
+  size_t stack_size = bdbuf_config.task_stack_size ?
+    bdbuf_config.task_stack_size : RTEMS_BDBUF_TASK_STACK_SIZE_DEFAULT;
+
+  priority = priority != 0 ? priority : default_priority;
+
+  sc = rtems_task_create (name,
+                          priority,
+                          stack_size,
+                          RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_NO_ASR,
+                          RTEMS_LOCAL | RTEMS_NO_FLOATING_POINT,
+                          id);
+
+  if (sc == RTEMS_SUCCESSFUL)
+    sc = rtems_task_start (*id, entry, arg);
+
+  return sc;
+}
+
 /**
  * Initialise the cache.
@@ -1457,18 +1479,10 @@
   bdbuf_cache.swapout_enabled = true;
 
-  sc = rtems_task_create (rtems_build_name('B', 'S', 'W', 'P'),
-                          bdbuf_config.swapout_priority ?
-                            bdbuf_config.swapout_priority :
-                            RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT,
-                          SWAPOUT_TASK_STACK_SIZE,
-                          RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_NO_ASR,
-                          RTEMS_LOCAL | RTEMS_NO_FLOATING_POINT,
-                          &bdbuf_cache.swapout);
-  if (sc != RTEMS_SUCCESSFUL)
-    goto error;
-
-  sc = rtems_task_start (bdbuf_cache.swapout,
-                         rtems_bdbuf_swapout_task,
-                         (rtems_task_argument) &bdbuf_cache);
+  sc = rtems_bdbuf_create_task (rtems_build_name('B', 'S', 'W', 'P'),
+                                bdbuf_config.swapout_priority,
+                                RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT,
+                                rtems_bdbuf_swapout_task,
+                                0,
+                                &bdbuf_cache.swapout);
   if (sc != RTEMS_SUCCESSFUL)
     goto error;
@@ -2640,20 +2654,12 @@
     worker->transfer.dd = BDBUF_INVALID_DEV;
 
-    sc = rtems_task_create (rtems_build_name('B', 'D', 'o', 'a' + w),
-                            (bdbuf_config.swapout_priority ?
-                             bdbuf_config.swapout_priority :
-                             RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT),
-                            SWAPOUT_TASK_STACK_SIZE,
-                            RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_NO_ASR,
-                            RTEMS_LOCAL | RTEMS_NO_FLOATING_POINT,
-                            &worker->id);
+    sc = rtems_bdbuf_create_task (rtems_build_name('B', 'D', 'o', 'a' + w),
+                                  bdbuf_config.swapout_worker_priority,
+                                  RTEMS_BDBUF_SWAPOUT_WORKER_TASK_PRIORITY_DEFAULT,
+                                  rtems_bdbuf_swapout_worker_task,
+                                  (rtems_task_argument) worker,
+                                  &worker->id);
     if (sc != RTEMS_SUCCESSFUL)
       rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_SO_WK_CREATE);
-
-    sc = rtems_task_start (worker->id,
-                           rtems_bdbuf_swapout_worker_task,
-                           (rtems_task_argument) worker);
-    if (sc != RTEMS_SUCCESSFUL)
-      rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_SO_WK_START);
   }
 
