Ticket #9924: 0001-dev.laptop.org-9924-remove-O_SYNC-on-log-file-open-t.patch

File 0001-dev.laptop.org-9924-remove-O_SYNC-on-log-file-open-t.patch, 1.1 KB (added by Quozl, 5 years ago)

This workaround applied to activityfactory.py was tested with strace to verify that open(2) is no longer given O_SYNC, and the Terminal activity had consistent startup times.

  • src/sugar/activity/activityfactory.py

    From f19c6420bff846ccdf791e081cc3d16ac9ec8a25 Mon Sep 17 00:00:00 2001
    From: James Cameron <quozl@laptop.org>
    Date: Wed, 23 Dec 2009 15:35:32 +1100
    Subject: [PATCH] dev.laptop.org #9924: remove O_SYNC on log file open, tentative
    
    Removes the O_SYNC on opening of log files, which on systems with slow
    filesystem random write performance results in a more consistent
    activity startup time.
    ---
     src/sugar/activity/activityfactory.py |    2 +-
     1 files changed, 1 insertions(+), 1 deletions(-)
    
    diff --git a/src/sugar/activity/activityfactory.py b/src/sugar/activity/activityfactory.py
    index ee0fd92..a16840d 100644
    a b def open_log_file(activity): 
    153153        path = env.get_logs_path('%s-%s.log' % (activity.get_bundle_id(), i)) 
    154154        try: 
    155155            fd = os.open(path, os.O_EXCL | os.O_CREAT \ 
    156                              | os.O_SYNC | os.O_WRONLY, 0644) 
     156                             | os.O_WRONLY, 0644) 
    157157            f = os.fdopen(fd, 'w', 0) 
    158158            return (path, f) 
    159159        except OSError, e: