Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Feb 2011 09:28:28 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r218431 - stable/8/sys/dev/md
Message-ID:  <201102080928.p189SSOe040269@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Feb  8 09:28:28 2011
New Revision: 218431
URL: http://svn.freebsd.org/changeset/base/218431

Log:
  MFC r217946:
  Add support for BIO_DELETE on swap-backed md(4).

Modified:
  stable/8/sys/dev/md/md.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/md/md.c
==============================================================================
--- stable/8/sys/dev/md/md.c	Tue Feb  8 09:25:32 2011	(r218430)
+++ stable/8/sys/dev/md/md.c	Tue Feb  8 09:28:28 2011	(r218431)
@@ -648,7 +648,6 @@ mdstart_swap(struct md_s *sc, struct bio
 			}
 			bcopy(p, (void *)(sf_buf_kva(sf) + offs), len);
 			m->valid = VM_PAGE_BITS_ALL;
-#if 0
 		} else if (bp->bio_cmd == BIO_DELETE) {
 			if (len != PAGE_SIZE && m->valid != VM_PAGE_BITS_ALL)
 				rv = vm_pager_get_pages(sc->object, &m, 1, 0);
@@ -658,16 +657,21 @@ mdstart_swap(struct md_s *sc, struct bio
 				vm_page_wakeup(m);
 				break;
 			}
-			bzero((void *)(sf_buf_kva(sf) + offs), len);
-			vm_page_dirty(m);
-			m->valid = VM_PAGE_BITS_ALL;
-#endif
+			if (len != PAGE_SIZE) {
+				bzero((void *)(sf_buf_kva(sf) + offs), len);
+				vm_page_clear_dirty(m, offs, len);
+				m->valid = VM_PAGE_BITS_ALL;
+			} else
+				vm_pager_page_unswapped(m);
 		}
 		sf_buf_free(sf);
 		sched_unpin();
 		vm_page_wakeup(m);
 		vm_page_lock_queues();
-		vm_page_activate(m);
+		if (bp->bio_cmd == BIO_DELETE && len == PAGE_SIZE)
+			vm_page_free(m);
+		else
+			vm_page_activate(m);
 		if (bp->bio_cmd == BIO_WRITE)
 			vm_page_dirty(m);
 		vm_page_unlock_queues();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102080928.p189SSOe040269>