diff options
-rw-r--r-- | debian/patches/ext2fs-two-pagers.patch | 52 |
1 files changed, 37 insertions, 15 deletions
diff --git a/debian/patches/ext2fs-two-pagers.patch b/debian/patches/ext2fs-two-pagers.patch index 808559d8..4f4087f5 100644 --- a/debian/patches/ext2fs-two-pagers.patch +++ b/debian/patches/ext2fs-two-pagers.patch @@ -1,4 +1,4 @@ -commit 553d9fb8e1b04f96f826d512371e5cc4e741c4d0 +commit f06e4557fed5d86a9eb4ab0a1fe54ba021dc53ed Author: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Sat Apr 26 19:48:18 2014 +0200 @@ -15,10 +15,22 @@ Date: Sat Apr 26 19:48:18 2014 +0200 enable us to use a single thread per port bucket in the future. * ext2fs/pager.c (pager_bucket): Rename to... - (disk_pager_bucket + (disk_pager_bucket): ... this to make the change explicit at every + occurrence. + (file_pager_bucket): New variable. + (service_paging_requests): New function. + (create_disk_pager): Also create the file pager. + (diskfs_get_filemap): Handout pagers from the file_pager_bucket. + (diskfs_shutdown_pager): This is only concerned with the file pager. + Simplify code accordingly. + (diskfs_sync_everything): Likewise. + (diskfs_pager_users): Likewise. + (diskfs_max_user_pager_prot): Likewise. + (disable_caching): Iterate over both buckets. + (enable_caching): Likewise. diff --git a/ext2fs/pager.c b/ext2fs/pager.c -index 6e99c83..c979197 100644 +index 6e99c83..1753831 100644 --- a/ext2fs/pager.c +++ b/ext2fs/pager.c @@ -27,8 +27,11 @@ @@ -35,7 +47,7 @@ index 6e99c83..c979197 100644 pthread_spinlock_t node_to_page_lock = PTHREAD_SPINLOCK_INITIALIZER; -@@ -1188,21 +1191,46 @@ disk_cache_block_is_ref (block_t block) +@@ -1188,21 +1191,56 @@ disk_cache_block_is_ref (block_t block) return ref; } @@ -60,7 +72,10 @@ index 6e99c83..c979197 100644 create_disk_pager (void) { + pthread_t thread; ++ pthread_attr_t attr; + error_t err; ++ ++ /* The disk pager. */ struct user_pager_info *upi = malloc (sizeof (struct user_pager_info)); if (!upi) ext2_panic ("can't create disk pager: %s", strerror (errno)); @@ -75,9 +90,16 @@ index 6e99c83..c979197 100644 disk_cache_size, &disk_cache); disk_cache_init (); + ++ /* The file pager. */ + file_pager_bucket = ports_create_bucket (); ++ ++#define STACK_SIZE (64 * 1024) ++ pthread_attr_init (&attr); ++ pthread_attr_setstacksize (&attr, STACK_SIZE); ++#undef STACK_SIZE ++ + /* Make a thread to service file paging requests. */ -+ err = pthread_create (&thread, /* XXX */ NULL, ++ err = pthread_create (&thread, &attr, + service_paging_requests, file_pager_bucket); + if (err) + error (2, err, "pthread_create"); @@ -85,7 +107,7 @@ index 6e99c83..c979197 100644 } /* Call this to create a FILE_DATA pager and return a send right. -@@ -1241,7 +1269,7 @@ diskfs_get_filemap (struct node *node, vm_prot_t prot) +@@ -1241,7 +1279,7 @@ diskfs_get_filemap (struct node *node, vm_prot_t prot) upi->max_prot = prot; diskfs_nref_light (node); node->dn->pager = @@ -94,7 +116,7 @@ index 6e99c83..c979197 100644 MEMORY_OBJECT_COPY_DELAY, 0); if (node->dn->pager == 0) { -@@ -1324,14 +1352,13 @@ diskfs_shutdown_pager () +@@ -1324,14 +1362,13 @@ diskfs_shutdown_pager () error_t shutdown_one (void *v_p) { struct pager *p = v_p; @@ -111,7 +133,7 @@ index 6e99c83..c979197 100644 /* Sync everything on the the disk pager. */ sync_global (1); -@@ -1347,13 +1374,12 @@ diskfs_sync_everything (int wait) +@@ -1347,13 +1384,12 @@ diskfs_sync_everything (int wait) error_t sync_one (void *v_p) { struct pager *p = v_p; @@ -127,7 +149,7 @@ index 6e99c83..c979197 100644 /* Do things on the the disk pager. */ sync_global (wait); -@@ -1372,7 +1398,8 @@ disable_caching () +@@ -1372,7 +1408,8 @@ disable_caching () /* Loop through the pagers and turn off caching one by one, synchronously. That should cause termination of each pager. */ @@ -137,7 +159,7 @@ index 6e99c83..c979197 100644 } static void -@@ -1400,7 +1427,8 @@ enable_caching () +@@ -1400,7 +1437,8 @@ enable_caching () return 0; } @@ -147,7 +169,7 @@ index 6e99c83..c979197 100644 } /* Tell diskfs if there are pagers exported, and if none, then -@@ -1408,7 +1436,7 @@ enable_caching () +@@ -1408,7 +1446,7 @@ enable_caching () int diskfs_pager_users () { @@ -156,7 +178,7 @@ index 6e99c83..c979197 100644 if (npagers <= 1) return 0; -@@ -1421,8 +1449,8 @@ diskfs_pager_users () +@@ -1421,8 +1459,8 @@ diskfs_pager_users () immediately. XXX */ sleep (1); @@ -167,7 +189,7 @@ index 6e99c83..c979197 100644 return 0; /* Darn, there are actual honest users. Turn caching back on, -@@ -1430,7 +1458,7 @@ diskfs_pager_users () +@@ -1430,7 +1468,7 @@ diskfs_pager_users () enable_caching (); } @@ -176,7 +198,7 @@ index 6e99c83..c979197 100644 return 1; } -@@ -1441,17 +1469,15 @@ vm_prot_t +@@ -1441,17 +1479,15 @@ vm_prot_t diskfs_max_user_pager_prot () { vm_prot_t max_prot = 0; @@ -197,7 +219,7 @@ index 6e99c83..c979197 100644 /* Stop iterating if MAX_PROT is as filled as it's going to get. */ return (max_prot == (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE)) ? 1 : 0; -@@ -1463,12 +1489,12 @@ diskfs_max_user_pager_prot () +@@ -1463,12 +1499,12 @@ diskfs_max_user_pager_prot () immediately. XXX */ sleep (1); |