This is a discussion on Re: Access to struct file in scsi_request_fn()? - Kernel ; email@example.com wrote: > Here's the short question: Is there a way to access the struct file > associated with a write() within the libATA code? > > I've been documenting the semi-direct execution path from a file I/O > open() ...
> Here's the short question: Is there a way to access the struct file
> associated with a write() within the libATA code?
> I've been documenting the semi-direct execution path from a file I/O
> open() call down to the ata_scsi_rw_xlat() call in libATA. I'd like
> to modify my local libATA code to do something based on the file being
> operated on using a flag that I still need to store in struct file,
> perhaps through the private_data field (I haven't worked that out
> yet). The scsi_request_fn() gets a struct request_queue argument that
> has a lot of contexts in it. Could anyone help me with information on
> whether the struct file * is in it somewhere? I know there's some
> kind of cohesion between submitting the scsi command and its
> completion function, but I'm not quite seeing it yet.
> That was painful to write, I'm sure it was painful to read, sorry
> about that. I'm learning more and more as I go, but the big picture
> is still escaping me.
I think that this is likely not a good approach for whatever you're
attempting to do (and you would likely get better responses if you
described what exactly that is). By the time libata or even the SCSI
layer gets a write request, that is pretty well removed from the
original file operation. They may be quite highly separated in time due
to write buffering for one thing.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to firstname.lastname@example.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/