Date: Tue, 28 Jun 2011 20:57:55 +0000 (UTC) From: Mikolaj Golub <trociny@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r223654 - head/sbin/hastd Message-ID: <201106282057.p5SKvtXX065251@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trociny Date: Tue Jun 28 20:57:54 2011 New Revision: 223654 URL: http://svn.freebsd.org/changeset/base/223654 Log: Make activemap_write_start/complete check the keepdirty list, when stating if we need to update activemap on disk. This makes keepdirty serve its purpose -- to reduce number of metadata updates. Discussed with: pjd Approved by: pjd (mentor) Modified: head/sbin/hastd/activemap.c Modified: head/sbin/hastd/activemap.c ============================================================================== --- head/sbin/hastd/activemap.c Tue Jun 28 20:28:11 2011 (r223653) +++ head/sbin/hastd/activemap.c Tue Jun 28 20:57:54 2011 (r223654) @@ -205,7 +205,7 @@ keepdirty_find(struct activemap *amp, in return (kd); } -static void +static bool keepdirty_add(struct activemap *amp, int extent) { struct keepdirty *kd; @@ -217,7 +217,7 @@ keepdirty_add(struct activemap *amp, int */ TAILQ_REMOVE(&->am_keepdirty, kd, kd_next); TAILQ_INSERT_HEAD(&->am_keepdirty, kd, kd_next); - return; + return (false); } /* * Add new element, but first remove the most unused one if @@ -238,6 +238,8 @@ keepdirty_add(struct activemap *amp, int amp->am_nkeepdirty++; TAILQ_INSERT_HEAD(&->am_keepdirty, kd, kd_next); } + + return (true); } static void @@ -308,9 +310,9 @@ activemap_write_start(struct activemap * assert(!bit_test(amp->am_memmap, ext)); bit_set(amp->am_memmap, ext); amp->am_ndirty++; - modified = true; } - keepdirty_add(amp, ext); + if (keepdirty_add(amp, ext)) + modified = true; } return (modified); @@ -345,7 +347,8 @@ activemap_write_complete(struct activema if (--amp->am_memtab[ext] == 0) { bit_clear(amp->am_memmap, ext); amp->am_ndirty--; - modified = true; + if (keepdirty_find(amp, ext) == NULL) + modified = true; } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106282057.p5SKvtXX065251>