public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* ext4-block-reservation.patch
@ 2007-06-19 10:29 Aneesh Kumar K.V
  2007-06-19 10:42 ` ext4-block-reservation.patch Alex Tomas
  2007-06-19 15:05 ` ext4-block-reservation.patch Eric Sandeen
  0 siblings, 2 replies; 6+ messages in thread
From: Aneesh Kumar K.V @ 2007-06-19 10:29 UTC (permalink / raw)
  To: alex, linux-ext4

Hi,

In block reservation code while rebalancing the free blocks why are we not 
looking at the reservation slots that have no free blocks left.  Rebalancing
the free blocks equally across all the reservation slots will make sure
we have less chances of failure later when we try to reserve blocks. 


I understand that we consider the CPU slot on which reservation failed while
rebalancing. But what is preventing considering other CPU slot that might have
zero blocks left ?




+void ext4_rebalance_reservation(struct ext4_reservation_slot *rs, __u64 free)
+{
+       int i, used_slots = 0;
+       __u64 chunk;
+
+       /* let's know what slots have been used */
+       for (i = 0; i < NR_CPUS; i++)
+               if (rs[i].rs_reserved || i == smp_processor_id())
+                       used_slots++;
+
+       /* chunk is a number of block every used
+        * slot will get. make sure it isn't 0 */
+       chunk = free + used_slots - 1;
+       do_div(chunk, used_slots);
+
+       for (i = 0; i < NR_CPUS; i++) {
+               if (free < chunk)
+                       chunk = free;
+               if (rs[i].rs_reserved || i == smp_processor_id()) {
+                       rs[i].rs_reserved = chunk;
+                       free -= chunk;
+                       BUG_ON(free < 0);
+               }
+       }
+       BUG_ON(free);
+}


-aneesh

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-06-19 22:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-19 10:29 ext4-block-reservation.patch Aneesh Kumar K.V
2007-06-19 10:42 ` ext4-block-reservation.patch Alex Tomas
2007-06-19 15:05 ` ext4-block-reservation.patch Eric Sandeen
2007-06-19 17:08   ` ext4-block-reservation.patch Aneesh Kumar K.V
2007-06-19 17:16     ` ext4-block-reservation.patch Aneesh Kumar K.V
2007-06-19 22:10     ` ext4-block-reservation.patch Andreas Dilger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox