- * Expand size of target table.
- *
- * When the target table is full, we have to extend the table. To do so,
- * we allocate new memory with some reserve, move data from the old table
- * to the new one and release memory consumed by the old table.
- * Notice we take ltd_rw_sem exclusively to ensure atomic switch.
- *
- * \param[in] ltd target table
- * \param[in] newsize new size of the table
- *
- * \retval 0 on success
- * \retval -ENOMEM if reallocation failed
- */
-static int ltd_bitmap_resize(struct lod_tgt_descs *ltd, __u32 newsize)
-{
- struct cfs_bitmap *new_bitmap, *old_bitmap = NULL;
- int rc = 0;
- ENTRY;
-
- /* grab write reference on the lod. Relocating the array requires
- * exclusive access */
-
- down_write(<d->ltd_rw_sem);
- if (newsize <= ltd->ltd_tgts_size)
- /* someone else has already resize the array */
- GOTO(out, rc = 0);
-
- /* allocate new bitmap */
- new_bitmap = CFS_ALLOCATE_BITMAP(newsize);
- if (!new_bitmap)
- GOTO(out, rc = -ENOMEM);
-
- if (ltd->ltd_tgts_size > 0) {
- /* the bitmap already exists, we need
- * to copy data from old one */
- cfs_bitmap_copy(new_bitmap, ltd->ltd_tgt_bitmap);
- old_bitmap = ltd->ltd_tgt_bitmap;
- }
-
- ltd->ltd_tgts_size = newsize;
- ltd->ltd_tgt_bitmap = new_bitmap;
-
- if (old_bitmap)
- CFS_FREE_BITMAP(old_bitmap);
-
- CDEBUG(D_CONFIG, "tgt size: %d\n", ltd->ltd_tgts_size);
-
- EXIT;
-out:
- up_write(<d->ltd_rw_sem);
- return rc;
-}
-
-/**