Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F161040655
D23222.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D23222.diff
View Options
Index: sys/vm/swap_pager.c
===================================================================
--- sys/vm/swap_pager.c
+++ sys/vm/swap_pager.c
@@ -424,6 +424,11 @@
static int swapoff_one(struct swdevt *sp, struct ucred *cred);
/*
+ * Swap swdevt functions
+ */
+static bool swp_swdevt_available(struct swdevt *sp, int npages);
+
+/*
* Swap bitmap functions
*/
static void swp_pager_freeswapspace(daddr_t blk, daddr_t npages);
@@ -734,6 +739,16 @@
object->type = OBJT_DEAD;
}
+static bool
+swp_swdevt_available(struct swdevt *sp, int npages)
+{
+
+ if (sp->sw_flags & SW_CLOSING)
+ return (false);
+ return (sp->sw_nblks - howmany(BBSIZE, PAGE_SIZE) - sp->sw_used >=
+ npages );
+}
+
/************************************************************************
* SWAP PAGER BITMAP ROUTINES *
************************************************************************/
@@ -768,7 +783,7 @@
while (!TAILQ_EMPTY(&swtailq)) {
if (sp == NULL)
sp = TAILQ_FIRST(&swtailq);
- if ((sp->sw_flags & SW_CLOSING) == 0)
+ if (swp_swdevt_available(sp, npages))
blk = blist_alloc(sp->sw_blist, &npages, mpages);
if (blk != SWAPBLK_NONE)
break;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jul 1, 1:33 AM (41 m, 17 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34536285
Default Alt Text
D23222.diff (1 KB)
Attached To
Mode
D23222: Check swblk size if a swap device has enoush space before calling blist_alloc
Attached
Detach File
Event Timeline
Log In to Comment