Re: [PATCH 01/10] Replace ioctls with sysfs interface

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

 



On 08/10/2010 12:04 AM, Pekka Enberg wrote:
> On Mon, Aug 9, 2010 at 8:26 PM, Nitin Gupta <ngupta@xxxxxxxxxx> wrote:
>> Creates per-device sysfs nodes in /sys/block/zram<id>/
>> Currently following stats are exported:
>>  - disksize
>>  - num_reads
>>  - num_writes
>>  - invalid_io
>>  - zero_pages
>>  - orig_data_size
>>  - compr_data_size
>>  - mem_used_total
>>
<snip>
>>
>> Signed-off-by: Nitin Gupta <ngupta@xxxxxxxxxx>
> 
> Looks good to me (but I'm not a sysfs guy).
> 
> Acked-by: Pekka Enberg <penberg@xxxxxxxxxx>
> 

Thanks!

>>  /* Module params (documentation at end) */
>> -static unsigned int num_devices;
>> +unsigned int num_devices;
>> +
>> +static void zram_stat_inc(u32 *v)
>> +{
>> +       *v = *v + 1;
>> +}
>> +
>> +static void zram_stat_dec(u32 *v)
>> +{
>> +       *v = *v - 1;
>> +}
>> +
>> +static void zram_stat64_add(struct zram *zram, u64 *v, u64 inc)
>> +{
>> +       spin_lock(&zram->stat64_lock);
>> +       *v = *v + inc;
>> +       spin_unlock(&zram->stat64_lock);
>> +}
>> +
>> +static void zram_stat64_sub(struct zram *zram, u64 *v, u64 dec)
>> +{
>> +       spin_lock(&zram->stat64_lock);
>> +       *v = *v - dec;
>> +       spin_unlock(&zram->stat64_lock);
>> +}
>> +
>> +static void zram_stat64_inc(struct zram *zram, u64 *v)
>> +{
>> +       zram_stat64_add(zram, v, 1);
>> +}
> 
> These could probably use atomic_inc(), atomic64_inc(), and friends, no?
> 

Yes, I think we could use them. Anyways, they are replaced by percpu stats in
patch 3, so probably this can be left as-is.

Thanks,
Nitin

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
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]