Patchset to add asynchronous open/close to master

Jeremy Allison jra at samba.org
Tue Jun 12 18:29:14 MDT 2012


On Tue, Jun 12, 2012 at 08:23:14PM -0400, simo wrote:
> On Tue, 2012-06-12 at 16:49 -0700, Jeremy Allison wrote:
> > >From ad8aa7bc364e2badbf052c50511aae85b76c8eea Mon Sep 17 00:00:00
> > 2001
> > From: Jeremy Allison <jra at samba.org>
> > Date: Tue, 12 Jun 2012 13:54:08 -0700
> > Subject: [PATCH 05/13] Add new bool field async_open to struct
> >  deferred_open_record. Not used yet.
> > 
> > ---
> >  source3/smbd/open.c |    4 ++++
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> > 
> > diff --git a/source3/smbd/open.c b/source3/smbd/open.c
> > index 3ea0759..f39b2c6 100644
> > --- a/source3/smbd/open.c
> > +++ b/source3/smbd/open.c
> > @@ -35,6 +35,7 @@ extern const struct generic_mapping
> > file_generic_mapping;
> >  
> >  struct deferred_open_record {
> >          bool delayed_for_oplocks;
> > +       bool async_open;
> >          struct file_id id;
> >  };
> >  
> > @@ -1529,6 +1530,7 @@ static void schedule_defer_open(struct
> > share_mode_lock *lck,
> >  
> >         ZERO_STRUCT(state);
> >         state.delayed_for_oplocks = True;
> > +       state.async_open = false;
> >         state.id = lck->data->id;
> >  
> >         if (!request_timed_out(request_time, timeout)) {
> > @@ -2164,6 +2166,7 @@ static NTSTATUS
> > open_file_ntcreate(connection_struct *conn,
> >  
> >                                 ZERO_STRUCT(state);
> >                                 state.delayed_for_oplocks = False;
> > +                               state.async_open = false;
> >                                 state.id = id;
> >  
> >                                 if ((req != NULL)
> > @@ -2306,6 +2309,7 @@ static NTSTATUS
> > open_file_ntcreate(connection_struct *conn,
> >  
> >                         ZERO_STRUCT(state);
> >                         state.delayed_for_oplocks = False;
> > +                       state.async_open = false;
> >                         state.id = id;
> >  
> >                         /* Do it all over again immediately. In the
> > second
> 
> What's the point of setting this to false if you just zeroed the
> struct ?

So you can quickly see which calls are going to be
an async open, and which are not.

Relying on the ZERO_STRUT makes it implicit, setting
state.async_open = false makes it explicit.

It's just clearer to me (I screwed this up when
developing the code - forgetting the ZERO_STRUCT,
which caused bad behavior).

So it's a clarity, rather than correctness thing.

Jeremy.


More information about the samba-technical mailing list