https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b893124a20b8024a26d79…
commit b893124a20b8024a26d794a4d1867845ca3493e4
Author: Serge Gautherie <reactos-git_serge_171003(a)gautherie.fr>
AuthorDate: Fri May 4 06:03:41 2018 +0200
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Fri May 4 08:08:45 2018 +0200
[NTFS] Fix 2 Clang-Cl warnings about CurrentKey->IndexEntry->Flags
"warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]"
CORE-14306
---
drivers/filesystems/ntfs/btree.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/filesystems/ntfs/btree.c b/drivers/filesystems/ntfs/btree.c
index 35a6eb6cd0..a702e25b33 100644
--- a/drivers/filesystems/ntfs/btree.c
+++ b/drivers/filesystems/ntfs/btree.c
@@ -1257,7 +1257,7 @@ UpdateIndexAllocation(PDEVICE_EXTENSION DeviceExt,
}
// Is the Index Entry large enough to store the VCN?
- if (!CurrentKey->IndexEntry->Flags & NTFS_INDEX_ENTRY_NODE)
+ if (!BooleanFlagOn(CurrentKey->IndexEntry->Flags, NTFS_INDEX_ENTRY_NODE))
{
// Allocate memory for the larger index entry
PINDEX_ENTRY_ATTRIBUTE NewEntry = ExAllocatePoolWithTag(NonPagedPool,
@@ -1357,7 +1357,7 @@ UpdateIndexNode(PDEVICE_EXTENSION DeviceExt,
}
// Is the Index Entry large enough to store the VCN?
- if (!CurrentKey->IndexEntry->Flags & NTFS_INDEX_ENTRY_NODE)
+ if (!BooleanFlagOn(CurrentKey->IndexEntry->Flags, NTFS_INDEX_ENTRY_NODE))
{
// Allocate memory for the larger index entry
PINDEX_ENTRY_ATTRIBUTE NewEntry = ExAllocatePoolWithTag(NonPagedPool,
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=65e29b4b1f3ba0360c2fb…
commit 65e29b4b1f3ba0360c2fb30b5c3a38d1ffb784e2
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Wed May 2 23:30:10 2018 +0200
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Wed May 2 23:33:45 2018 +0200
[NTOSKRNL] Optimize a bit deferred writes.
In the lazy writer run, first post items that are queued for this.
Only then, start executing deferred writes if any.
If there were any, reschedule immediately a lazy writer run, to keep
Cc warm and to make it unqueue write faster in case of high IOs situation.
To make second lazy writer run happen faster, we keep our state active to
use short delay (1s) instead of standard idle (3s).
---
ntoskrnl/cc/lazywrite.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/ntoskrnl/cc/lazywrite.c b/ntoskrnl/cc/lazywrite.c
index ddb7bc42c3..8cb5adb2e7 100644
--- a/ntoskrnl/cc/lazywrite.c
+++ b/ntoskrnl/cc/lazywrite.c
@@ -152,12 +152,6 @@ CcLazyWriteScan(VOID)
DPRINT("Lazy writer done (%d)\n", Count);
}
- /* If we have deferred writes, try them now! */
- if (!IsListEmpty(&CcDeferredWrites))
- {
- CcPostDeferredWrites();
- }
-
/* Post items that were due for end of run */
while (!IsListEmpty(&ToPost))
{
@@ -166,10 +160,22 @@ CcLazyWriteScan(VOID)
CcPostWorkQueue(WorkItem, &CcRegularWorkQueue);
}
- /* We're no longer active */
- OldIrql = KeAcquireQueuedSpinLock(LockQueueMasterLock);
- LazyWriter.ScanActive = FALSE;
- KeReleaseQueuedSpinLock(LockQueueMasterLock, OldIrql);
+ /* If we have deferred writes, try them now! */
+ if (!IsListEmpty(&CcDeferredWrites))
+ {
+ CcPostDeferredWrites();
+ /* Reschedule immediately a lazy writer run
+ * Keep us active to have short idle delay
+ */
+ CcScheduleLazyWriteScan(FALSE);
+ }
+ else
+ {
+ /* We're no longer active */
+ OldIrql = KeAcquireQueuedSpinLock(LockQueueMasterLock);
+ LazyWriter.ScanActive = FALSE;
+ KeReleaseQueuedSpinLock(LockQueueMasterLock, OldIrql);
+ }
}
VOID CcScheduleLazyWriteScan(
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f34a30fec4705422bd80c…
commit f34a30fec4705422bd80cff6a46e818b0a65be8a
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Tue May 1 23:41:41 2018 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Wed May 2 00:24:10 2018 +0200
[SHUTDOWN] Actually all shutdown.exe utilities from all Windows (>= XP) versions (and not just Vista+) support a comment string of up to 512, *EVEN IF* they mention in their help message that the comment can only be up to 127 characters long. I have really tested that ;-) (And what is more, shutdown's utility from Whistler support an arbitrary comment length!) So here I remove the code that imposes this limit and I just check for no more than 512 characters. I also fix an out-of-bound [...]
---
base/applications/shutdown/misc.c | 53 -----------------------------------
base/applications/shutdown/precomp.h | 1 -
base/applications/shutdown/shutdown.c | 4 +--
3 files changed, 2 insertions(+), 56 deletions(-)
diff --git a/base/applications/shutdown/misc.c b/base/applications/shutdown/misc.c
index d7949376b5..462672df37 100644
--- a/base/applications/shutdown/misc.c
+++ b/base/applications/shutdown/misc.c
@@ -45,59 +45,6 @@ REASON shutdownReason[] =
{L"P" , 7, 0, SHTDN_REASON_MAJOR_POWER | SHTDN_REASON_MINOR_ENVIRONMENT} /* Legacy API shutdown (Planned) */
};
-/*
- * This command helps to work around the fact that the shutdown utility has
- * different upper limits for the comment flag since each version of Windows
- * seems to have different upper limits.
- */
-BOOL CheckCommentLength(LPCWSTR comment)
-{
- DWORD finalLength = 0;
- size_t strLength = 0;
- DWORD osVersion = 0;
- DWORD osMajorVersion = 0;
- DWORD osMinorVersion = 0;
-
- /* An empty string is always valid. */
- if (!comment || *comment == 0)
- return TRUE;
-
- /* Grab the version of the current Operating System. */
- osVersion = GetVersion();
-
- osMajorVersion = (DWORD)(LOBYTE(LOWORD(osVersion)));
- osMinorVersion = (DWORD)(HIBYTE(LOWORD(osVersion)));
-
- /*
- * Check to make sure that the proper length is being used
- * based upon the version of Windows currently being used.
- */
- if (osMajorVersion == 5) /* Windows XP/2003 */
- {
- if ((osMinorVersion == 1) || (osMinorVersion == 2))
- {
- finalLength = 127;
- }
- }
- else if (osMajorVersion == 6) /* Windows Vista/7/2008 */
- {
- if ((osMinorVersion == 0) || (osMinorVersion == 1))
- {
- finalLength = 512;
- }
- }
-
- /* Grab the length of the comment string. */
- strLength = wcslen(comment);
-
- /*
- * Compare the size of the string to make sure
- * it fits with the current version of Windows,
- * and return TRUE or FALSE accordingly.
- */
- return (strLength <= finalLength);
-}
-
/*
* This function parses the reason code to a usable format that will specify
* why the user wants to shut the computer down. Although this is used for
diff --git a/base/applications/shutdown/precomp.h b/base/applications/shutdown/precomp.h
index f13ce2b0d4..a63cc470a5 100644
--- a/base/applications/shutdown/precomp.h
+++ b/base/applications/shutdown/precomp.h
@@ -52,7 +52,6 @@ extern const DWORD defaultReason;
/* PROTOTYPES *****************************************************************/
/* misc.c */
-BOOL CheckCommentLength(LPCWSTR);
DWORD ParseReasonCode(LPCWSTR);
VOID DisplayError(DWORD dwError);
diff --git a/base/applications/shutdown/shutdown.c b/base/applications/shutdown/shutdown.c
index 3e492b9d90..f4c403d1ae 100644
--- a/base/applications/shutdown/shutdown.c
+++ b/base/applications/shutdown/shutdown.c
@@ -56,9 +56,9 @@ ParseArguments(struct CommandLineOptions* pOpts, int argc, WCHAR *argv[])
break;
case L'c': /* Comment on reason for shutdown */
- if (index+1 > argc)
+ if (index+1 >= argc)
return ERROR_INVALID_DATA;
- if(CheckCommentLength(argv[index+1]))
+ if (!argv[index+1] || wcslen(argv[index+1]) <= 512)
{
pOpts->message = argv[index+1];
index++;