Re: [PATCH 09/11] sysfs: Push file_update_time() into bin_page_mkwrite()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jan Kara <jack@xxxxxxx> writes:

> On Thu 16-02-12 13:04:44, Alex Elder wrote:
>> On Thu, 2012-02-16 at 14:46 +0100, Jan Kara wrote:
>> > CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>> > Signed-off-by: Jan Kara <jack@xxxxxxx>
>> > ---
>> >  fs/sysfs/bin.c |    2 ++
>> >  1 files changed, 2 insertions(+), 0 deletions(-)
>> > 
>> > diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c
>> > index a475983..6ceb16f 100644
>> > --- a/fs/sysfs/bin.c
>> > +++ b/fs/sysfs/bin.c
>> > @@ -225,6 +225,8 @@ static int bin_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
>> >  	if (!sysfs_get_active(attr_sd))
>> >  		return VM_FAULT_SIGBUS;
>> >  
>> > +	file_update_time(file);
>> > +
>> >  	ret = 0;
>> >  	if (bb->vm_ops->page_mkwrite)
>> >  		ret = bb->vm_ops->page_mkwrite(vma, vmf);
>> 
>> If the filesystem's page_mkwrite() function is responsible
>> for updating the time, can't the call to file_update_time()
>> here be conditional?
>> 
>> I.e:
>> 	ret = 0;
>> 	if (bb->vm_ops->page_mkwrite)
>>  		ret = bb->vm_ops->page_mkwrite(vma, vmf);
>> 	else
>> 		file_update_time(file);
>   Hmm, I didn't look previously where do we get bb->vm_ops. It seems they
> are inherited from vma->vm_ops so what you suggest should be safe without
> any further changes. So I can do that if someone who understands the sysfs
> code likes it more.

I do.  Essentially sysfs is being a stackable filesystem here, because
sysfs needs the ability to remove a file mapping.

In practice we could probably get away without a single
file_update_time(file) here because there are mmio mappings.  Normally
for pci resources, but we might as well use good form since we can.

Eric

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]